#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_Scatterv(void *sendbuf, int *sendcounts, int *displs, int sendtype,
                 void *recvbuf, int recvcount, int recvtype, int root,
                 int comm) {
  int n = recvcount * stubtypesize(recvtype);
  if (sendbuf == NULL || recvbuf == NULL)
    return 0;
  memcpy(recvbuf, sendbuf, n);
  return 0;
}


x86 assembly (clang, -O0):
<MPI_Scatterv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x10(%rbp),%edi
call   1040 <stubtypesize@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1177 <MPI_Scatterv+0x57>
cmpq   $0x0,-0x30(%rbp)
jne    1183 <MPI_Scatterv+0x63>
movl   $0x0,-0x4(%rbp)
jmp    119a <MPI_Scatterv+0x7a>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x38(%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_Scatterv>:
push   %rbp
push   %r14
push   %rbx
mov    %r9d,%ebp
mov    %r8,%r14
mov    %rdi,%rbx
mov    0x20(%rsp),%edi
call   1040 <stubtypesize@plt>
test   %rbx,%rbx
je     1150 <MPI_Scatterv+0x30>
test   %r14,%r14
je     1150 <MPI_Scatterv+0x30>
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_Scatterv(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* %16
%22 = load i32, i32* %17
%23 = call i32 @stubtypesize(i32 %22)
%24 = mul nsw i32 %21, %23
store i32 %24, i32* %20
%25 = load i8*, i8** %11
%26 = icmp eq i8* %25, null
br i1 %26, label %30, label %27
27: ; preds = %9
%28 = load i8*, i8** %15
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %31
30: ; preds = %27, %9
store i32 0, i32* %10
br label %36
31: ; preds = %27
%32 = load i8*, i8** %15
%33 = load i8*, i8** %11
%34 = load i32, i32* %20
%35 = call i32 @memcpy(i8* %32, i8* %33, i32 %34)
store i32 0, i32* %10
br label %36
36: ; preds = %31, %30
%37 = load i32, i32* %10
ret i32 %37
}

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