Skip to content

Commit

Permalink
https://github.com/sdasgup3/binary-decompilation/issues/77
Browse files Browse the repository at this point in the history
  • Loading branch information
sdasgup3 committed Jul 1, 2018
1 parent 0715893 commit ae57b4c
Show file tree
Hide file tree
Showing 23 changed files with 3,505 additions and 423 deletions.
114 changes: 4 additions & 110 deletions tests/gcc.c-torture/job_101_600/bin/20010904-1-0.asm
Original file line number Diff line number Diff line change
@@ -1,113 +1,7 @@
strchr:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -8(%rbp)
movl %esi, -12(%rbp)
nop
movq -8(%rbp), %rax
movzbl (%rax), %edx
movl -12(%rbp), %eax
cmpb %al, %dl
je L6
movq -8(%rbp), %rax
leaq 1(%rax), %rdx
movq %rdx, -8(%rbp)
movzbl (%rax), %eax
testb %al, %al
jne L3
movl $0, %eax
jmp L1
L3:
movq -8(%rbp), %rax
jmp L1
L6:
L1:
popq %rbp
ret
strlen:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -24(%rbp)
movq $0, -8(%rbp)
jmp L8
L9:
addq $1, -8(%rbp)
L8:
movq -24(%rbp), %rdx
movq -8(%rbp), %rax
addq %rdx, %rax
movzbl (%rax), %eax
testb %al, %al
jne L9
movq -8(%rbp), %rax
popq %rbp
ret
strcpy:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -24(%rbp)
movq %rsi, -32(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
nop
L12:
movq -24(%rbp), %rax
leaq 1(%rax), %rdx
movq %rdx, -24(%rbp)
movq -32(%rbp), %rdx
leaq 1(%rdx), %rcx
movq %rcx, -32(%rbp)
movzbl (%rdx), %edx
movb %dl, (%rax)
movzbl (%rax), %eax
testb %al, %al
jne L12
movq -8(%rbp), %rax
popq %rbp
ret
exit:
pushq %rbp
movq %rsp, %rbp
movl %edi, -4(%rbp)
movq $-1, %rax
jmp %rax
popq %rbp
ret
abort:
pushq %rbp
movq %rsp, %rbp
movq $-1, %rax
jmp %rax
popq %rbp
ret
memset:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -24(%rbp)
movl %esi, -28(%rbp)
movq %rdx, -40(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
jmp L17
L18:
movq -8(%rbp), %rax
leaq 1(%rax), %rdx
movq %rdx, -8(%rbp)
movl -28(%rbp), %edx
movb %dl, (%rax)
L17:
movq -40(%rbp), %rax
leaq -1(%rax), %rdx
movq %rdx, -40(%rbp)
testq %rax, %rax
jne L18
movq -24(%rbp), %rax
popq %rbp
ret
.comm y,2112,64
.globl _start
_start:
pushq %rbp
movq %rsp, %rbp
subq $528, %rsp
call abort
movl $0, %edi
call exit
163 changes: 141 additions & 22 deletions tests/gcc.c-torture/job_101_600/bin/20011008-3-0.asm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,46 @@ L12:
movq -8(%rbp), %rax
popq %rbp
ret
memcmp:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -24(%rbp)
movq %rsi, -32(%rbp)
movq %rdx, -40(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
movq -32(%rbp), %rax
movq %rax, -16(%rbp)
jmp L15
L18:
movq -8(%rbp), %rax
movzbl (%rax), %edx
movq -16(%rbp), %rax
movzbl (%rax), %eax
cmpb %al, %dl
je L16
movq -8(%rbp), %rax
movzbl (%rax), %eax
movzbl %al, %edx
movq -16(%rbp), %rax
movzbl (%rax), %eax
movzbl %al, %eax
subl %eax, %edx
movl %edx, %eax
jmp L17
L16:
addq $1, -8(%rbp)
addq $1, -16(%rbp)
L15:
movq -40(%rbp), %rax
leaq -1(%rax), %rdx
movq %rdx, -40(%rbp)
testq %rax, %rax
jne L18
movl $0, %eax
L17:
popq %rbp
ret
exit:
pushq %rbp
movq %rsp, %rbp
Expand All @@ -90,22 +130,101 @@ memset:
movq %rdx, -40(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
jmp L17
L18:
jmp L22
L23:
movq -8(%rbp), %rax
leaq 1(%rax), %rdx
movq %rdx, -8(%rbp)
movl -28(%rbp), %edx
movb %dl, (%rax)
L17:
L22:
movq -40(%rbp), %rax
leaq -1(%rax), %rdx
movq %rdx, -40(%rbp)
testq %rax, %rax
jne L18
jne L23
movq -24(%rbp), %rax
popq %rbp
ret
memcpy:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -24(%rbp)
movq %rsi, -32(%rbp)
movq %rdx, -40(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
movq -32(%rbp), %rax
movq %rax, -16(%rbp)
jmp L26
L27:
movq -8(%rbp), %rax
leaq 1(%rax), %rdx
movq %rdx, -8(%rbp)
movq -16(%rbp), %rdx
leaq 1(%rdx), %rcx
movq %rcx, -16(%rbp)
movzbl (%rdx), %edx
movb %dl, (%rax)
L26:
movq -40(%rbp), %rax
leaq -1(%rax), %rdx
movq %rdx, -40(%rbp)
testq %rax, %rax
jne L27
movq -24(%rbp), %rax
popq %rbp
ret
malloc:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -8(%rbp)
movl $1000, %eax
popq %rbp
ret
calloc:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -8(%rbp)
movq %rsi, -16(%rbp)
movl $1000, %eax
popq %rbp
ret
free:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -8(%rbp)
popq %rbp
ret
isprint:
pushq %rbp
movq %rsp, %rbp
movl %edi, -4(%rbp)
cmpl $96, -4(%rbp)
jle L35
cmpl $122, -4(%rbp)
jg L35
movl $1, %eax
jmp L36
L35:
cmpl $64, -4(%rbp)
jle L37
cmpl $90, -4(%rbp)
jg L37
movl $1, %eax
jmp L36
L37:
cmpl $47, -4(%rbp)
jle L38
cmpl $57, -4(%rbp)
jg L38
movl $1, %eax
jmp L36
L38:
movl $0, %eax
L36:
popq %rbp
ret
log_compare:
pushq %rbp
movq %rsp, %rbp
Expand All @@ -123,12 +242,12 @@ __db_txnlist_lsnadd:
movq %rdx, -40(%rbp)
movl %ecx, -24(%rbp)
movl $0, -4(%rbp)
jmp L23
L29:
jmp L42
L48:
addl $1, -20(%rbp)
movl $0, -8(%rbp)
jmp L24
L26:
jmp L43
L45:
movq -32(%rbp), %rax
movq 32(%rax), %rax
movl -8(%rbp), %edx
Expand All @@ -146,7 +265,7 @@ L26:
movq %rax, %rdi
call log_compare
testl %eax, %eax
jns L25
jns L44
movq -32(%rbp), %rax
movq 32(%rax), %rax
movl -8(%rbp), %edx
Expand Down Expand Up @@ -179,28 +298,28 @@ L26:
addq %rax, %rdx
movq -16(%rbp), %rax
movq %rax, (%rdx)
L25:
L44:
addl $1, -8(%rbp)
L24:
L43:
movq -32(%rbp), %rax
movl 24(%rax), %eax
subl $1, %eax
cmpl -8(%rbp), %eax
jg L26
jg L45
addl $1, -4(%rbp)
L23:
L42:
movl -24(%rbp), %eax
andl $1, %eax
testl %eax, %eax
je L27
je L46
movq -32(%rbp), %rax
movl 24(%rax), %eax
jmp L28
L27:
jmp L47
L46:
movl $1, %eax
L28:
L47:
cmpl -4(%rbp), %eax
jg L29
jg L48
movq -32(%rbp), %rax
movq 32(%rax), %rdx
movq -40(%rbp), %rax
Expand All @@ -224,18 +343,18 @@ _start:
movl $0, %edi
call __db_txnlist_lsnadd
cmpl $1, %eax
je L32
je L51
call abort
L32:
L51:
leaq -96(%rbp), %rdx
leaq -80(%rbp), %rax
movl $1, %ecx
movq %rax, %rsi
movl $0, %edi
call __db_txnlist_lsnadd
cmpl $31, %eax
je L33
je L52
call abort
L33:
L52:
movl $0, %edi
call exit
Loading

0 comments on commit ae57b4c

Please sign in to comment.