
/**
 *
 * preload_mpi.C
 *
 *  !! DO NOT EDIT !!
 *  This file was generated by gen_wrappers_mpi.py.
 *  !! DO NOT EDIT !!
 *
 * Functions that will be preloaded with LD_PRELOAD,
 * (or DYLD_INSERT_LIBRARIES on Darwin), thereby
 * overriding system library functions so we can call into our
 * wrapper function.
 *
 * Since we are using dynamic linking, the __real_<SYMBOL>
 * functions are looked up at runtime using dlsym().
 */

#ifndef ESMF_MPIUNI

#ifdef ESMF_PGIVERSION_MAJOR
/* required for RTLD_NEXT */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#endif

#include <dlfcn.h>
#include <mpi.h>

#include "ESMCI_Macros.h"
#include "ESMCI_Trace.h"
#include "wrappers_mpi.h"

#define xstr(s) str(s)
#define str(s) #s

extern "C" {

  /*
   * C MPI functions
   */

  
    static int (*__real_ptr_MPI_Allgather)(ESMF_MPI_CONST void *sendbuf, int  sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) = NULL;

    int __real_MPI_Allgather(ESMF_MPI_CONST void *sendbuf, int  sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) {
      if (__real_ptr_MPI_Allgather == NULL) {
        __real_ptr_MPI_Allgather = (int (*)(ESMF_MPI_CONST void *sendbuf, int  sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Allgather");
      }
      return __real_ptr_MPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
    }

    int MPI_Allgather(ESMF_MPI_CONST void *sendbuf, int  sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) {
      return __wrap_MPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
    }

  
    static int (*__real_ptr_MPI_Allgatherv)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, MPI_Comm comm) = NULL;

    int __real_MPI_Allgatherv(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, MPI_Comm comm) {
      if (__real_ptr_MPI_Allgatherv == NULL) {
        __real_ptr_MPI_Allgatherv = (int (*)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Allgatherv");
      }
      return __real_ptr_MPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
    }

    int MPI_Allgatherv(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, MPI_Comm comm) {
      return __wrap_MPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
    }

  
    static int (*__real_ptr_MPI_Allreduce)(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) = NULL;

    int __real_MPI_Allreduce(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {
      if (__real_ptr_MPI_Allreduce == NULL) {
        __real_ptr_MPI_Allreduce = (int (*)(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Allreduce");
      }
      return __real_ptr_MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
    }

    int MPI_Allreduce(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {
      return __wrap_MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
    }

  
    static int (*__real_ptr_MPI_Alltoall)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) = NULL;

    int __real_MPI_Alltoall(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) {
      if (__real_ptr_MPI_Alltoall == NULL) {
        __real_ptr_MPI_Alltoall = (int (*)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Alltoall");
      }
      return __real_ptr_MPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
    }

    int MPI_Alltoall(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) {
      return __wrap_MPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
    }

  
    static int (*__real_ptr_MPI_Alltoallv)(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], MPI_Datatype recvtype, MPI_Comm comm) = NULL;

    int __real_MPI_Alltoallv(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], MPI_Datatype recvtype, MPI_Comm comm) {
      if (__real_ptr_MPI_Alltoallv == NULL) {
        __real_ptr_MPI_Alltoallv = (int (*)(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], MPI_Datatype recvtype, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Alltoallv");
      }
      return __real_ptr_MPI_Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm);
    }

    int MPI_Alltoallv(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], MPI_Datatype recvtype, MPI_Comm comm) {
      return __wrap_MPI_Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm);
    }

  
    static int (*__real_ptr_MPI_Alltoallw)(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], ESMF_MPI_CONST MPI_Datatype sendtypes[], void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], ESMF_MPI_CONST MPI_Datatype recvtypes[], MPI_Comm comm) = NULL;

    int __real_MPI_Alltoallw(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], ESMF_MPI_CONST MPI_Datatype sendtypes[], void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], ESMF_MPI_CONST MPI_Datatype recvtypes[], MPI_Comm comm) {
      if (__real_ptr_MPI_Alltoallw == NULL) {
        __real_ptr_MPI_Alltoallw = (int (*)(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], ESMF_MPI_CONST MPI_Datatype sendtypes[], void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], ESMF_MPI_CONST MPI_Datatype recvtypes[], MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Alltoallw");
      }
      return __real_ptr_MPI_Alltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm);
    }

    int MPI_Alltoallw(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int sdispls[], ESMF_MPI_CONST MPI_Datatype sendtypes[], void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int rdispls[], ESMF_MPI_CONST MPI_Datatype recvtypes[], MPI_Comm comm) {
      return __wrap_MPI_Alltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm);
    }

  
    static int (*__real_ptr_MPI_Barrier)(MPI_Comm comm) = NULL;

    int __real_MPI_Barrier(MPI_Comm comm) {
      if (__real_ptr_MPI_Barrier == NULL) {
        __real_ptr_MPI_Barrier = (int (*)(MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Barrier");
      }
      return __real_ptr_MPI_Barrier(comm);
    }

    int MPI_Barrier(MPI_Comm comm) {
      return __wrap_MPI_Barrier(comm);
    }

  
    static int (*__real_ptr_MPI_Bcast)(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) = NULL;

    int __real_MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) {
      if (__real_ptr_MPI_Bcast == NULL) {
        __real_ptr_MPI_Bcast = (int (*)(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Bcast");
      }
      return __real_ptr_MPI_Bcast(buffer, count, datatype, root, comm);
    }

    int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) {
      return __wrap_MPI_Bcast(buffer, count, datatype, root, comm);
    }

  
    static int (*__real_ptr_MPI_Bsend)(ESMF_MPI_CONST void *buffer, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) = NULL;

    int __real_MPI_Bsend(ESMF_MPI_CONST void *buffer, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
      if (__real_ptr_MPI_Bsend == NULL) {
        __real_ptr_MPI_Bsend = (int (*)(ESMF_MPI_CONST void *buffer, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Bsend");
      }
      return __real_ptr_MPI_Bsend(buffer, count, datatype, dest, tag, comm);
    }

    int MPI_Bsend(ESMF_MPI_CONST void *buffer, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
      return __wrap_MPI_Bsend(buffer, count, datatype, dest, tag, comm);
    }

  
    static int (*__real_ptr_MPI_Gather)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;

    int __real_MPI_Gather(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) {
      if (__real_ptr_MPI_Gather == NULL) {
        __real_ptr_MPI_Gather = (int (*)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Gather");
      }
      return __real_ptr_MPI_Gather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
    }

    int MPI_Gather(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) {
      return __wrap_MPI_Gather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
    }

  
    static int (*__real_ptr_MPI_Gatherv)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;

    int __real_MPI_Gatherv(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm) {
      if (__real_ptr_MPI_Gatherv == NULL) {
        __real_ptr_MPI_Gatherv = (int (*)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Gatherv");
      }
      return __real_ptr_MPI_Gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm);
    }

    int MPI_Gatherv(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, ESMF_MPI_CONST int recvcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm) {
      return __wrap_MPI_Gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm);
    }

  
    static int (*__real_ptr_MPI_Iprobe)(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status) = NULL;

    int __real_MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status) {
      if (__real_ptr_MPI_Iprobe == NULL) {
        __real_ptr_MPI_Iprobe = (int (*)(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status)) dlsym(RTLD_NEXT, "MPI_Iprobe");
      }
      return __real_ptr_MPI_Iprobe(source, tag, comm, flag, status);
    }

    int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status) {
      return __wrap_MPI_Iprobe(source, tag, comm, flag, status);
    }

  
    static int (*__real_ptr_MPI_Irecv)(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request) = NULL;

    int __real_MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request) {
      if (__real_ptr_MPI_Irecv == NULL) {
        __real_ptr_MPI_Irecv = (int (*)(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)) dlsym(RTLD_NEXT, "MPI_Irecv");
      }
      return __real_ptr_MPI_Irecv(buf, count, datatype, source, tag, comm, request);
    }

    int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request) {
      return __wrap_MPI_Irecv(buf, count, datatype, source, tag, comm, request);
    }

  
    static int (*__real_ptr_MPI_Irsend)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) = NULL;

    int __real_MPI_Irsend(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) {
      if (__real_ptr_MPI_Irsend == NULL) {
        __real_ptr_MPI_Irsend = (int (*)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)) dlsym(RTLD_NEXT, "MPI_Irsend");
      }
      return __real_ptr_MPI_Irsend(buf, count, datatype, dest, tag, comm, request);
    }

    int MPI_Irsend(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) {
      return __wrap_MPI_Irsend(buf, count, datatype, dest, tag, comm, request);
    }

  
    static int (*__real_ptr_MPI_Isend)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) = NULL;

    int __real_MPI_Isend(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) {
      if (__real_ptr_MPI_Isend == NULL) {
        __real_ptr_MPI_Isend = (int (*)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)) dlsym(RTLD_NEXT, "MPI_Isend");
      }
      return __real_ptr_MPI_Isend(buf, count, datatype, dest, tag, comm, request);
    }

    int MPI_Isend(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) {
      return __wrap_MPI_Isend(buf, count, datatype, dest, tag, comm, request);
    }

  
    static int (*__real_ptr_MPI_Issend)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) = NULL;

    int __real_MPI_Issend(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) {
      if (__real_ptr_MPI_Issend == NULL) {
        __real_ptr_MPI_Issend = (int (*)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)) dlsym(RTLD_NEXT, "MPI_Issend");
      }
      return __real_ptr_MPI_Issend(buf, count, datatype, dest, tag, comm, request);
    }

    int MPI_Issend(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) {
      return __wrap_MPI_Issend(buf, count, datatype, dest, tag, comm, request);
    }

  
    static int (*__real_ptr_MPI_Probe)(int source, int tag, MPI_Comm comm, MPI_Status *status) = NULL;

    int __real_MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) {
      if (__real_ptr_MPI_Probe == NULL) {
        __real_ptr_MPI_Probe = (int (*)(int source, int tag, MPI_Comm comm, MPI_Status *status)) dlsym(RTLD_NEXT, "MPI_Probe");
      }
      return __real_ptr_MPI_Probe(source, tag, comm, status);
    }

    int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) {
      return __wrap_MPI_Probe(source, tag, comm, status);
    }

  
    static int (*__real_ptr_MPI_Recv)(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) = NULL;

    int __real_MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) {
      if (__real_ptr_MPI_Recv == NULL) {
        __real_ptr_MPI_Recv = (int (*)(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)) dlsym(RTLD_NEXT, "MPI_Recv");
      }
      return __real_ptr_MPI_Recv(buf, count, datatype, source, tag, comm, status);
    }

    int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) {
      return __wrap_MPI_Recv(buf, count, datatype, source, tag, comm, status);
    }

  
    static int (*__real_ptr_MPI_Reduce)(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) = NULL;

    int __real_MPI_Reduce(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) {
      if (__real_ptr_MPI_Reduce == NULL) {
        __real_ptr_MPI_Reduce = (int (*)(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Reduce");
      }
      return __real_ptr_MPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
    }

    int MPI_Reduce(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) {
      return __wrap_MPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
    }

  
    static int (*__real_ptr_MPI_Rsend)(ESMF_MPI_CONST void *sendbuf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) = NULL;

    int __real_MPI_Rsend(ESMF_MPI_CONST void *sendbuf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
      if (__real_ptr_MPI_Rsend == NULL) {
        __real_ptr_MPI_Rsend = (int (*)(ESMF_MPI_CONST void *sendbuf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Rsend");
      }
      return __real_ptr_MPI_Rsend(sendbuf, count, datatype, dest, tag, comm);
    }

    int MPI_Rsend(ESMF_MPI_CONST void *sendbuf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
      return __wrap_MPI_Rsend(sendbuf, count, datatype, dest, tag, comm);
    }

  
    static int (*__real_ptr_MPI_Scan)(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) = NULL;

    int __real_MPI_Scan(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {
      if (__real_ptr_MPI_Scan == NULL) {
        __real_ptr_MPI_Scan = (int (*)(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Scan");
      }
      return __real_ptr_MPI_Scan(sendbuf, recvbuf, count, datatype, op, comm);
    }

    int MPI_Scan(ESMF_MPI_CONST void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {
      return __wrap_MPI_Scan(sendbuf, recvbuf, count, datatype, op, comm);
    }

  
    static int (*__real_ptr_MPI_Scatter)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;

    int __real_MPI_Scatter(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) {
      if (__real_ptr_MPI_Scatter == NULL) {
        __real_ptr_MPI_Scatter = (int (*)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Scatter");
      }
      return __real_ptr_MPI_Scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
    }

    int MPI_Scatter(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) {
      return __wrap_MPI_Scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
    }

  
    static int (*__real_ptr_MPI_Scatterv)(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;

    int __real_MPI_Scatterv(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) {
      if (__real_ptr_MPI_Scatterv == NULL) {
        __real_ptr_MPI_Scatterv = (int (*)(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Scatterv");
      }
      return __real_ptr_MPI_Scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
    }

    int MPI_Scatterv(ESMF_MPI_CONST void *sendbuf, ESMF_MPI_CONST int sendcounts[], ESMF_MPI_CONST int displs[], MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) {
      return __wrap_MPI_Scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
    }

  
    static int (*__real_ptr_MPI_Send)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) = NULL;

    int __real_MPI_Send(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
      if (__real_ptr_MPI_Send == NULL) {
        __real_ptr_MPI_Send = (int (*)(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) dlsym(RTLD_NEXT, "MPI_Send");
      }
      return __real_ptr_MPI_Send(buf, count, datatype, dest, tag, comm);
    }

    int MPI_Send(ESMF_MPI_CONST void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
      return __wrap_MPI_Send(buf, count, datatype, dest, tag, comm);
    }

  
    static int (*__real_ptr_MPI_Sendrecv)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status) = NULL;

    int __real_MPI_Sendrecv(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status) {
      if (__real_ptr_MPI_Sendrecv == NULL) {
        __real_ptr_MPI_Sendrecv = (int (*)(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status)) dlsym(RTLD_NEXT, "MPI_Sendrecv");
      }
      return __real_ptr_MPI_Sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status);
    }

    int MPI_Sendrecv(ESMF_MPI_CONST void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status) {
      return __wrap_MPI_Sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status);
    }

  
    static int (*__real_ptr_MPI_Test)(MPI_Request *request, int *flag, MPI_Status *status) = NULL;

    int __real_MPI_Test(MPI_Request *request, int *flag, MPI_Status *status) {
      if (__real_ptr_MPI_Test == NULL) {
        __real_ptr_MPI_Test = (int (*)(MPI_Request *request, int *flag, MPI_Status *status)) dlsym(RTLD_NEXT, "MPI_Test");
      }
      return __real_ptr_MPI_Test(request, flag, status);
    }

    int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status) {
      return __wrap_MPI_Test(request, flag, status);
    }

  
    static int (*__real_ptr_MPI_Testall)(int count, MPI_Request requests[], int *flag, MPI_Status statuses[]) = NULL;

    int __real_MPI_Testall(int count, MPI_Request requests[], int *flag, MPI_Status statuses[]) {
      if (__real_ptr_MPI_Testall == NULL) {
        __real_ptr_MPI_Testall = (int (*)(int count, MPI_Request requests[], int *flag, MPI_Status statuses[])) dlsym(RTLD_NEXT, "MPI_Testall");
      }
      return __real_ptr_MPI_Testall(count, requests, flag, statuses);
    }

    int MPI_Testall(int count, MPI_Request requests[], int *flag, MPI_Status statuses[]) {
      return __wrap_MPI_Testall(count, requests, flag, statuses);
    }

  
    static int (*__real_ptr_MPI_Testany)(int count, MPI_Request requests[], int *index, int *flag, MPI_Status statuses[]) = NULL;

    int __real_MPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status statuses[]) {
      if (__real_ptr_MPI_Testany == NULL) {
        __real_ptr_MPI_Testany = (int (*)(int count, MPI_Request requests[], int *index, int *flag, MPI_Status statuses[])) dlsym(RTLD_NEXT, "MPI_Testany");
      }
      return __real_ptr_MPI_Testany(count, requests, index, flag, statuses);
    }

    int MPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status statuses[]) {
      return __wrap_MPI_Testany(count, requests, index, flag, statuses);
    }

  
    static int (*__real_ptr_MPI_Testsome)(int incount, MPI_Request requests[], int *outcount, int indices[], MPI_Status statuses[]) = NULL;

    int __real_MPI_Testsome(int incount, MPI_Request requests[], int *outcount, int indices[], MPI_Status statuses[]) {
      if (__real_ptr_MPI_Testsome == NULL) {
        __real_ptr_MPI_Testsome = (int (*)(int incount, MPI_Request requests[], int *outcount, int indices[], MPI_Status statuses[])) dlsym(RTLD_NEXT, "MPI_Testsome");
      }
      return __real_ptr_MPI_Testsome(incount, requests, outcount, indices, statuses);
    }

    int MPI_Testsome(int incount, MPI_Request requests[], int *outcount, int indices[], MPI_Status statuses[]) {
      return __wrap_MPI_Testsome(incount, requests, outcount, indices, statuses);
    }

  
    static int (*__real_ptr_MPI_Wait)(MPI_Request *request, MPI_Status *status) = NULL;

    int __real_MPI_Wait(MPI_Request *request, MPI_Status *status) {
      if (__real_ptr_MPI_Wait == NULL) {
        __real_ptr_MPI_Wait = (int (*)(MPI_Request *request, MPI_Status *status)) dlsym(RTLD_NEXT, "MPI_Wait");
      }
      return __real_ptr_MPI_Wait(request, status);
    }

    int MPI_Wait(MPI_Request *request, MPI_Status *status) {
      return __wrap_MPI_Wait(request, status);
    }

  
    static int (*__real_ptr_MPI_Waitall)(int count, MPI_Request array_of_requests[], MPI_Status *array_of_statuses) = NULL;

    int __real_MPI_Waitall(int count, MPI_Request array_of_requests[], MPI_Status *array_of_statuses) {
      if (__real_ptr_MPI_Waitall == NULL) {
        __real_ptr_MPI_Waitall = (int (*)(int count, MPI_Request array_of_requests[], MPI_Status *array_of_statuses)) dlsym(RTLD_NEXT, "MPI_Waitall");
      }
      return __real_ptr_MPI_Waitall(count, array_of_requests, array_of_statuses);
    }

    int MPI_Waitall(int count, MPI_Request array_of_requests[], MPI_Status *array_of_statuses) {
      return __wrap_MPI_Waitall(count, array_of_requests, array_of_statuses);
    }

  
    static int (*__real_ptr_MPI_Waitany)(int count, MPI_Request array_of_requests[], int *index, MPI_Status *status) = NULL;

    int __real_MPI_Waitany(int count, MPI_Request array_of_requests[], int *index, MPI_Status *status) {
      if (__real_ptr_MPI_Waitany == NULL) {
        __real_ptr_MPI_Waitany = (int (*)(int count, MPI_Request array_of_requests[], int *index, MPI_Status *status)) dlsym(RTLD_NEXT, "MPI_Waitany");
      }
      return __real_ptr_MPI_Waitany(count, array_of_requests, index, status);
    }

    int MPI_Waitany(int count, MPI_Request array_of_requests[], int *index, MPI_Status *status) {
      return __wrap_MPI_Waitany(count, array_of_requests, index, status);
    }

  
    static int (*__real_ptr_MPI_Waitsome)(int incount, MPI_Request array_of_requests[], int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]) = NULL;

    int __real_MPI_Waitsome(int incount, MPI_Request array_of_requests[], int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]) {
      if (__real_ptr_MPI_Waitsome == NULL) {
        __real_ptr_MPI_Waitsome = (int (*)(int incount, MPI_Request array_of_requests[], int *outcount, int array_of_indices[], MPI_Status array_of_statuses[])) dlsym(RTLD_NEXT, "MPI_Waitsome");
      }
      return __real_ptr_MPI_Waitsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses);
    }

    int MPI_Waitsome(int incount, MPI_Request array_of_requests[], int *outcount, int array_of_indices[], MPI_Status array_of_statuses[]) {
      return __wrap_MPI_Waitsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses);
    }

  

  /*
   * Fortran MPI functions
   */

  
    static void (*FTN_X(__real_ptr_mpi_allgather))(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_allgather)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_allgather) == NULL) {
        FTN_X(__real_ptr_mpi_allgather) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_allgather)));
      }
      FTN_X(__real_ptr_mpi_allgather)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, ierr);
    }

    void FTN_X(mpi_allgather)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_allgather)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_allgatherv))(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_allgatherv)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_allgatherv) == NULL) {
        FTN_X(__real_ptr_mpi_allgatherv) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_allgatherv)));
      }
      FTN_X(__real_ptr_mpi_allgatherv)(sendbuf, sendcount, sendtype, recvbuf, recvcount, displs, recvtype, comm, ierr);
    }

    void FTN_X(mpi_allgatherv)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_allgatherv)(sendbuf, sendcount, sendtype, recvbuf, recvcount, displs, recvtype, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_allreduce))(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_allreduce)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_allreduce) == NULL) {
        FTN_X(__real_ptr_mpi_allreduce) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_allreduce)));
      }
      FTN_X(__real_ptr_mpi_allreduce)(sendbuf, recvbuf, count, datatype, op, comm, ierr);
    }

    void FTN_X(mpi_allreduce)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_allreduce)(sendbuf, recvbuf, count, datatype, op, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_alltoall))(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_alltoall)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_alltoall) == NULL) {
        FTN_X(__real_ptr_mpi_alltoall) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_alltoall)));
      }
      FTN_X(__real_ptr_mpi_alltoall)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, ierr);
    }

    void FTN_X(mpi_alltoall)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_alltoall)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_alltoallv))(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_alltoallv)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_alltoallv) == NULL) {
        FTN_X(__real_ptr_mpi_alltoallv) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_alltoallv)));
      }
      FTN_X(__real_ptr_mpi_alltoallv)(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm, ierr);
    }

    void FTN_X(mpi_alltoallv)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_alltoallv)(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_alltoallw))(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtypes, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtypes, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_alltoallw)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtypes, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtypes, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_alltoallw) == NULL) {
        FTN_X(__real_ptr_mpi_alltoallw) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtypes, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtypes, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_alltoallw)));
      }
      FTN_X(__real_ptr_mpi_alltoallw)(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, ierr);
    }

    void FTN_X(mpi_alltoallw)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtypes, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtypes, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_alltoallw)(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_barrier))(MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_barrier)(MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_barrier) == NULL) {
        FTN_X(__real_ptr_mpi_barrier) = (void (*)(MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_barrier)));
      }
      FTN_X(__real_ptr_mpi_barrier)(comm, ierr);
    }

    void FTN_X(mpi_barrier)(MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_barrier)(comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_bcast))(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_bcast)(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_bcast) == NULL) {
        FTN_X(__real_ptr_mpi_bcast) = (void (*)(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_bcast)));
      }
      FTN_X(__real_ptr_mpi_bcast)(buffer, count, datatype, root, comm, ierr);
    }

    void FTN_X(mpi_bcast)(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_bcast)(buffer, count, datatype, root, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_bsend))(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_bsend)(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_bsend) == NULL) {
        FTN_X(__real_ptr_mpi_bsend) = (void (*)(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_bsend)));
      }
      FTN_X(__real_ptr_mpi_bsend)(buffer, count, datatype, dest, tag, comm, ierr);
    }

    void FTN_X(mpi_bsend)(MPI_Fint *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_bsend)(buffer, count, datatype, dest, tag, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_exscan))(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_exscan)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_exscan) == NULL) {
        FTN_X(__real_ptr_mpi_exscan) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_exscan)));
      }
      FTN_X(__real_ptr_mpi_exscan)(sendbuf, recvbuf, count, datatype, op, comm, ierr);
    }

    void FTN_X(mpi_exscan)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_exscan)(sendbuf, recvbuf, count, datatype, op, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_gather))(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_gather)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_gather) == NULL) {
        FTN_X(__real_ptr_mpi_gather) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_gather)));
      }
      FTN_X(__real_ptr_mpi_gather)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, ierr);
    }

    void FTN_X(mpi_gather)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_gather)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_gatherv))(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_gatherv)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_gatherv) == NULL) {
        FTN_X(__real_ptr_mpi_gatherv) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_gatherv)));
      }
      FTN_X(__real_ptr_mpi_gatherv)(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm, ierr);
    }

    void FTN_X(mpi_gatherv)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_gatherv)(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_iprobe))(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_iprobe)(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_iprobe) == NULL) {
        FTN_X(__real_ptr_mpi_iprobe) = (void (*)(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_iprobe)));
      }
      FTN_X(__real_ptr_mpi_iprobe)(source, tag, comm, flag, status, ierr);
    }

    void FTN_X(mpi_iprobe)(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_iprobe)(source, tag, comm, flag, status, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_irecv))(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_irecv)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_irecv) == NULL) {
        FTN_X(__real_ptr_mpi_irecv) = (void (*)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_irecv)));
      }
      FTN_X(__real_ptr_mpi_irecv)(buf, count, datatype, source, tag, comm, request, ierr);
    }

    void FTN_X(mpi_irecv)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_irecv)(buf, count, datatype, source, tag, comm, request, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_irsend))(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_irsend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_irsend) == NULL) {
        FTN_X(__real_ptr_mpi_irsend) = (void (*)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_irsend)));
      }
      FTN_X(__real_ptr_mpi_irsend)(buf, count, datatype, dest, tag, comm, request, ierr);
    }

    void FTN_X(mpi_irsend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_irsend)(buf, count, datatype, dest, tag, comm, request, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_isend))(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_isend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_isend) == NULL) {
        FTN_X(__real_ptr_mpi_isend) = (void (*)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_isend)));
      }
      FTN_X(__real_ptr_mpi_isend)(buf, count, datatype, dest, tag, comm, request, ierr);
    }

    void FTN_X(mpi_isend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_isend)(buf, count, datatype, dest, tag, comm, request, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_issend))(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_issend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_issend) == NULL) {
        FTN_X(__real_ptr_mpi_issend) = (void (*)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_issend)));
      }
      FTN_X(__real_ptr_mpi_issend)(buf, count, datatype, dest, tag, comm, request, ierr);
    }

    void FTN_X(mpi_issend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_issend)(buf, count, datatype, dest, tag, comm, request, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_probe))(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_probe)(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_probe) == NULL) {
        FTN_X(__real_ptr_mpi_probe) = (void (*)(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_probe)));
      }
      FTN_X(__real_ptr_mpi_probe)(source, tag, comm, status, ierr);
    }

    void FTN_X(mpi_probe)(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_probe)(source, tag, comm, status, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_recv))(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_recv)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_recv) == NULL) {
        FTN_X(__real_ptr_mpi_recv) = (void (*)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_recv)));
      }
      FTN_X(__real_ptr_mpi_recv)(buf, count, datatype, source, tag, comm, status, ierr);
    }

    void FTN_X(mpi_recv)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_recv)(buf, count, datatype, source, tag, comm, status, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_reduce))(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_reduce)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_reduce) == NULL) {
        FTN_X(__real_ptr_mpi_reduce) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_reduce)));
      }
      FTN_X(__real_ptr_mpi_reduce)(sendbuf, recvbuf, count, datatype, op, root, comm, ierr);
    }

    void FTN_X(mpi_reduce)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_reduce)(sendbuf, recvbuf, count, datatype, op, root, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_reduce_scatter))(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_reduce_scatter)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_reduce_scatter) == NULL) {
        FTN_X(__real_ptr_mpi_reduce_scatter) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_reduce_scatter)));
      }
      FTN_X(__real_ptr_mpi_reduce_scatter)(sendbuf, recvbuf, recvcounts, datatype, op, comm, ierr);
    }

    void FTN_X(mpi_reduce_scatter)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *recvcounts, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_reduce_scatter)(sendbuf, recvbuf, recvcounts, datatype, op, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_rsend))(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_rsend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_rsend) == NULL) {
        FTN_X(__real_ptr_mpi_rsend) = (void (*)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_rsend)));
      }
      FTN_X(__real_ptr_mpi_rsend)(buf, count, datatype, dest, tag, comm, ierr);
    }

    void FTN_X(mpi_rsend)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_rsend)(buf, count, datatype, dest, tag, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_scatter))(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_scatter)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_scatter) == NULL) {
        FTN_X(__real_ptr_mpi_scatter) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_scatter)));
      }
      FTN_X(__real_ptr_mpi_scatter)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, ierr);
    }

    void FTN_X(mpi_scatter)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_scatter)(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_scatterv))(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *displs, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_scatterv)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *displs, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_scatterv) == NULL) {
        FTN_X(__real_ptr_mpi_scatterv) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *displs, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_scatterv)));
      }
      FTN_X(__real_ptr_mpi_scatterv)(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, ierr);
    }

    void FTN_X(mpi_scatterv)(MPI_Fint *sendbuf, MPI_Fint *sendcounts, MPI_Fint *displs, MPI_Fint *sendtype, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_scatterv)(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_scan))(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_scan)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_scan) == NULL) {
        FTN_X(__real_ptr_mpi_scan) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_scan)));
      }
      FTN_X(__real_ptr_mpi_scan)(sendbuf, recvbuf, count, datatype, op, comm, ierr);
    }

    void FTN_X(mpi_scan)(MPI_Fint *sendbuf, MPI_Fint *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_scan)(sendbuf, recvbuf, count, datatype, op, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_send))(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_send)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_send) == NULL) {
        FTN_X(__real_ptr_mpi_send) = (void (*)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_send)));
      }
      FTN_X(__real_ptr_mpi_send)(buf, count, datatype, dest, tag, comm, ierr);
    }

    void FTN_X(mpi_send)(MPI_Fint *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_send)(buf, count, datatype, dest, tag, comm, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_sendrecv))(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *dest, MPI_Fint *sendtag, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *source, MPI_Fint *recvtag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_sendrecv)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *dest, MPI_Fint *sendtag, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *source, MPI_Fint *recvtag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_sendrecv) == NULL) {
        FTN_X(__real_ptr_mpi_sendrecv) = (void (*)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *dest, MPI_Fint *sendtag, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *source, MPI_Fint *recvtag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_sendrecv)));
      }
      FTN_X(__real_ptr_mpi_sendrecv)(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status, ierr);
    }

    void FTN_X(mpi_sendrecv)(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *dest, MPI_Fint *sendtag, MPI_Fint *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *source, MPI_Fint *recvtag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_sendrecv)(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_test))(MPI_Fint *request, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_test)(MPI_Fint *request, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_test) == NULL) {
        FTN_X(__real_ptr_mpi_test) = (void (*)(MPI_Fint *request, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_test)));
      }
      FTN_X(__real_ptr_mpi_test)(request, flag, status, ierr);
    }

    void FTN_X(mpi_test)(MPI_Fint *request, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_test)(request, flag, status, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_testall))(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *flag, MPI_Fint *statuses, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_testall)(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *flag, MPI_Fint *statuses, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_testall) == NULL) {
        FTN_X(__real_ptr_mpi_testall) = (void (*)(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *flag, MPI_Fint *statuses, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_testall)));
      }
      FTN_X(__real_ptr_mpi_testall)(count, requests, flag, statuses, ierr);
    }

    void FTN_X(mpi_testall)(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *flag, MPI_Fint *statuses, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_testall)(count, requests, flag, statuses, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_testany))(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *index, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_testany)(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *index, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_testany) == NULL) {
        FTN_X(__real_ptr_mpi_testany) = (void (*)(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *index, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_testany)));
      }
      FTN_X(__real_ptr_mpi_testany)(count, requests, index, flag, status, ierr);
    }

    void FTN_X(mpi_testany)(MPI_Fint *count, MPI_Fint *requests, MPI_Fint *index, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_testany)(count, requests, index, flag, status, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_testsome))(MPI_Fint *incount, MPI_Fint *requests, MPI_Fint *outcount, MPI_Fint *indices, MPI_Fint *statuses, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_testsome)(MPI_Fint *incount, MPI_Fint *requests, MPI_Fint *outcount, MPI_Fint *indices, MPI_Fint *statuses, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_testsome) == NULL) {
        FTN_X(__real_ptr_mpi_testsome) = (void (*)(MPI_Fint *incount, MPI_Fint *requests, MPI_Fint *outcount, MPI_Fint *indices, MPI_Fint *statuses, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_testsome)));
      }
      FTN_X(__real_ptr_mpi_testsome)(incount, requests, outcount, indices, statuses, ierr);
    }

    void FTN_X(mpi_testsome)(MPI_Fint *incount, MPI_Fint *requests, MPI_Fint *outcount, MPI_Fint *indices, MPI_Fint *statuses, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_testsome)(incount, requests, outcount, indices, statuses, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_wait))(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_wait)(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_wait) == NULL) {
        FTN_X(__real_ptr_mpi_wait) = (void (*)(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_wait)));
      }
      FTN_X(__real_ptr_mpi_wait)(request, status, ierr);
    }

    void FTN_X(mpi_wait)(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_wait)(request, status, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_waitall))(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *stats, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_waitall)(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *stats, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_waitall) == NULL) {
        FTN_X(__real_ptr_mpi_waitall) = (void (*)(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *stats, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_waitall)));
      }
      FTN_X(__real_ptr_mpi_waitall)(count, reqs, stats, ierr);
    }

    void FTN_X(mpi_waitall)(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *stats, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_waitall)(count, reqs, stats, ierr);
    }

  
    static void (*FTN_X(__real_ptr_mpi_waitany))(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *index, MPI_Fint *status, MPI_Fint *ierr) = NULL;

    void FTN_X(__real_mpi_waitany)(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *index, MPI_Fint *status, MPI_Fint *ierr) {
      if (FTN_X(__real_ptr_mpi_waitany) == NULL) {
        FTN_X(__real_ptr_mpi_waitany) = (void (*)(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *index, MPI_Fint *status, MPI_Fint *ierr)) dlsym(RTLD_NEXT, xstr(FTN_X(mpi_waitany)));
      }
      FTN_X(__real_ptr_mpi_waitany)(count, reqs, index, status, ierr);
    }

    void FTN_X(mpi_waitany)(MPI_Fint *count, MPI_Fint *reqs, MPI_Fint *index, MPI_Fint *status, MPI_Fint *ierr) {
      FTN_X(__wrap_mpi_waitany)(count, reqs, index, status, ierr);
    }

  

}

#endif
