-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhello.s
More file actions
81 lines (80 loc) · 1.45 KB
/
hello.s
File metadata and controls
81 lines (80 loc) · 1.45 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
.section .rodata
.int_fmt:
.string "%d\n"
.str_fmt:
.string "%s\n"
.text
.globl main
main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
movq $42, %rax
movq %rax, -8(%rbp)
movq $10, %rax
movq %rax, -16(%rbp)
movq -8(%rbp), %rax
pushq %rax
movq -16(%rbp), %rax
movq %rax, %rcx
popq %rax
addq %rcx, %rax
movq %rax, -24(%rbp)
movq -24(%rbp), %rax
movq %rax, %rsi
leaq .int_fmt(%rip), %rdi
movq $0, %rax
call printf
movq -24(%rbp), %rax
pushq %rax
movq $50, %rax
movq %rax, %rcx
popq %rax
cmpq %rcx, %rax
setge %al
movzbq %al, %rax
cmpq $0, %rax
je .Lelse_1
movq $1, %rax
movq %rax, %rsi
leaq .int_fmt(%rip), %rdi
movq $0, %rax
call printf
jmp .Lendif_2
.Lelse_1:
movq $0, %rax
movq %rax, %rsi
leaq .int_fmt(%rip), %rdi
movq $0, %rax
call printf
.Lendif_2:
movq $0, %rax
movq %rax, -32(%rbp)
.Lwhile_3:
movq -32(%rbp), %rax
pushq %rax
movq $5, %rax
movq %rax, %rcx
popq %rax
cmpq %rcx, %rax
setl %al
movzbq %al, %rax
cmpq $0, %rax
je .Lendwhile_4
movq -32(%rbp), %rax
movq %rax, %rsi
leaq .int_fmt(%rip), %rdi
movq $0, %rax
call printf
movq -32(%rbp), %rax
pushq %rax
movq $1, %rax
movq %rax, %rcx
popq %rax
addq %rcx, %rax
movq %rax, -32(%rbp)
jmp .Lwhile_3
.Lendwhile_4:
movq $0, %rax
leave
ret