-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactorial_debian.lst
98 lines (98 loc) · 3.33 KB
/
factorial_debian.lst
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
1 .file "factorial.c"
2 .text
3 .Ltext0:
4 .file 0 "/code" "factorial.c"
5 .section .rodata
6 .LC0:
7 0000 48656C6C .string "Hello from Factorial!"
7 6F206672
7 6F6D2046
7 6163746F
7 7269616C
8 .LC1:
9 0016 25642066 .string "%d factorial is %d\n"
9 6163746F
9 7269616C
9 20697320
9 25640A00
10 .text
11 .globl main
13 main:
14 .LFB0:
15 .file 1 "factorial.c"
1:factorial.c **** #include <stdio.h>
2:factorial.c ****
3:factorial.c **** int main() {
16 .loc 1 3 12
17 .cfi_startproc
18 0000 55 pushq %rbp
19 .cfi_def_cfa_offset 16
20 .cfi_offset 6, -16
21 0001 4889E5 movq %rsp, %rbp
22 .cfi_def_cfa_register 6
23 0004 4883EC10 subq $16, %rsp
4:factorial.c **** printf("Hello from Factorial!\n");
24 .loc 1 4 5
25 0008 BF000000 movl $.LC0, %edi
25 00
26 000d E8000000 call puts
26 00
5:factorial.c **** int number = 10;
27 .loc 1 5 9
28 0012 C745F40A movl $10, -12(%rbp)
28 000000
6:factorial.c **** int total = 1;
29 .loc 1 6 9
30 0019 C745FC01 movl $1, -4(%rbp)
30 000000
31 .LBB2:
7:factorial.c **** for (int i=0; i < number; i++) {
32 .loc 1 7 14
33 0020 C745F800 movl $0, -8(%rbp)
33 000000
34 .loc 1 7 5
35 0027 EB13 jmp .L2
36 .L3:
8:factorial.c **** total = total * (i + 1);
37 .loc 1 8 28
38 0029 8B45F8 movl -8(%rbp), %eax
39 002c 8D5001 leal 1(%rax), %edx
40 .loc 1 8 15
41 002f 8B45FC movl -4(%rbp), %eax
42 0032 0FAFC2 imull %edx, %eax
43 0035 8945FC movl %eax, -4(%rbp)
7:factorial.c **** for (int i=0; i < number; i++) {
44 .loc 1 7 32 discriminator 3
45 0038 8345F801 addl $1, -8(%rbp)
46 .L2:
7:factorial.c **** for (int i=0; i < number; i++) {
47 .loc 1 7 21 discriminator 1
48 003c 8B45F8 movl -8(%rbp), %eax
49 003f 3B45F4 cmpl -12(%rbp), %eax
50 0042 7CE5 jl .L3
51 .LBE2:
9:factorial.c **** }
10:factorial.c **** printf("%d factorial is %d\n",number,total);
52 .loc 1 10 5
53 0044 8B55FC movl -4(%rbp), %edx
54 0047 8B45F4 movl -12(%rbp), %eax
55 004a 89C6 movl %eax, %esi
56 004c BF000000 movl $.LC1, %edi
56 00
57 0051 B8000000 movl $0, %eax
57 00
58 0056 E8000000 call printf
58 00
11:factorial.c **** return 0;
59 .loc 1 11 12
60 005b B8000000 movl $0, %eax
60 00
12:factorial.c **** }
61 .loc 1 12 1
62 0060 C9 leave
63 .cfi_def_cfa 7, 8
64 0061 C3 ret
65 .cfi_endproc
66 .LFE0:
68 .Letext0:
69 .file 2 "/usr/include/stdio.h"