I have converted a c program into an assembly program and am trying to simplify the code:
.global Func1
Func1: save %sp, -112, %sp
!st %i0, [%fp+68]
!st %i1, [%fp+72]
!ld [%fp+68], %o0
!ld [%fp+72], %o1
call Func2, 0
nop
mov %o0, %g1
mov %g1, %i0
ret
restore
.global Func2
Func2: save %sp, -112, %sp
!st %i0, [%fp+68]
!st %i1, [%fp+72]
!ld [%fp+68], %g2
!ld [%fp+72], %g1
add %g2, %g1, %g1
umul %g1, 2, %g1
mov %g1, %i0
ret
restore
I've simplified it enough to the point where when I try to change something it changes the return value of the program. My question is, what does st and ld do? I know what they mean, but what exactly is going on here? Is there a different way to do this by just using mov or something else? It's hard to find resources for this kind of thing online so help would be appreciated.