forked from rohithasrk/mips-csn-221
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.s
55 lines (55 loc) · 917 Bytes
/
code.s
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
.file "code.c"
.section .rodata
.LC0:
.string "Enter a number: "
.LC1:
.string "%u"
.align 8
.LC2:
.string "The number of bits set are: %u \n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl $.LC0, %edi
movl $0, %eax
call printf
leaq -8(%rbp), %rax
movq %rax, %rsi
movl $.LC1, %edi
movl $0, %eax
call __isoc99_scanf
movl $0, -4(%rbp)
jmp .L2
.L3:
movl -8(%rbp), %eax
andl $1, %eax
addl %eax, -4(%rbp)
movl -8(%rbp), %eax
shrl %eax
movl %eax, -8(%rbp)
.L2:
movl -8(%rbp), %eax
testl %eax, %eax
jne .L3
movl -4(%rbp), %eax
movl %eax, %esi
movl $.LC2, %edi
movl $0, %eax
call printf
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4"
.section .note.GNU-stack,"",@progbits