-
Notifications
You must be signed in to change notification settings - Fork 0
/
input2.txs
83 lines (59 loc) · 1.14 KB
/
input2.txs
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
# file header
.file "input2.txt"
.intel_syntax noprefix
# create io format strings
.section .rodata
.LC0: # reading
.string "%lld"
.LC1: # writing
.string "%lld\n"
.text
# main header
.globl main
.type main, @function
main:
push rbp
mov rbp, rsp
# set up stack frame
push 0
push rbp
sub rsp, 16
# end function header
# main code
# evaluate expression
mov r8, 2
# assignment
mov QWORD PTR [rbp-32], r8
# evaluate expression
mov r8, 1
# assignment
mov QWORD PTR [rbp-24], r8
# evaluate expression
mov r8, QWORD PTR [rbp-32]
imul r8, QWORD PTR [rbp-32]
add r8, QWORD PTR [rbp-24]
# assignment
mov QWORD PTR [rbp-32], r8
# evaluate expression
mov r8, QWORD PTR [rbp-32]
imul r8, 2
add r8, 1
# assignment
mov QWORD PTR [rbp-32], r8
# evaluate 'write' arguments
mov r8, QWORD PTR [rbp-32]
# call 'write' using fprintf
mov rdx, r8
mov rax, QWORD PTR stderr[rip]
mov esi, OFFSET FLAT:.LC1
mov rdi, rax
mov eax, 0
call fprintf
# main footer
mov eax, 0
leave
ret
.size main, .-main
# file footer
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits