I'm currently taking an assembly class and was trying to figure out how you could return an object from a function that was larger then the return register.
So I used the -S function in gcc to output the code in asm and to clean it up a little I used -O1 to turn on the first level of optimzation.
The resulting code was pretty freakin sweet. For testing I used this:
Code:
#include <stdio.h>
typedef struct Test
{
  int a;
  int b;
}test;

test foo (void);
int main (void)
{
  test bob;
  bob = foo();
  printf("%d\t%d\n", bob.a, bob.b);
  return 0;
}

test foo (void)
{
  test bar={5, 8};
  return bar;
}
The resulting asm code had 5 and 8 going directly into the memory space of bob. No real passing just directly putting the stuff where it was going to end up.

If you are ever bored I would recommend looking at what your compiler does to your code to optimize it, it might just boggle your mind