I think the recvcount argument you pass to MPI_Allgather should not be
1 but instead
the number of MPI_INTs your buffer rem_rank_tbl can contain.
As it stands now, you tell MPI_Allgather that it may only receive 1 MPI_INT.
Furthermore, i'm not sure, but i think your receive buffer should be
to contain messages from *all* processes, and not just from the "far side"