premierass_embleur.s
711 Bytes
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
.section .rodata
.LC0:
.string "%d\n"
.text
.globl multiplier
.type multiplier, @function
multiplier:
pushq %rbp
movq %rsp, %rbp
subq $48, %rsp
movq %rdi, -32(%rbp)
movq %rsi, -40(%rbp)
cmpq $0, -32(%rbp)
jne .L1
movq $0, %rax
jmp .L10
.L1:
cmpq $1, -32(%rbp)
jne .L2
movq -40(%rbp), %rax
jmp .L10
.L2:
movq -40(%rbp), %rax
subq $1, -32(%rbp)
.L7:
add -40(%rbp), %rax
subq $1, -32(%rbp)
cmpq $0, -32(%rbp)
jne .L7
.L10:
leave
ret
.globl main
.type main, @function
main:
pushq %rbp
movq %rsp, %rbp
subq $24, %rsp
movq $10, -16(%rbp)
movq $20, -24(%rbp)
movq -16(%rbp), %rdi
movq -24(%rbp), %rsi
call multiplier
movq %rax, -8(%rbp)
movq -8(%rbp),%rsi
movq $.LC0,%rdi
movq $0, %rax
call printf
leave
ret