You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1020 B
ArmAsm
65 lines
1020 B
ArmAsm
3 years ago
|
.file "idiv.c"
|
||
|
.intel_syntax noprefix
|
||
|
.text
|
||
|
.section .rodata
|
||
|
.LC0:
|
||
|
.string "%hd %hd"
|
||
|
.LC1:
|
||
|
.string "%hd\n"
|
||
|
.text
|
||
|
.globl main
|
||
|
.type main, @function
|
||
|
main:
|
||
|
.LFB0:
|
||
|
.cfi_startproc
|
||
|
push rbp
|
||
|
.cfi_def_cfa_offset 16
|
||
|
.cfi_offset 6, -16
|
||
|
mov rbp, rsp
|
||
|
.cfi_def_cfa_register 6
|
||
|
sub rsp, 16
|
||
|
mov rax, QWORD PTR fs:40
|
||
|
mov QWORD PTR -8[rbp], rax
|
||
|
xor eax, eax
|
||
|
lea rdx, -12[rbp]
|
||
|
lea rax, -14[rbp]
|
||
|
mov rsi, rax
|
||
|
lea rax, .LC0[rip]
|
||
|
mov rdi, rax
|
||
|
mov eax, 0
|
||
|
call __isoc99_scanf@PLT
|
||
|
movzx eax, WORD PTR -14[rbp]
|
||
|
movzx edx, WORD PTR -12[rbp]
|
||
|
#APP
|
||
|
# 6 "idiv.c" 1
|
||
|
mov ax,%ax
|
||
|
mov dx,%bx
|
||
|
cwd
|
||
|
idiv %bx
|
||
|
mov %ax, %dx
|
||
|
mov %dx, ax
|
||
|
|
||
|
# 0 "" 2
|
||
|
#NO_APP
|
||
|
mov WORD PTR -10[rbp], ax
|
||
|
movsx eax, WORD PTR -10[rbp]
|
||
|
mov esi, eax
|
||
|
lea rax, .LC1[rip]
|
||
|
mov rdi, rax
|
||
|
mov eax, 0
|
||
|
call printf@PLT
|
||
|
mov eax, 0
|
||
|
mov rdx, QWORD PTR -8[rbp]
|
||
|
sub rdx, QWORD PTR fs:40
|
||
|
je .L3
|
||
|
call __stack_chk_fail@PLT
|
||
|
.L3:
|
||
|
leave
|
||
|
.cfi_def_cfa 7, 8
|
||
|
ret
|
||
|
.cfi_endproc
|
||
|
.LFE0:
|
||
|
.size main, .-main
|
||
|
.ident "GCC: (GNU) 11.2.0"
|
||
|
.section .note.GNU-stack,"",@progbits
|