arise-sustech
commited on
Commit
•
81c62d9
1
Parent(s):
c231f6e
Update README.md
Browse files
README.md
CHANGED
@@ -35,8 +35,6 @@ import re
|
|
35 |
digit_pattern = r'\b0x[a-fA-F0-9]+\b'# binary codes in Hexadecimal
|
36 |
zeros_pattern = r'^0+\s'#0s
|
37 |
OPT = ["O0", "O1", "O2", "O3"]
|
38 |
-
before = f"# This is the assembly code with {opt_state} optimization:\n"
|
39 |
-
after = "\n# What is the source code?\n"
|
40 |
fileName = 'path/to/file'
|
41 |
with open(fileName+'.c','r') as f:#original file
|
42 |
c_func = f.read()
|
@@ -56,7 +54,8 @@ for opt_state in OPT:
|
|
56 |
tmp_asm = tmp_asm.split('#')[0].strip()#remove the comments
|
57 |
input_asm+=tmp_asm+'\n'
|
58 |
input_asm = re.sub(zeros_pattern, '', input_asm)
|
59 |
-
|
|
|
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)
|
|
|
35 |
digit_pattern = r'\b0x[a-fA-F0-9]+\b'# binary codes in Hexadecimal
|
36 |
zeros_pattern = r'^0+\s'#0s
|
37 |
OPT = ["O0", "O1", "O2", "O3"]
|
|
|
|
|
38 |
fileName = 'path/to/file'
|
39 |
with open(fileName+'.c','r') as f:#original file
|
40 |
c_func = f.read()
|
|
|
54 |
tmp_asm = tmp_asm.split('#')[0].strip()#remove the comments
|
55 |
input_asm+=tmp_asm+'\n'
|
56 |
input_asm = re.sub(zeros_pattern, '', input_asm)
|
57 |
+
before = f"# This is the assembly code with {opt_state} optimization:\n"#prompt
|
58 |
+
after = "\n# What is the source code?\n"#prompt
|
59 |
input_asm_prompt = before+input_asm.strip()+after
|
60 |
with open(fileName +'_' + opt_state +'.asm','w',encoding='utf-8') as f:
|
61 |
f.write(input_asm_prompt)
|