// FIB1         Recursive calls for Fibonacci numbers

        .text                     // Section for code
        .align  32                // Desired alignment
        .global fib1              // These three lines
        .proc   fib1              //  mark the mandatory
fib1:                             //   function entry
        .prologue 12,r32          // Mask for rp, ar.pfs only
        alloc   loc0 = ar.pfs,1,4,1,0  // ins, locals, outs
        .save   rp,loc1           // Must save return address
        mov     loc1 = b0         //  to our caller
        .body                     // Now we really begin...
first:  mov     ret0 = 1          // Default value
        cmp.geu p6,p0 = 2,in0     // Set F(N)=1
   (p6) br.cond.spnt.few done     //  if N=1 or 2
        add     in0 = -1,in0;;    // Compute N-1, save it,
        mov     out0 = in0        //  and use as argument
        mov     loc2 = r1         // Save gp
        br.call.sptk.many b0 = fib1  // Compute F(N-1)
        mov     r1 = loc2         // Restore gp
        mov     loc3 = ret0       // Remember F(N-1)
        add     out0 = -1,in0     // Compute N-2 as argument
        br.call.sptk.many b0 = fib1  // Compute F(N-2)
        mov     r1 = loc2         // Restore gp
        add     ret0 = loc3,ret0  // Return F(n-1) + F(n-2)
done:   mov     b0 = loc1         // Restore return address
        mov     ar.pfs = loc0     // Restore caller's ar.pfs
        br.ret.sptk.many b0;;     // Back to caller
        .endp   fib1              // Mark end of procedure