-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointer.s
More file actions
115 lines (115 loc) · 1.82 KB
/
pointer.s
File metadata and controls
115 lines (115 loc) · 1.82 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.file "pointer.c"
.text
.section .rodata
.LC0:
.string "Enter a character a or s: "
.LC1:
.string "Enter the three numbers: "
.LC2:
.string "%d %d %d"
.LC3:
.string "Average is %d\n"
.LC4:
.string "Sum is %d\n"
.text
.globl main
.type main, @function
main:
.LFB6:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $32, %rsp
movq %fs:40, %rax
movq %rax, -8(%rbp)
xorl %eax, %eax
leaq .LC0(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
call getchar@PLT
movb %al, -21(%rbp)
leaq .LC1(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
leaq -12(%rbp), %rcx
leaq -16(%rbp), %rdx
leaq -20(%rbp), %rax
movq %rax, %rsi
leaq .LC2(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call __isoc99_scanf@PLT
movsbl -21(%rbp), %eax
cmpl $97, %eax
je .L2
cmpl $115, %eax
je .L3
jmp .L4
.L2:
movl -20(%rbp), %edx
movl -16(%rbp), %eax
addl %eax, %edx
movl -12(%rbp), %eax
addl %edx, %eax
movslq %eax, %rdx
imulq $1431655766, %rdx, %rdx
movq %rdx, %rcx
shrq $32, %rcx
cltd
movl %ecx, %eax
subl %edx, %eax
movl %eax, %esi
leaq .LC3(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
jmp .L4
.L3:
movl -20(%rbp), %edx
movl -16(%rbp), %eax
addl %eax, %edx
movl -12(%rbp), %eax
addl %edx, %eax
movl %eax, %esi
leaq .LC4(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
nop
.L4:
movl $0, %eax
movq -8(%rbp), %rdx
subq %fs:40, %rdx
je .L6
call __stack_chk_fail@PLT
.L6:
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE6:
.size main, .-main
.ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: