#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 */
double exp(double);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  int comm_size, comm_rank, length;
  char proc_name[100] = "test";
  double result;
  comm_rank = 0;
  comm_size = 1;
  printf("Hello World from process = %d on processor %s\n", comm_rank,
         proc_name);
  result = exp((double)comm_rank);
  printf("Exp(%d) = %f\n", comm_rank, result);
  printf("Number of mpi processes = %d\n", comm_size);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movb   $0x74,-0x80(%rbp)
movb   $0x65,-0x7f(%rbp)
movb   $0x73,-0x7e(%rbp)
movb   $0x74,-0x7d(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x18(%rbp),%esi
lea    -0x80(%rbp),%rdx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x18(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x18(%rbp),%esi
movsd  -0x88(%rbp),%xmm0
ff
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movl   $0x74736574,(%rsp)
lea    0xebe(%rip),%rdi
mov    %rsp,%rdx
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
movsd  0xe9b(%rip),%xmm0
xor    %esi,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Hello World from process = %d on processor %s\0A\00"
@.str.1 = [14 x i8] c"Exp(%d) = %f\0A\00"
@.str.2 = [30 x i8] c"Number of mpi processes = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [100 x i8]
%9 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
%10 = bitcast [100 x i8]* %8 to i8*
%11 = bitcast i8* %10 to [100 x i8]*
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i32 0, i32 0
store i8 116, i8* %12
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i32 0, i32 1
store i8 101, i8* %13
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i32 0, i32 2
store i8 115, i8* %14
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i32 0, i32 3
store i8 116, i8* %15
store i32 0, i32* %6
store i32 1, i32* %5
%16 = load i32, i32* %6
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %17)
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to double
%21 = call double @exp(double %20)
store double %21, double* %9
%22 = load i32, i32* %6
%23 = load double, double* %9
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %22, double %23)
%25 = load i32, i32* %5
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"Hello World from process = %d on processor %s\0A\00"
@.str.1 = [14 x i8] c"Exp(%d) = %f\0A\00"
@.str.2 = [30 x i8] c"Number of mpi processes = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
store i8 116, i8* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 1
store i8 101, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 2
store i8 115, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 3
store i8 116, i8* %7
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 0, i8* %4)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0, double 1.000000e+00)
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 1)
ret i32 0
}