Anyway, learning amd64 when knowing x86 is easy as they are mostly the same.
Also, such program would have int as a 32 bit value unless specifically declared to be larger - we could write programs that use less memory, but still use more registers, and use 64bit pointers and values as necessary
* As far as the processor itself is concerned, the code runs in 64-bit mode, so you get the extra (and wider) registers from that.
* But pointers are still 32 bits, so you get the memory savings of 32-bit mode.
In principle, as long as you're using <4GiB of memory, it should be at least as fast as the best of 32-bit or 64-bit mode for any particular program. But I haven't heard of it being used much.
Additionally, processors have "modes". You tell the processor to go into 64-bit or 32-bit mode. I don't think quickly switching back and forth between those in real-time is a very good idea.
The main thing is having a differen ABI (within the program), and using the linker/memmapping to ensure that the stack, code, and a heap is in the lower 4G. Another heap can be in the 64bit space, using 64bit pointers.
edit: one could even use trickery related to the alignment of pointers (i.e. 32bit alignment) to shift values on load or access, using the fact that the lower bits of the address. This could allow 36bit addresses that cover 16GB of memory.