Also (besides the title question), is there source code available for different impure Haskell functions like IO?
I don't mean the Haskell side of the code, but whatever Haskell implements to do IO.
Haskell implementations are written in a range of languages.
For example, GHC is:
The primops are the native instructions of the runtime. They in turn are implemented in the runtime via C, C-- and assembly fragments.
IO in particular is mediated via the IO manager, and via foreign libraries of IO primitives.