forked from uva-cs/pdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_abs_c.s
91 lines (91 loc) · 1.58 KB
/
test_abs_c.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.file "test_abs_c.c"
.intel_syntax noprefix
.text
.globl absolute_value
.type absolute_value, @function
absolute_value:
.LFB0:
.cfi_startproc
push ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
mov ebp, esp
.cfi_def_cfa_register 5
cmp DWORD PTR [ebp+8], 0
jns .L2
neg DWORD PTR [ebp+8]
.L2:
mov eax, DWORD PTR [ebp+8]
pop ebp
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size absolute_value, .-absolute_value
.section .rodata
.LC0:
.string "Enter a value: "
.LC1:
.string "%d"
.LC2:
.string "The result is: %d\n"
.text
.globl main
.type main, @function
main:
.LFB1:
.cfi_startproc
lea ecx, [esp+4]
.cfi_def_cfa 1, 0
and esp, -16
push DWORD PTR [ecx-4]
push ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
mov ebp, esp
push ecx
.cfi_escape 0xf,0x3,0x75,0x7c,0x6
sub esp, 20
mov eax, DWORD PTR gs:20
mov DWORD PTR [ebp-12], eax
xor eax, eax
mov DWORD PTR [ebp-20], 0
sub esp, 12
push OFFSET FLAT:.LC0
call puts
add esp, 16
sub esp, 8
lea eax, [ebp-20]
push eax
push OFFSET FLAT:.LC1
call __isoc99_scanf
add esp, 16
mov eax, DWORD PTR [ebp-20]
sub esp, 12
push eax
call absolute_value
add esp, 16
mov DWORD PTR [ebp-16], eax
sub esp, 8
push DWORD PTR [ebp-16]
push OFFSET FLAT:.LC2
call printf
add esp, 16
mov eax, 0
mov edx, DWORD PTR [ebp-12]
xor edx, DWORD PTR gs:20
je .L6
call __stack_chk_fail
.L6:
mov ecx, DWORD PTR [ebp-4]
.cfi_def_cfa 1, 0
leave
.cfi_restore 5
lea esp, [ecx-4]
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE1:
.size main, .-main
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits