Spaces:
Sleeping
Sleeping
Commit
·
c74a501
1
Parent(s):
320a0f1
Add header
Browse files
app.py
CHANGED
@@ -32,6 +32,13 @@ examples = json.load(open("humaneval_decompile_nova_6.7b.json", "r"))
|
|
32 |
def predict(type, input_asm, _c_source):
|
33 |
|
34 |
if "<func0>:" not in input_asm:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
normalized_asm = normalize(input_asm)
|
36 |
else:
|
37 |
normalized_asm = input_asm
|
@@ -78,13 +85,7 @@ def predict(type, input_asm, _c_source):
|
|
78 |
|
79 |
return output
|
80 |
|
81 |
-
example = """
|
82 |
-
what.o: file format elf64-x86-64
|
83 |
-
|
84 |
-
|
85 |
-
Disassembly of section .text:
|
86 |
-
|
87 |
-
0000000000000000 <mystery>:
|
88 |
0: f3 0f 1e fa endbr64
|
89 |
4: 55 push %rbp
|
90 |
5: 48 89 e5 mov %rsp,%rbp
|
|
|
32 |
def predict(type, input_asm, _c_source):
|
33 |
|
34 |
if "<func0>:" not in input_asm:
|
35 |
+
|
36 |
+
# Add a bogus function header if needed.
|
37 |
+
first_line = input_asm.split("\n")[0]
|
38 |
+
if "<" not in first_line or ">" not in first_line:
|
39 |
+
print("Adding bogus function header")
|
40 |
+
input_asm = "<func0>:\n" + input_asm
|
41 |
+
|
42 |
normalized_asm = normalize(input_asm)
|
43 |
else:
|
44 |
normalized_asm = input_asm
|
|
|
85 |
|
86 |
return output
|
87 |
|
88 |
+
example = """0000000000000000 <mystery>:
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
0: f3 0f 1e fa endbr64
|
90 |
4: 55 push %rbp
|
91 |
5: 48 89 e5 mov %rsp,%rbp
|