Your first one from scratch
No starter this time — just an empty editor and the name func_800b3834 up in the header. Everything else comes from the target.
Look at it: a single mr into r3, then blr. mr ("move register") copies one register straight into another, and r3 is the return register — so this function takes one of its arguments and hands it right back, untouched. The only thing left to work out is which argument.
That's pure register-counting. Take a function whose body is:
mr r3, r5
blr
r5 is the 3rd argument register, so this returns its third parameter. And because the value it wants lives in r5, there must be a first and second argument sitting ahead of it — so the signature has three parameters, not one:
int third(int a, int b, int c) {
return c;
}
Now read your own target the same way. Which register does its mr copy from? Count from r3, and that tells you both how many arguments to declare and which one to return.
Your task
Write func_800b3834 to reproduce the assembly above.