nihonium
/
mipt_clang
Archived
1
0
Fork 0
master
nihonium 3 years ago
parent 70c3756257
commit 402d412e92
No known key found for this signature in database
GPG Key ID: 0924047F4136012C

@ -0,0 +1,32 @@
extern printf
extern scanf
global main
section .text
main:
push y
push x
push nya1
call scanf
add esp, 12
mov eax, [x]
;mov ebx, [y]
cdq
idiv dword [y]
push eax
push nya
call printf
add esp, 8
xor eax, eax
ret
section .data
nya db "%d", 10, 0
nya1 db "%d %d", 0
section .bss
x resd 1
y resd 1

@ -0,0 +1,32 @@
extern printf
extern scanf
global main
section .text
main:
push y
push x
push nya1
call scanf
add esp, 12
mov eax, [x]
;mov ebx, [y]
cdq
idiv dword [y]
push edx
push nya
call printf
add esp, 8
xor eax, eax
ret
section .data
nya db "%d", 10, 0
nya1 db "%d %d", 0
section .bss
x resd 1
y resd 1

@ -0,0 +1,44 @@
global main
extern scanf
extern printf
section .text
main:
; scanf
sub rsp, 8
mov rdi, nya
mov rsi, x
mov rdx, y
call scanf wrt ..plt
add rsp, 8
; comparsion
mov rax, qword [rel x]
add rax, [rel y]
jb meow
push rbp
mov rdi, no
call printf wrt ..plt
pop rbp
jmp end
meow:
push rbp
mov rdi, yes
call printf wrt ..plt
pop rbp
end:
xor rax, rax
ret
section .data
nya dq "%llu %llu", 0
yes db "YES", 10, 0
no db "NO", 10, 0
section .bss
x resq 1
y resq 1

@ -0,0 +1,68 @@
global main
extern scanf
extern printf
section .text
main:
xor ebx, ebx
loop1:
cmp ebx, 8
jge nya1
inc ebx
; read element
lea edx, [a + 1*ebx]
push edx
push template
call scanf
add esp, 8
push word [edx]
push output
call printf
add esp, 8
jmp loop1
nya1:
; xor ebx, ebx
;
;loop2:
; cmp ebx, 8
; jge nya2
; inc ebx
;
; ; read element
; push b
; push template
; call scanf
; add esp, 8
;
; jmp loop1
;
;nya1:
; xor ebx, ebx
;loop3:
; output
; push word [a]
; push output
; call printf
; add esp, 8
xor eax, eax
ret
section .data
template db "%d", 0
output db "%d", 10, 0
t db "%d", 10, 0
section .bss
a resw 8
b resw 8

@ -0,0 +1,30 @@
global _start
section .text
_start:
; input
mov eax, 3
xor ebx, ebx
mov ecx, nya
mov edx, 1
int 0x80
; modification
mov ax, word [nya]
or ax, 0111b
mov [nya], ax
; output
mov eax, 4
mov ebx, 1
mov ecx, nya
mov edx, 1
int 0x80
; program exit
mov eax, 1 ; sys_exit = 1
xor ebx, ebx
int 0x80
section .bss
nya resb 1