Advertisement
lukicdarkoo

Priprema za Test12, zadatak 3

Apr 13th, 2014
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .section .data
  2.     n=4
  3.     a: .quad 1000000000000, 2000000000000, -1000000000000, 72
  4.     b: .quad 1, 4000000000000, 2000000000000, 72
  5.     c: .quad 0,0,0,0
  6.     greska: .long 0
  7.  
  8. .section .text
  9. .global main
  10.  
  11. main:
  12.     movl $0, %esi
  13.     while:
  14.     cmpl $n, %esi
  15.     je whileKraj
  16.         movl b+4(, %esi, 8), %eax
  17.         cmpl a+4(, %esi, 8), %eax
  18.         jl oduzmiOdA
  19.         jg saberiSaA
  20.  
  21.         movl b(, %esi, 8), %eax
  22.         cmpl a(, %esi, 8), %eax
  23.         jl oduzmiOdA
  24.         jg saberiSaA
  25.  
  26.         saberiSaA:
  27.             movl a(, %esi, 8), %eax
  28.             addl b(, %esi, 8), %eax
  29.             movl a + 4(, %esi, 8), %ebx
  30.             adcl b + 4(, %esi, 8), %ebx
  31.             jo postaviGresku
  32.  
  33.             movl %ebx, c + 4(, %esi, 8)
  34.             movl %eax, c(, %esi, 8)
  35.  
  36.             jmp whileBrojac
  37.  
  38.         oduzmiOdA:
  39.             movl a(, %esi, 8), %eax
  40.             subl b(, %esi, 8), %eax
  41.             movl a + 4(, %esi, 8), %ebx
  42.             sbbl b + 4(, %esi, 8), %ebx
  43.             jo postaviGresku
  44.  
  45.             movl %ebx, c + 4(, %esi, 8)
  46.             movl %eax, c(, %esi, 8)
  47.    
  48.     whileBrojac:
  49.     incl %esi
  50.     jmp while
  51.     whileKraj:
  52.  
  53.  
  54.     postaviGresku:
  55.         movl $1, greska
  56.  
  57. kraj:
  58.     movl $0, %ebx
  59.     movl $1, %eax
  60.     int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement