Listing 3:


#       compiled using ic960 -Aka -O3 -S fib.c _fib: 
#
_fib:
        mov             g0,r15          # copy in-coming parameter
        cmp     i       2,r15                   # determine in n < 2
        add     o       16,sp,sp       # align stack to next 16-byte boundary
        bl              .I47
        ld      const   1,g0       # return 1 in g0 when n <= 2
        ret     
.I47:
        sub     i       1,r15,g0       # place n-1 in g0
        callj           _fib
        st              g0,0x40(fp)     # store return value on stack
        sub     i       2,r15,g0       # place n-2 in g0
        callj           _fib
        ld              0x40(fp),r11    # re-load fib(n-1) value
        addi            g0,r11,r3       # add fib(n-1) and fib(n-2)
        mov             r3,g0           # place return value in g0
        ret     


