arise-sustech commited on
Commit
c8fc5c3
1 Parent(s): 050c78d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -4
README.md CHANGED
@@ -33,11 +33,9 @@ import subprocess
33
  import os
34
  import re
35
 
36
- digit_pattern = r'\b0x[a-fA-F0-9]+\b'# binary codes in Hexadecimal
37
  zeros_pattern = r'^0+\s'#0s
38
  OPT = ["O0", "O1", "O2", "O3"]
39
- before = f"# This is the assembly code with {opt_state} optimization:\n"
40
- after = "\n# What is the source code?\n"
41
  fileName = 'path/to/file'
42
  with open(fileName+'.c','r') as f:#original file
43
  c_func = f.read()
@@ -57,7 +55,8 @@ for opt_state in OPT:
57
  tmp_asm = tmp_asm.split('#')[0].strip()#remove the comments
58
  input_asm+=tmp_asm+'\n'
59
  input_asm = re.sub(zeros_pattern, '', input_asm)
60
-
 
61
  input_asm_prompt = before+input_asm.strip()+after
62
  with open(fileName +'_' + opt_state +'.asm','w',encoding='utf-8') as f:
63
  f.write(input_asm_prompt)
 
33
  import os
34
  import re
35
 
36
+ digit_pattern = r'\b0x[a-fA-F0-9]+\b'# binary codes in Hexadecimal
37
  zeros_pattern = r'^0+\s'#0s
38
  OPT = ["O0", "O1", "O2", "O3"]
 
 
39
  fileName = 'path/to/file'
40
  with open(fileName+'.c','r') as f:#original file
41
  c_func = f.read()
 
55
  tmp_asm = tmp_asm.split('#')[0].strip()#remove the comments
56
  input_asm+=tmp_asm+'\n'
57
  input_asm = re.sub(zeros_pattern, '', input_asm)
58
+ before = f"# This is the assembly code with {opt_state} optimization:\n"#prompt
59
+ after = "\n# What is the source code?\n"#prompt
60
  input_asm_prompt = before+input_asm.strip()+after
61
  with open(fileName +'_' + opt_state +'.asm','w',encoding='utf-8') as f:
62
  f.write(input_asm_prompt)