Advertisement
pasholnahuy

Untitled

Oct 7th, 2023
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.70 KB | None | 0 0
  1.  
  2. 1 .global main
  3. 2. superum:
  4. 3. xor %edx, %edx
  5. 4. cmp %esi, %edi
  6. 5. jle swap
  7. 6 push %ebx
  8. 7 mov $-1, %ebx
  9. 8 jmp put
  10. 9
  11. 10 put:
  12. 11 xor %edx, %edx
  13. 12 inc %ebx
  14. 13 cmp %ebx, %esi
  15. 14 jle prepare_loop
  16. 15 movb (%eax, %ebx, 1), %edx 16 movb %edx, (%ecx, %ebx, 1) 17 jmp loop 18 19 prepare_loop: 20 mov $-1, %ebx 21 xor %edx, %edx 22 loop: 23 inc %ebx 24 cmp %eax, %edi 25 jg add_remain 26 addw (%ecx, %ebx, 1), %dx 27 addw (%eax, %ebx, 1), %dx 28 mov %dl, (%ecx, %ebx, 1) 29 mov %dh, %dl 30 xor %dh, %dh 31 jmp loop 32 33 swap: 34 xchg %eax, %ebx 35 xchg %esi, %edi 36 jmp supersum 37 38 add_remain: 39 addw (%ecx, %ebx, 1), %dx 40 mov %dl, (%ecx, %ebx, 1) 41 mov %dh, %dl 42 xor %dh, %dh 43 cmp $0, %dl 44 jnz loop 45 46 call_ret: 47 mov (%esp), %ebx 48 ret 49
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement