Where is the source code for mmap function?
I assume you mean mmap.c - you can find the source files here:

https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/libsyscall/wrappers/unix03/mmap.c
https://github.com/apple/darwin-xnu/blob/master/bsd/sys/mman.h

The kernel part of the implementation where the functionality actually lies can be found here:

https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/bsd/kern/kern_mman.c