Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 .global supersum
- 2
- 3 supersum:
- 4 xor %edx, %edx // буфер для промежуточной суммы
- 5 cmp %esi, %edi
- 6 jle swap
- 7 push %ebx
- 8 mov $-1, %ebx
- 9 jmp put
- 10
- 11 put:
- 12 xor %edx, %edx
- 13 inc %ebx
- 14 cmp %ebx, %esi
- 15 jle loop
- 16 movb (%eax, %ebx, 1), %dl
- 17 movb %dl, (%ecx, %ebx, 1)
- 18 jmp loop
- 19
- 20 loop:
- 21 inc %eax
- 22 cmp %eax, %edi
- 23 jg add_remain
- 24 addw (%ecx, %eax, 1), %dx
- 25 addw (%ebx, %eax, 1), %dx
- 26 mov %dl, (%ecx, %eax, 1)
- 27 mov %dh, %dl
- 28 xor %dh, %dh
- 29 jmp loop
- 30
- 31 swap:
- 32 xchg %eax, %ebx
- 33 xchg %esi, %edi
- 34 jmp supersum
- 35
- 36 add_remain:
- 37 addw (%ecx, %eax, 1), %dx
- 38 mov %dl, (%ecx, %eax, 1)
- 39 mov %dh, %dl
- 40 xor %dh, %dh
- 41 cmp $0, %dl
- 42 jnz loop
- 43
- 44 call_ret:
- 45 mov (%esp), %ebx
- 46 ret
- 47
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement