#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 poissonsEquationExp3D(int *iwork, double *rwork, int nPoints, double t,
                          double *X, double *u) {
  int i = 0;
  double K = rwork[0];
  double x, y, z;
  for (i = 0; i < nPoints; i++) {
    x = X[i * 3 + 0];
    y = X[i * 3 + 1];
    z = X[i * 3 + 2];
    u[i] = K * x * (1.0 - x) * y * (1.0 - y) * z * (1.0 - z) *
           exp(x * x + y * y + z * z);
  }
  return 0;
}


x86 assembly (clang, -O0):
<poissonsEquationExp3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1245 <poissonsEquationExp3D+0x135>
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
subsd  -0x48(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  0xe39(%rip),%xmm1
subsd  -0x50(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
subsd  -0x58(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    114b <poissonsEquationExp3D+0x3b>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poissonsEquationExp3D>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edx,%edx
jle    11ca <poissonsEquationExp3D+0xba>
mov    %r8,%r14
mov    %rcx,%r12
movsd  (%rsi),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r15d
add    $0x10,%r12
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  -0x10(%r12),%xmm1
movsd  -0x8(%r12),%xmm2
movsd  (%r12),%xmm0
movsd  0x8(%rsp),%xmm3
mulsd  %xmm1,%xmm3
movsd  0xe9a(%rip),%xmm5
movapd %xmm5,%xmm4
subsd  %xmm1,%xmm4
mulsd  %xmm3,%xmm4
mulsd  %xmm2,%xmm4
movapd %xmm5,%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm4,%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm0,%xmm5
mulsd  %xmm3,%xmm5
movsd  %xmm5,0x10(%rsp)
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
add    $0x18,%r12
cmp    %rbx,%r15
jne    1140 <poissonsEquationExp3D+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @poissonsEquationExp3D(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32* %0, i32** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
store i32 0, i32* %13
%18 = load double*, double** %8
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
store double %20, double* %14
store i32 0, i32* %13
br label %21
21: ; preds = %78, %6
%22 = load i32, i32* %13
%23 = load i32, i32* %9
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %81
25: ; preds = %21
%26 = load double*, double** %11
%27 = load i32, i32* %13
%28 = mul nsw i32 %27, 3
%29 = add nsw i32 %28, 0
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %26, i64 %30
%32 = load double, double* %31
store double %32, double* %15
%33 = load double*, double** %11
%34 = load i32, i32* %13
%35 = mul nsw i32 %34, 3
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %33, i64 %37
%39 = load double, double* %38
store double %39, double* %16
%40 = load double*, double** %11
%41 = load i32, i32* %13
%42 = mul nsw i32 %41, 3
%43 = add nsw i32 %42, 2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %40, i64 %44
%46 = load double, double* %45
store double %46, double* %17
%47 = load double, double* %14
%48 = load double, double* %15
%49 = fmul double %47, %48
%50 = load double, double* %15
%51 = fsub double 1.000000e+00, %50
%52 = fmul double %49, %51
%53 = load double, double* %16
%54 = fmul double %52, %53
%55 = load double, double* %16
%56 = fsub double 1.000000e+00, %55
%57 = fmul double %54, %56
%58 = load double, double* %17
%59 = fmul double %57, %58
%60 = load double, double* %17
%61 = fsub double 1.000000e+00, %60
%62 = fmul double %59, %61
%63 = load double, double* %15
%64 = load double, double* %15
%65 = load double, double* %16
%66 = load double, double* %16
%67 = fmul double %65, %66
%68 = call double @llvm.fmuladd.f64(double %63, double %64, double %67)
%69 = load double, double* %17
%70 = load double, double* %17
%71 = call double @llvm.fmuladd.f64(double %69, double %70, double %68)
%72 = call double @exp(double %71)
%73 = fmul double %62, %72
%74 = load double*, double** %12
%75 = load i32, i32* %13
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %74, i64 %76
store double %73, double* %77
br label %78
78: ; preds = %25
%79 = load i32, i32* %13
%80 = add nsw i32 %79, 1
store i32 %80, i32* %13
br label %21
81: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
define i32 @poissonsEquationExp3D(i32* nocapture readnone %0, double* nocapture %1, i32 %2, double %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = load double, double* %1
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %39
9: ; preds = %6
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %37, %11 ]
%13 = mul nuw nsw i64 %12, 3
%14 = getelementptr inbounds double, double* %4, i64 %13
%15 = load double, double* %14
%16 = add nuw nsw i64 %13, 1
%17 = getelementptr inbounds double, double* %4, i64 %16
%18 = load double, double* %17
%19 = add nuw nsw i64 %13, 2
%20 = getelementptr inbounds double, double* %4, i64 %19
%21 = load double, double* %20
%22 = fmul double %7, %15
%23 = fsub double 1.000000e+00, %15
%24 = fmul double %22, %23
%25 = fmul double %18, %24
%26 = fsub double 1.000000e+00, %18
%27 = fmul double %26, %25
%28 = fmul double %21, %27
%29 = fsub double 1.000000e+00, %21
%30 = fmul double %29, %28
%31 = fmul double %18, %18
%32 = tail call double @llvm.fmuladd.f64(double %15, double %15, double %31)
%33 = tail call double @llvm.fmuladd.f64(double %21, double %21, double %32)
%34 = tail call double @exp(double %33)
%35 = fmul double %34, %30
%36 = getelementptr inbounds double, double* %5, i64 %12
store double %35, double* %36
%37 = add nuw nsw i64 %12, 1
%38 = icmp eq i64 %37, %10
br i1 %38, label %39, label %11
39: ; preds = %11, %6
ret i32 0
}