838103616 bytes is 799 MiB (Mebibytes, the power-of-two-based prefix), which matches GC 13. (Note that the computation for the heap goal just divides by 1<<20, or 1 MiB.)
The discrepancy in GC count is probably due to the fact that the GC count value reported by the GC trace is *after* the increment in mark termination, but it reports the previous cycle's heap goal. This makes sense because the GC trace isn't reporting a count of completed GCs, but reporting on the Nth GC, which just finished. (This is why the GC trace count starts at 1 instead of 0.)
More concretely, you'll observe that 799 MiB heap goal after 12 GCs have completed (your read of numgc), but you'll be reading that heap goal *during* the 13th GC cycle, which is what the GC trace is reporting on.