(assuming x86)
First you have to understand the stack.
Functions use an area of memory called the "stack". You can think of it like a stack of plates, where each plate contains a DWORD (32 bits) of data. There is a register in the CPU that keeps track of the current location in the stack (it's just a virtual memory address) that we are dealing with. It's called the stack pointer and is typically stored in a the esp register.
When functions interact with the stack, they are typically doing one of two things: a push or a pop. A "push" is when something it put on top of the stack, which consists of moving the stack pointer to the next highest position and then copying something to that new location (the new top). A push "grows the stack" because there is more data being stored there now (more plates).
A "pop" is when the top most item on the stack is "removed", which consists of copying whatever is currently on top of the stack (being pointed to by the esp register) to a cpu register (typically eax) and then moving the stack pointer to one position lower in the stack.
So now we can talk about setting up to call a function.
code
t.B(3, 4);
assembly
// here is a push we described above. The function we are in currently is
// pushing the value "4" onto the stack. This is one of the arguments to the
// B function we are calling. Note that we push the last argument first
push 4
// here is another push. This time we are pushing the next argument to the
// B function
push 3
call B // this call sets up the context for the next function to run
When a call occurs, we are transitioning the context from the current function to the function being called. The extra peices information the function needs to run are the arguments, which we pushed onto the stack.
The new function now will do some house keeping with the stack to make room for the local variables it has as well as saving the stack pointer into a register so that it can be reverted once the function returns. If this didn't happen, then the calling function would be all disoriented when it regains control with no idea how to access the stuff it has previously put onto the stack, such as it's own local variables or the context for the stack pointer for the function that called it.
Now here it is happening in assembly (stealing this from Havenard).
// Here is the B function making sure that the calling function can get back to
// the it's stack context when B returns.
push ebp
mov ebp, esp
// remember when I said that a push was growing the stack. Well you can also grow
// it just by moving the stack pointer higher, as if there were already more plates there
// you may wonder why we are subtracting (sub) from the stack pointer (esp) to grow it
// the reason is that the stack "grows down" in memory. In other words, as the stack grows
// the memory addresses of the stack grow smaller.
// the reason we are subtracting 4 is because we only need to grow the stack by one plate
// so that we can store the local variable 'result' there. If we had 2 local variables
// we would have subtracted 8
sub esp, 4
// the instructions below are simply moving the static value 1 into the local variable
// 'result'. Local variables are always referenced relative to the bottom of the stack
// context for the current function. This value is stored in the ebp register, which we
// saw earlier in the function setup above.
// so now we think of the location where the 'result' variable is stored as "ebp-4"
// we know that because we put it there.
mov dword ptr [ebp-4], 1 // result = 1 (true)
// eax is a special register that contains the return value of the function. That is why
// you see the value of 'result' (which we know as [ebp-4] in the eax register
mov eax, dword ptr [ebp-4]
// We adjust the stack pointer back to it's previous location
// before we subtracted to make room for our local variable
add esp, 4
// Our work is done now.. time to clean stuff up for our calling function and
// leave things as we found them. Our trusty ebp register stores the old stack pointer
// that our calling function needs to resume it's stack context.
mov esp, ebp
pop ebp
ret
I'm sure there are some details I've left out, especially on returning from the B function, but this is a pretty good overview I think.