Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global summ
- .intel_syntax noprefix
- .text
- summ:
- push ebx
- mov ecx, N // counter
- .Loop:
- mov ebx, ecx
- dec ebx // N-1
- mov edx, A // &A
- mov eax, [edx + 4*ebx]
- mov edx, B // &B
- add eax. [edx + 4*ebx] // += B[N - 1]
- mov edx, R
- mov [edx + 4*ebx], eax // R[n-1] = %eax
- loop .Loop
- pop ebx
- ret
- .global everyday795
- everyday795:
- push ebp // save ebp
- mov ebp, esp
- sub esp, 4 // int n; &n == [ebp-4]
- push ebx
- mov ebx, ebp
- sub ebx, 4 // ebx = &n
- push ebx
- mob ebx, offset scanf_format // to get adress of the label
- push ebx
- call scanf
- add esp, 8 // to clear
- mov ebx, [ebp - 4] // ebp = n
- imul ebx, [ebp + 8] // n *= x
- add ebx, [ebp + 12] // n += y
- push ebx
- mov ebx, offset printf_format
- push ebx
- call printf
- add esp, 8
- pop ebx
- mov esp, ebp
- pop ebp
- ret
- scanf_format:
- .string "%d"
- printf_format:
- .string "%d\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement