ans3.jas

c:
  ld [fp+12] -> %r0
  cmp %r0, %g0
  bgt l1
  ld [fp+16] -> %r0
  add %r0, %g1 -> %r0
  ret
l1:
  mov #-3 -> %r0
  ld [fp+12] -> %r1
  add %r0, %r1 -> %r0
  st %r0 -> [sp]--
  ld [fp+16] -> %r0
  st %r0 -> [sp]--
  jsr a
  pop #8
  add %r0, %g1 -> %r0
  ret

a:
  st %r2 -> [sp]--
  ld [fp+16] -> %r0
  cmp %r0, %g0
  bgt l2
  ld [fp+12] -> %r0
  add %r0, %g1 -> %r0
  ld ++[sp] -> %r2
  ret
l2:
  ld [fp+16] -> %r0
  st %r0 -> [sp]--
  ld [fp+12] -> %r0
  add %r0, %gm1 -> %r0
  st %r0 -> [sp]--
  jsr c
  pop #8
  ld [fp+16] -> %r1
  add %r1, %gm1 -> %r1
  st %r1 -> [sp]--
  ld [fp+12] -> %r1
  add %r1, %gm1 -> %r1
  st %r1 -> [sp]--
  mov %r0 -> %r2
  jsr c
  pop #8
  add %r0, %r2 -> %r0
  ld ++[sp] -> %r2
  ret
main:
  push #4
  ld [fp+12] -> %r0
  mov #3 -> %r1
  cmp %r0, %r1
  beq l3
  st %g1 -> [sp]--
  jsr exit
  pop #3
  ret
l3:
  mov #8 -> %r0
  ld [fp+16] -> %r1
  add %r1, %r0 -> %r0
  ld [r0] -> %r0
  st %r0 -> [sp]--
  jsr atoi
  pop #4
  st %r0 -> [sp]--
  mov #4 -> %r0
  ld [fp+16] -> %r1
  add %r1, %r0 -> %r0
  ld [r0] -> %r0
  st %r0 -> [sp]--
  jsr atoi
  pop #4
  st %r0 -> [sp]--
  jsr a
  pop #8
  st %r0 -> [fp]
  ret