#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
int stubtypesize(int);
int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls, int sendtype,
                  void *recvbuf, int *recvcounts, int *rdispls, int recvtype,
                  int comm) {
  int n = *sendcounts * stubtypesize(sendtype);
  if (sendbuf == NULL || recvbuf == NULL)
    return 0;
  memcpy(recvbuf, sendbuf, n);
  return 0;
}


x86 assembly (clang, -O0):
<MPI_Alltoallv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <stubtypesize@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x3c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117b <MPI_Alltoallv+0x5b>
cmpq   $0x0,-0x30(%rbp)
jne    1187 <MPI_Alltoallv+0x67>
movl   $0x0,-0x4(%rbp)
jmp    119e <MPI_Alltoallv+0x7e>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPI_Alltoallv>:
push   %rbp
push   %r14
push   %rbx
mov    %r8,%r14
mov    %rdi,%rbx
mov    (%rsi),%ebp
mov    %ecx,%edi
call   1040 <stubtypesize@plt>
test   %rbx,%rbx
je     114d <MPI_Alltoallv+0x2d>
test   %r14,%r14
je     114d <MPI_Alltoallv+0x2d>
imul   %ebp,%eax
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @MPI_Alltoallv(i8* %0, i32* %1, i32* %2, i32 %3, i8* %4, i32* %5, i32* %6, i32 %7, i32 %8) {
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i8* %0, i8** %11
store i32* %1, i32** %12
store i32* %2, i32** %13
store i32 %3, i32* %14
store i8* %4, i8** %15
store i32* %5, i32** %16
store i32* %6, i32** %17
store i32 %7, i32* %18
store i32 %8, i32* %19
%21 = load i32*, i32** %12
%22 = load i32, i32* %21
%23 = load i32, i32* %14
%24 = call i32 @stubtypesize(i32 %23)
%25 = mul nsw i32 %22, %24
store i32 %25, i32* %20
%26 = load i8*, i8** %11
%27 = icmp eq i8* %26, null
br i1 %27, label %31, label %28
28: ; preds = %9
%29 = load i8*, i8** %15
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %32
31: ; preds = %28, %9
store i32 0, i32* %10
br label %37
32: ; preds = %28
%33 = load i8*, i8** %15
%34 = load i8*, i8** %11
%35 = load i32, i32* %20
%36 = call i32 @memcpy(i8* %33, i8* %34, i32 %35)
store i32 0, i32* %10
br label %37
37: ; preds = %32, %31
%38 = load i32, i32* %10
ret i32 %38
}

LLVM IR (-O2):
define i32 @MPI_Alltoallv(i8* %0, i32* nocapture %1, i32* nocapture readnone %2, i32 %3, i8* %4, i32* nocapture readnone %5, i32* nocapture readnone %6, i32 %7, i32 %8) {
%10 = load i32, i32* %1
%11 = tail call i32 @stubtypesize(i32 %3)
%12 = icmp eq i8* %0, null
%13 = icmp eq i8* %4, null
%14 = or i1 %12, %13
br i1 %14, label %18, label %15
15: ; preds = %9
%16 = mul nsw i32 %11, %10
%17 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %16)
br label %18
18: ; preds = %9, %15
ret i32 0
}