6c55f4bd28
M1 -f stage0/x86.M1 -f mlibc/crt1.M1 --LittleEndian --Architecture=1 > mlibc/crt1.hex2 M1 -f stage0/x86.M1 -f mlibc/mini-libc-mes.M1 --LittleEndian --Architecture=1 > mlibc/libc-mes.hex2 M1 -f stage0/x86.M1 -f src/mes.M1 --LittleEndian --Architecture=1 > src/mes.hex2 hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f stage0/elf32-header.hex2 -f mlibc/crt1.hex2 -f mlibc/libc-mes.hex2 -f src/mes.hex2 -f stage0/elf32-footer-single-main.hex2 > src/mes-mes exec_enable src/mes-mes * mlibc/crt1.M1: New File. * mlibc/libc-mes.M1: New File. * src/mes.M1: New File.
1918 lines
36 KiB
Plaintext
1918 lines
36 KiB
Plaintext
|
|
|
|
:exit
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%ebx !8
|
|
mov____$i32,%eax SYS_exit
|
|
int____$0x80
|
|
leave
|
|
ret
|
|
|
|
|
|
:read
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%ebx !8
|
|
mov____0x8(%ebp),%ecx !12
|
|
mov____0x8(%ebp),%edx !16
|
|
mov____$i32,%eax SYS_read
|
|
int____$0x80
|
|
leave
|
|
ret
|
|
|
|
|
|
:write
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%ebx !8
|
|
mov____0x8(%ebp),%ecx !12
|
|
mov____0x8(%ebp),%edx !16
|
|
mov____$i32,%eax SYS_write
|
|
int____$0x80
|
|
leave
|
|
ret
|
|
|
|
|
|
:open
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%ebx !8
|
|
mov____0x8(%ebp),%ecx !12
|
|
mov____0x8(%ebp),%edx !16
|
|
mov____$i32,%eax SYS_open
|
|
int____$0x80
|
|
leave
|
|
ret
|
|
|
|
|
|
:access
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%ebx !8
|
|
mov____0x8(%ebp),%ecx !12
|
|
mov____$i32,%eax SYS_access
|
|
int____$0x80
|
|
leave
|
|
ret
|
|
|
|
|
|
:brk
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%ebx !8
|
|
mov____$i32,%eax SYS_brk
|
|
int____$0x80
|
|
leave
|
|
ret
|
|
|
|
|
|
:fsync
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%ebx !8
|
|
mov____$i32,%eax SYS_fsync
|
|
int____$0x80
|
|
leave
|
|
ret
|
|
|
|
|
|
:strlen
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# int i = 0;
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# while (s[i]) ...
|
|
jmp32 %strlen_4_continue
|
|
:strlen_4_loop
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
:strlen_4_continue
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
mov____0x8(%ebp),%edx !0x8
|
|
add____%edx,%eax
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %strlen_4_break
|
|
jmp32 %strlen_4_loop
|
|
:strlen_4_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
leave
|
|
ret
|
|
|
|
|
|
:eputc
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____$i32,%eax %0x2
|
|
push___%eax
|
|
push___0x8(%ebp) !0x8
|
|
call32 %fputc
|
|
add____$i8,%esp !0x8
|
|
leave
|
|
ret
|
|
|
|
|
|
:eputs
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# int i = strlen(s);
|
|
push___0x8(%ebp) !0x8
|
|
call32 %strlen
|
|
add____$i8,%esp !0x4
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# write(2, s, i);
|
|
push___0x8(%ebp) !0x-4
|
|
push___0x8(%ebp) !0x8
|
|
mov____$i32,%eax %0x2
|
|
push___%eax
|
|
call32 %write
|
|
add____$i8,%esp !0xc
|
|
test___%eax,%eax
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
|
|
|
|
:fputs
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# int i = strlen(s);
|
|
push___0x8(%ebp) !0x8
|
|
call32 %strlen
|
|
add____$i8,%esp !0x4
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# write(fd, s, i);
|
|
push___0x8(%ebp) !0x-4
|
|
push___0x8(%ebp) !0x8
|
|
push___0x8(%ebp) !0xc
|
|
call32 %write
|
|
add____$i8,%esp !0xc
|
|
test___%eax,%eax
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
|
|
|
|
:puts
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# int i = strlen(s);
|
|
push___0x8(%ebp) !0x8
|
|
call32 %strlen
|
|
add____$i8,%esp !0x4
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# write(1, s, i);
|
|
push___0x8(%ebp) !0x-4
|
|
push___0x8(%ebp) !0x8
|
|
mov____$i32,%eax %0x1
|
|
push___%eax
|
|
call32 %write
|
|
add____$i8,%esp !0xc
|
|
test___%eax,%eax
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
|
|
|
|
:putchar
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# write(1, (char*)&c, 1);
|
|
mov____$i32,%eax %0x1
|
|
push___%eax
|
|
lea____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
push___%eax
|
|
call32 %write
|
|
add____$i8,%esp !0xc
|
|
test___%eax,%eax
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
|
|
|
|
:fputc
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# write(fd, (char*)&c, 1);
|
|
mov____$i32,%eax %0x1
|
|
push___%eax
|
|
lea____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
push___0x8(%ebp) !0xc
|
|
call32 %write
|
|
add____$i8,%esp !0xc
|
|
test___%eax,%eax
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
|
|
|
|
:assert_fail
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# eputs("assert fail: ");
|
|
push___$i32 &string__env_0
|
|
call32 %eputs
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
# eputs(s);
|
|
push___0x8(%ebp) !0x8
|
|
call32 %eputs
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
# eputs("\n");
|
|
push___$i32 &string__env_1
|
|
call32 %eputs
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
# char *fail = s;
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# fail = 0
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
test___%eax,%eax
|
|
# *fail = 0
|
|
mov____$i32,%eax %0x0
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
test___%eax,%eax
|
|
leave
|
|
ret
|
|
|
|
|
|
:getchar
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char c;
|
|
# int i;
|
|
# if (ungetc_char == -1) ...else ...
|
|
mov____0x32,%eax &ungetc_char
|
|
push___%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %getchar_3_else
|
|
# int r = read(g_stdin, &c, 1);
|
|
mov____$i32,%eax %0x1
|
|
push___%eax
|
|
lea____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____0x32,%eax &g_stdin
|
|
push___%eax
|
|
call32 %read
|
|
add____$i8,%esp !0xc
|
|
mov____%eax,0x8(%ebp) !0x-c
|
|
# if (r < 1) ...
|
|
mov____0x8(%ebp),%eax !0x-c
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setl___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jge32 %getchar_22_break
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
leave
|
|
ret
|
|
jmp32 %getchar_22_break
|
|
:getchar_22_break
|
|
# i = c
|
|
movzbl_0x8(%ebp),%eax !0x-4
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
test___%eax,%eax
|
|
jmp32 %getchar_3_break
|
|
:getchar_3_else
|
|
# i = ungetc_buf[ungetc_char]
|
|
mov____0x32,%eax &ungetc_char
|
|
mov____%eax,%edx
|
|
mov____$i32,%edx &ungetc_buf
|
|
add____%edx,%eax
|
|
movzbl_(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
test___%eax,%eax
|
|
# ungetc_char = ungetc_char - 1
|
|
mov____0x32,%eax &ungetc_char
|
|
add____$i8,%eax !0x-1
|
|
mov____%eax,0x32 &ungetc_char
|
|
test___%eax,%eax
|
|
:getchar_3_break
|
|
# if (i < 0) ...
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
push___%eax
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setl___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jge32 %getchar_58_break
|
|
# i += 256
|
|
mov____$i32,%eax %0x100
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
pop____%edx
|
|
add____%edx,%eax
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
test___%eax,%eax
|
|
jmp32 %getchar_58_break
|
|
:getchar_58_break
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
leave
|
|
ret
|
|
|
|
|
|
:fgetc
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char c;
|
|
# int r = read(fd, &c, 1);
|
|
mov____$i32,%eax %0x1
|
|
push___%eax
|
|
lea____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
push___0x8(%ebp) !0x8
|
|
call32 %read
|
|
add____$i8,%esp !0xc
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# c == 1? ...: ...
|
|
movzbl_0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %fgetc_9_else
|
|
movzbl_0x8(%ebp),%eax !0x-4
|
|
test___%eax,%eax
|
|
jmp32 %fgetc_9_break
|
|
:fgetc_9_else
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
test___%eax,%eax
|
|
:fgetc_9_break
|
|
leave
|
|
ret
|
|
|
|
|
|
:free
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
leave
|
|
ret
|
|
|
|
|
|
:ungetc
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x32,%eax &ungetc_char
|
|
push___%eax
|
|
mov____$i32,%eax &ungetc_char
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
# ungetc_buf[ungetc_char] = c
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____0x32,%eax &ungetc_char
|
|
mov____%eax,%edx
|
|
mov____$i32,%edx &ungetc_buf
|
|
add____%edx,%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
leave
|
|
ret
|
|
|
|
|
|
:strcmp
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# while (*a && *b && *a == *b) ...
|
|
jmp32 %strcmp_1_continue
|
|
:strcmp_1_loop
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x8
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0xc
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
:strcmp_1_continue
|
|
mov____0x8(%ebp),%eax !0x8
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %strcmp_1_break
|
|
mov____0x8(%ebp),%eax !0xc
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %strcmp_1_break
|
|
mov____0x8(%ebp),%eax !0x8
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0xc
|
|
movzbl_(%eax),%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %strcmp_1_break
|
|
jmp32 %strcmp_1_loop
|
|
:strcmp_1_break
|
|
mov____0x8(%ebp),%eax !0x8
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0xc
|
|
movzbl_(%eax),%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
leave
|
|
ret
|
|
|
|
|
|
:strcpy
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char *p = dest;
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# while (*src) ...
|
|
jmp32 %strcpy_4_continue
|
|
:strcpy_4_loop
|
|
# *p = *src++
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0xc
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x-4 !0x1
|
|
test___%eax,%eax
|
|
:strcpy_4_continue
|
|
mov____0x8(%ebp),%eax !0xc
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %strcpy_4_break
|
|
jmp32 %strcpy_4_loop
|
|
:strcpy_4_break
|
|
# *p = 0
|
|
mov____$i32,%eax %0x0
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
leave
|
|
ret
|
|
|
|
|
|
:itoa
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char *p = itoa_buf;
|
|
mov____$i32,%eax &itoa_buf
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# p += 9
|
|
mov____$i32,%eax %0x9
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
pop____%edx
|
|
add____%edx,%eax
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
test___%eax,%eax
|
|
# *p = 0
|
|
mov____$i32,%eax %0x0
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x-4 !0x-1
|
|
test___%eax,%eax
|
|
# int sign = 0;
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# if (x < 0) ...
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setl___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jge32 %itoa_23_break
|
|
# sign = 1
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
test___%eax,%eax
|
|
jmp32 %itoa_23_break
|
|
:itoa_23_break
|
|
# if (sign) ...
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %itoa_37_break
|
|
# x = -x
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
mov____%eax,0x8(%ebp) !0x8
|
|
test___%eax,%eax
|
|
jmp32 %itoa_37_break
|
|
:itoa_37_break
|
|
# do xwhile (...);
|
|
:itoa_53_loop
|
|
# *p = '0' + x%10
|
|
mov____$i32,%eax %0x30
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0xa
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%edx,%ebx
|
|
xor____%edx,%edx
|
|
idiv___%ebx
|
|
mov____%edx,%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x-4 !0x-1
|
|
test___%eax,%eax
|
|
# x = x/10
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0xa
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%edx,%ebx
|
|
xor____%edx,%edx
|
|
idiv___%ebx
|
|
mov____%eax,0x8(%ebp) !0x8
|
|
test___%eax,%eax
|
|
:itoa_53_continue
|
|
mov____0x8(%ebp),%eax !0x8
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %itoa_53_break
|
|
jmp32 %itoa_53_loop
|
|
:itoa_53_break
|
|
# if (sign && *(p + 1) != '0') ...
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %itoa_87_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
add____$i8,%eax !0x1
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x30
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
push___%eax
|
|
sub____%edx,%eax
|
|
setne__%al
|
|
movzbl_%al,%eax
|
|
xchg___%eax,(%esp)
|
|
sub____%edx,%eax
|
|
lahf
|
|
xor____$i8,%ah !0x40
|
|
sahf
|
|
pop____%eax
|
|
# jmp test LABEL
|
|
jne32 %itoa_87_break
|
|
# *p = '-'
|
|
mov____$i32,%eax %0x2d
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x-4 !0x-1
|
|
test___%eax,%eax
|
|
jmp32 %itoa_87_break
|
|
:itoa_87_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
add____$i8,%eax !0x1
|
|
leave
|
|
ret
|
|
|
|
|
|
:isdigit
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x30
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setge__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
je32 %isdigit_6_and_skip_b
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x39
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setle__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
:isdigit_6_and_skip_b
|
|
leave
|
|
ret
|
|
|
|
|
|
:isxdigit
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
push___0x8(%ebp) !0x8
|
|
call32 %isdigit
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jne32 %isxdigit_3_or_skip_b
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x61
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setge__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
je32 %isxdigit_11_and_skip_b
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x66
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setle__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
:isxdigit_11_and_skip_b
|
|
test___%eax,%eax
|
|
:isxdigit_3_or_skip_b
|
|
leave
|
|
ret
|
|
|
|
|
|
:isnumber
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# if (base == 2) ...
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____$i32,%eax %0x2
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %isnumber_1_break
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x30
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setge__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
je32 %isnumber_14_and_skip_b
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x31
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setle__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
:isnumber_14_and_skip_b
|
|
leave
|
|
ret
|
|
jmp32 %isnumber_1_break
|
|
:isnumber_1_break
|
|
# if (base == 8) ...
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____$i32,%eax %0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %isnumber_27_break
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x30
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setge__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
je32 %isnumber_40_and_skip_b
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____$i32,%eax %0x37
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setle__%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
:isnumber_40_and_skip_b
|
|
leave
|
|
ret
|
|
jmp32 %isnumber_27_break
|
|
:isnumber_27_break
|
|
# if (base == 10) ...
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____$i32,%eax %0xa
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %isnumber_53_break
|
|
push___0x8(%ebp) !0x8
|
|
call32 %isdigit
|
|
add____$i8,%esp !0x4
|
|
leave
|
|
ret
|
|
jmp32 %isnumber_53_break
|
|
:isnumber_53_break
|
|
# if (base == 16) ...
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____$i32,%eax %0x10
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %isnumber_66_break
|
|
push___0x8(%ebp) !0x8
|
|
call32 %isxdigit
|
|
add____$i8,%esp !0x4
|
|
leave
|
|
ret
|
|
jmp32 %isnumber_66_break
|
|
:isnumber_66_break
|
|
leave
|
|
ret
|
|
|
|
|
|
:_atoi
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char *s = *p;
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# int i = 0;
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# int sign = 1;
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,0x8(%ebp) !0x-c
|
|
# if (!base) ...
|
|
mov____0x8(%ebp),%eax !0xc
|
|
test___%eax,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
je32 %_atoi_11_break
|
|
# base = 10
|
|
mov____$i32,%eax %0xa
|
|
mov____%eax,0x8(%ebp) !0xc
|
|
test___%eax,%eax
|
|
jmp32 %_atoi_11_break
|
|
:_atoi_11_break
|
|
# if (*s && *s == '-') ...
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %_atoi_24_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x2d
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %_atoi_24_break
|
|
# sign = -1
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
mov____%eax,0x8(%ebp) !0x-c
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
jmp32 %_atoi_24_break
|
|
:_atoi_24_break
|
|
# while (isnumber(*s, base)) ...
|
|
jmp32 %_atoi_55_continue
|
|
:_atoi_55_loop
|
|
# i *= base
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
pop____%edx
|
|
mul____%edx
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
test___%eax,%eax
|
|
# int m = *s > '9'? 'a' - 10: '0';
|
|
# *s > '9'? ...: ...
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x39
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
setg___%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
jle32 %_atoi_67_else
|
|
mov____$i32,%eax %0x61
|
|
add____$i8,%eax !0x-a
|
|
test___%eax,%eax
|
|
jmp32 %_atoi_67_break
|
|
:_atoi_67_else
|
|
mov____$i32,%eax %0x30
|
|
test___%eax,%eax
|
|
:_atoi_67_break
|
|
mov____%eax,0x8(%ebp) !0x-10
|
|
# i += *s - m
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-10
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
pop____%edx
|
|
add____%edx,%eax
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
:_atoi_55_continue
|
|
push___0x8(%ebp) !0xc
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
call32 %isnumber
|
|
add____$i8,%esp !0x8
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %_atoi_55_break
|
|
jmp32 %_atoi_55_loop
|
|
:_atoi_55_break
|
|
# *p = s
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%eax,(%edx)
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-c
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mul____%edx
|
|
leave
|
|
ret
|
|
|
|
|
|
:atoi
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char *p = s;
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
mov____$i32,%eax %0x0
|
|
push___%eax
|
|
lea____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
call32 %_atoi
|
|
add____$i8,%esp !0x8
|
|
leave
|
|
ret
|
|
|
|
|
|
:malloc
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# if (!g_brk) ...
|
|
mov____0x32,%eax &g_brk
|
|
test___%eax,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
je32 %malloc_1_break
|
|
# g_brk = brk(0)
|
|
mov____$i32,%eax %0x0
|
|
push___%eax
|
|
call32 %brk
|
|
add____$i8,%esp !0x4
|
|
mov____%eax,0x32 &g_brk
|
|
test___%eax,%eax
|
|
jmp32 %malloc_1_break
|
|
:malloc_1_break
|
|
# if (brk(g_brk + size) == -1) ...
|
|
mov____0x32,%eax &g_brk
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
push___%eax
|
|
call32 %brk
|
|
add____$i8,%esp !0x4
|
|
push___%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %malloc_16_break
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
jmp32 %malloc_16_break
|
|
:malloc_16_break
|
|
# char *p = g_brk;
|
|
mov____0x32,%eax &g_brk
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# g_brk += size
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____0x32,%eax &g_brk
|
|
pop____%edx
|
|
add____%edx,%eax
|
|
mov____%eax,0x32 &g_brk
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
leave
|
|
ret
|
|
|
|
|
|
:memcpy
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char *p = dest;
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# char *q = src;
|
|
mov____0x8(%ebp),%eax !0xc
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# while (n--) ...
|
|
jmp32 %memcpy_7_continue
|
|
:memcpy_7_loop
|
|
# *p = *q++
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-8
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x-4 !0x1
|
|
test___%eax,%eax
|
|
:memcpy_7_continue
|
|
mov____0x8(%ebp),%eax !0x10
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x10
|
|
add____$i8,(%eax) !0x-1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %memcpy_7_break
|
|
jmp32 %memcpy_7_loop
|
|
:memcpy_7_break
|
|
mov____0x8(%ebp),%eax !0x8
|
|
leave
|
|
ret
|
|
|
|
|
|
:realloc
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# void *new = malloc(size);
|
|
push___0x8(%ebp) !0xc
|
|
call32 %malloc
|
|
add____$i8,%esp !0x4
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# if (ptr && new) ...
|
|
mov____0x8(%ebp),%eax !0x8
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %realloc_5_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %realloc_5_break
|
|
# memcpy(new, ptr, size);
|
|
push___0x8(%ebp) !0xc
|
|
push___0x8(%ebp) !0x8
|
|
push___0x8(%ebp) !0x-4
|
|
call32 %memcpy
|
|
add____$i8,%esp !0xc
|
|
test___%eax,%eax
|
|
# free(ptr);
|
|
push___0x8(%ebp) !0x8
|
|
call32 %free
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jmp32 %realloc_5_break
|
|
:realloc_5_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
leave
|
|
ret
|
|
|
|
|
|
:strncmp
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# while (*a && *b && *a == *b && --length) ...
|
|
jmp32 %strncmp_1_continue
|
|
:strncmp_1_loop
|
|
mov____0x8(%ebp),%eax !0x8
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x8
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0xc
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0xc
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
:strncmp_1_continue
|
|
mov____0x8(%ebp),%eax !0x8
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %strncmp_1_break
|
|
mov____0x8(%ebp),%eax !0xc
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %strncmp_1_break
|
|
mov____0x8(%ebp),%eax !0x8
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0xc
|
|
movzbl_(%eax),%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %strncmp_1_break
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x10
|
|
add____$i8,(%eax) !0x-1
|
|
mov____0x8(%ebp),%eax !0x10
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %strncmp_1_break
|
|
jmp32 %strncmp_1_loop
|
|
:strncmp_1_break
|
|
mov____0x8(%ebp),%eax !0x8
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0xc
|
|
movzbl_(%eax),%eax
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
leave
|
|
ret
|
|
|
|
|
|
:getenv
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char **p = g_environment;
|
|
mov____0x32,%eax &g_environment
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# int length = strlen(s);
|
|
push___0x8(%ebp) !0x8
|
|
call32 %strlen
|
|
add____$i8,%esp !0x4
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# while (*p) ...
|
|
jmp32 %getenv_8_continue
|
|
:getenv_8_loop
|
|
# if (!strncmp(s, *p, length) && *(*p + length) == '=') ...
|
|
push___0x8(%ebp) !0x-8
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____(%eax),%eax
|
|
push___%eax
|
|
push___0x8(%ebp) !0x8
|
|
call32 %strncmp
|
|
add____$i8,%esp !0xc
|
|
test___%eax,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
je32 %getenv_11_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x3d
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
sub____%edx,%eax
|
|
sete___%al
|
|
movzbl_%al,%eax
|
|
# jmp test LABEL
|
|
jne32 %getenv_11_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
add____$i8,%eax !0x1
|
|
leave
|
|
ret
|
|
jmp32 %getenv_11_break
|
|
:getenv_11_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x4
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
:getenv_8_continue
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
mov____(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
je32 %getenv_8_break
|
|
jmp32 %getenv_8_loop
|
|
:getenv_8_break
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
|
|
|
|
:vprintf
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char *p = format;
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# while (*p) ...
|
|
jmp32 %vprintf_4_continue
|
|
:vprintf_4_loop
|
|
# if (*p != '%') ...else ...
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x25
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
push___%eax
|
|
sub____%edx,%eax
|
|
setne__%al
|
|
movzbl_%al,%eax
|
|
xchg___%eax,(%esp)
|
|
sub____%edx,%eax
|
|
lahf
|
|
xor____$i8,%ah !0x40
|
|
sahf
|
|
pop____%eax
|
|
# jmp test LABEL
|
|
jne32 %vprintf_7_else
|
|
# putchar(*p++);
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
call32 %putchar
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jmp32 %vprintf_7_break
|
|
:vprintf_7_else
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
# char c = *p;
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# switch (c) { ...}
|
|
movzbl_0x8(%ebp),%eax !0x-8
|
|
:vprintf_38_clause0
|
|
cmp____$i8,%eax !0x25
|
|
je32 %vprintf_38_body0
|
|
jmp32 %vprintf_38_clause1
|
|
:vprintf_38_body0
|
|
# putchar(*p);
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
call32 %putchar
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jmp32 %vprintf_38_break
|
|
jmp32 %vprintf_38_body1
|
|
:vprintf_38_clause1
|
|
cmp____$i8,%eax !0x63
|
|
je32 %vprintf_38_body1
|
|
jmp32 %vprintf_38_clause2
|
|
:vprintf_38_body1
|
|
# char c;
|
|
# c = (char)(int*)(ap = ap + 4)[-1]
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
shl____$i8,%eax !0x2
|
|
push___%eax
|
|
# ap = ap + 4
|
|
mov____0x8(%ebp),%eax !0xc
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0xc
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
mov____(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-c
|
|
test___%eax,%eax
|
|
# putchar(c);
|
|
push___0x8(%ebp) !0x-c
|
|
call32 %putchar
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jmp32 %vprintf_38_break
|
|
jmp32 %vprintf_38_body2
|
|
:vprintf_38_clause2
|
|
cmp____$i8,%eax !0x64
|
|
je32 %vprintf_38_body2
|
|
jmp32 %vprintf_38_clause3
|
|
:vprintf_38_body2
|
|
# int d;
|
|
# d = (int)(int*)(ap = ap + 4)[-1]
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
shl____$i8,%eax !0x2
|
|
push___%eax
|
|
# ap = ap + 4
|
|
mov____0x8(%ebp),%eax !0xc
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0xc
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
mov____(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-10
|
|
test___%eax,%eax
|
|
# puts(itoa(d));
|
|
push___0x8(%ebp) !0x-10
|
|
call32 %itoa
|
|
add____$i8,%esp !0x4
|
|
push___%eax
|
|
call32 %puts
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jmp32 %vprintf_38_break
|
|
jmp32 %vprintf_38_body3
|
|
:vprintf_38_clause3
|
|
cmp____$i8,%eax !0x73
|
|
je32 %vprintf_38_body3
|
|
jmp32 %vprintf_38_clause4
|
|
:vprintf_38_body3
|
|
# char *s;
|
|
# s = (char*)(int*)(ap = ap + 4)[-1]
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
shl____$i8,%eax !0x2
|
|
push___%eax
|
|
# ap = ap + 4
|
|
mov____0x8(%ebp),%eax !0xc
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0xc
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
mov____(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-14
|
|
test___%eax,%eax
|
|
# puts(s);
|
|
push___0x8(%ebp) !0x-14
|
|
call32 %puts
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jmp32 %vprintf_38_break
|
|
jmp32 %vprintf_38_body4
|
|
:vprintf_38_clause4
|
|
:vprintf_38_body4
|
|
# putchar(*p);
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
call32 %putchar
|
|
add____$i8,%esp !0x4
|
|
test___%eax,%eax
|
|
jmp32 %vprintf_38_break
|
|
:vprintf_38_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
:vprintf_7_break
|
|
:vprintf_4_continue
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %vprintf_4_break
|
|
jmp32 %vprintf_4_loop
|
|
:vprintf_4_break
|
|
# ap = 0
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0xc
|
|
test___%eax,%eax
|
|
mov____$i32,%eax %0x0
|
|
leave
|
|
ret
|
|
|
|
|
|
:printf
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# va_list ap;
|
|
# ap = (char*)(&format + 1)
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x8
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
test___%eax,%eax
|
|
# int r = vprintf(format, ap);
|
|
push___0x8(%ebp) !0x-4
|
|
push___0x8(%ebp) !0x8
|
|
call32 %vprintf
|
|
add____$i8,%esp !0x8
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# ap = 0
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
leave
|
|
ret
|
|
|
|
|
|
:vsprintf
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# char *p = format;
|
|
mov____0x8(%ebp),%eax !0xc
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
# while (*p) ...
|
|
jmp32 %vsprintf_4_continue
|
|
:vsprintf_4_loop
|
|
# if (*p != '%') ...else ...
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____$i32,%eax %0x25
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
push___%eax
|
|
sub____%edx,%eax
|
|
setne__%al
|
|
movzbl_%al,%eax
|
|
xchg___%eax,(%esp)
|
|
sub____%edx,%eax
|
|
lahf
|
|
xor____$i8,%ah !0x40
|
|
sahf
|
|
pop____%eax
|
|
# jmp test LABEL
|
|
jne32 %vsprintf_7_else
|
|
# *str = *p++
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x8 !0x1
|
|
test___%eax,%eax
|
|
jmp32 %vsprintf_7_break
|
|
:vsprintf_7_else
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
# char c = *p;
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# switch (c) { ...}
|
|
movzbl_0x8(%ebp),%eax !0x-8
|
|
:vsprintf_41_clause0
|
|
cmp____$i8,%eax !0x25
|
|
je32 %vsprintf_41_body0
|
|
jmp32 %vsprintf_41_clause1
|
|
:vsprintf_41_body0
|
|
# *str = *p
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x8 !0x1
|
|
test___%eax,%eax
|
|
jmp32 %vsprintf_41_break
|
|
jmp32 %vsprintf_41_body1
|
|
:vsprintf_41_clause1
|
|
cmp____$i8,%eax !0x63
|
|
je32 %vsprintf_41_body1
|
|
jmp32 %vsprintf_41_clause2
|
|
:vsprintf_41_body1
|
|
# char c;
|
|
# c = (char)(int*)(ap = ap + 4)[-1]
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
shl____$i8,%eax !0x2
|
|
push___%eax
|
|
# ap = ap + 4
|
|
mov____0x8(%ebp),%eax !0x10
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0x10
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
mov____(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-c
|
|
test___%eax,%eax
|
|
# *str = c
|
|
movzbl_0x8(%ebp),%eax !0x-c
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x8 !0x1
|
|
test___%eax,%eax
|
|
jmp32 %vsprintf_41_break
|
|
jmp32 %vsprintf_41_body2
|
|
:vsprintf_41_clause2
|
|
cmp____$i8,%eax !0x64
|
|
je32 %vsprintf_41_body2
|
|
jmp32 %vsprintf_41_clause3
|
|
:vsprintf_41_body2
|
|
# int d;
|
|
# d = (int)(int*)(ap = ap + 4)[-1]
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
shl____$i8,%eax !0x2
|
|
push___%eax
|
|
# ap = ap + 4
|
|
mov____0x8(%ebp),%eax !0x10
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0x10
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
mov____(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-10
|
|
test___%eax,%eax
|
|
# char *s;
|
|
# s = itoa(d)
|
|
push___0x8(%ebp) !0x-10
|
|
call32 %itoa
|
|
add____$i8,%esp !0x4
|
|
mov____%eax,0x8(%ebp) !0x-14
|
|
test___%eax,%eax
|
|
# while (*s) ...
|
|
jmp32 %vsprintf_121_continue
|
|
:vsprintf_121_loop
|
|
# *str = *s++
|
|
mov____0x8(%ebp),%eax !0x-14
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-14
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x8 !0x1
|
|
test___%eax,%eax
|
|
:vsprintf_121_continue
|
|
mov____0x8(%ebp),%eax !0x-14
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %vsprintf_121_break
|
|
jmp32 %vsprintf_121_loop
|
|
:vsprintf_121_break
|
|
jmp32 %vsprintf_41_break
|
|
jmp32 %vsprintf_41_body3
|
|
:vsprintf_41_clause3
|
|
cmp____$i8,%eax !0x73
|
|
je32 %vsprintf_41_body3
|
|
jmp32 %vsprintf_41_clause4
|
|
:vsprintf_41_body3
|
|
# char *s;
|
|
# s = (char*)(int*)(ap = ap + 4)[-1]
|
|
push___%eax
|
|
mov____$i32,%eax %0x1
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____$i32,%eax %0x0
|
|
sub____%edx,%eax
|
|
shl____$i8,%eax !0x2
|
|
push___%eax
|
|
# ap = ap + 4
|
|
mov____0x8(%ebp),%eax !0x10
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0x10
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
add____%edx,%eax
|
|
mov____(%eax),%eax
|
|
mov____%eax,0x8(%ebp) !0x-18
|
|
test___%eax,%eax
|
|
# while (*s) ...
|
|
jmp32 %vsprintf_171_continue
|
|
:vsprintf_171_loop
|
|
# *str = *s++
|
|
mov____0x8(%ebp),%eax !0x-18
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-18
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x8 !0x1
|
|
test___%eax,%eax
|
|
:vsprintf_171_continue
|
|
mov____0x8(%ebp),%eax !0x-18
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %vsprintf_171_break
|
|
jmp32 %vsprintf_171_loop
|
|
:vsprintf_171_break
|
|
jmp32 %vsprintf_41_break
|
|
jmp32 %vsprintf_41_body4
|
|
:vsprintf_41_clause4
|
|
:vsprintf_41_body4
|
|
# *str = *p
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
add____$i8,0x8(%ebp) !0x8 !0x1
|
|
test___%eax,%eax
|
|
jmp32 %vsprintf_41_break
|
|
:vsprintf_41_break
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
push___%eax
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0x-4
|
|
add____$i8,(%eax) !0x1
|
|
pop____%eax
|
|
test___%eax,%eax
|
|
:vsprintf_7_break
|
|
:vsprintf_4_continue
|
|
mov____0x8(%ebp),%eax !0x-4
|
|
movzbl_(%eax),%eax
|
|
test___%eax,%eax
|
|
# jmp test LABEL
|
|
test___%eax,%eax
|
|
test___%al,%al
|
|
je32 %vsprintf_4_break
|
|
jmp32 %vsprintf_4_loop
|
|
:vsprintf_4_break
|
|
# ap = 0
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0x10
|
|
test___%eax,%eax
|
|
# *str = 0
|
|
mov____$i32,%eax %0x0
|
|
push___%eax
|
|
mov____0x8(%ebp),%eax !0x8
|
|
mov____%eax,%edx
|
|
pop____%eax
|
|
mov____%al,(%edx)
|
|
test___%eax,%eax
|
|
push___0x8(%ebp) !0x8
|
|
call32 %strlen
|
|
add____$i8,%esp !0x4
|
|
leave
|
|
ret
|
|
|
|
|
|
:sprintf
|
|
push___%ebp
|
|
mov____%esp,%ebp
|
|
sub____%esp,$i32 %0x1054
|
|
# va_list ap;
|
|
# ap = (char*)(&format + 1)
|
|
mov____%ebp,%eax
|
|
add____$i8,%eax !0xc
|
|
add____$i8,%eax !0x4
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
test___%eax,%eax
|
|
# int r = vsprintf(str, format, ap);
|
|
push___0x8(%ebp) !0x-4
|
|
push___0x8(%ebp) !0xc
|
|
push___0x8(%ebp) !0x8
|
|
call32 %vsprintf
|
|
add____$i8,%esp !0xc
|
|
mov____%eax,0x8(%ebp) !0x-8
|
|
# ap = 0
|
|
mov____$i32,%eax %0x0
|
|
mov____%eax,0x8(%ebp) !0x-4
|
|
test___%eax,%eax
|
|
mov____0x8(%ebp),%eax !0x-8
|
|
leave
|
|
ret
|
|
|
|
:g_environment
|
|
!0x00 !0x00 !0x00 !0x00
|
|
|
|
:g_stdin
|
|
!0x00 !0x00 !0x00 !0x00
|
|
|
|
:string__env_0
|
|
"assert fail: "
|
|
|
|
:string__env_1
|
|
"
|
|
"
|
|
|
|
:ungetc_char
|
|
!0x-1 !0x-1 !0x-1 !0x-1
|
|
|
|
:ungetc_buf
|
|
!0x00 !0x00
|
|
|
|
:itoa_buf
|
|
!0x00 !0x00 !0x00 !0x00 !0x00 !0x00 !0x00 !0x00 !0x00 !0x00
|
|
|
|
:g_brk
|
|
!0x00 !0x00 !0x00 !0x00
|