#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);
double pow(double, double);
int poissonsEquationExp1D_r(int *iwork, double *rwork, int nPoints, double t,
                            double *X, double *u, double *r) {
  int i = 0;
  double K = rwork[0];
  double x;
  for (i = 0; i < nPoints; i++) {
    x = X[i * 3 + 0];
    r[i] = K *
           (4.0 * (1.0 - x) * pow(x, 3.0) - 4.0 * x * x + 6.0 * (1.0 - x) * x -
            2.0) *
           exp(x * x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<poissonsEquationExp1D_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    126c <poissonsEquationExp1D_r+0x14c>
mov    -0x28(%rbp),%rax
imul   $0x3,-0x3c(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe7b(%rip),%xmm1
subsd  -0x50(%rbp),%xmm1
movsd  0xe76(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xe68(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x68(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x60(%rbp),%xmm0
movsd  0xe46(%rip),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0xe0d(%rip),%xmm3
subsd  -0x50(%rbp),%xmm3
movsd  0xdf8(%rip),%xmm1
mulsd  %xmm3,%xmm1
movsd  -0x50(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0xdd7(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    115f <poissonsEquationExp1D_r+0x3f>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poissonsEquationExp1D_r>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %edx,%edx
jle    1201 <poissonsEquationExp1D_r+0xe1>
mov    %r9,%r14
mov    %rcx,%r12
movsd  (%rsi),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %edx,%r15d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  (%r12),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xe9c(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  0xe92(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movapd %xmm1,%xmm0
movsd  0xe88(%rip),%xmm1
call   1040 <pow@plt>
movsd  0x18(%rsp),%xmm2
movapd %xmm2,%xmm1
mulsd  0xe79(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xe65(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
addsd  0xe5d(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm2,%xmm2
movapd %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
add    $0x18,%r12
cmp    %rbx,%r15
jne    1150 <poissonsEquationExp1D_r+0x30>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @poissonsEquationExp1D_r(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5, double* %6) {
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32
%11 = alloca double
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca double
%17 = alloca double
store i32* %0, i32** %8
store double* %1, double** %9
store i32 %2, i32* %10
store double %3, double* %11
store double* %4, double** %12
store double* %5, double** %13
store double* %6, double** %14
store i32 0, i32* %15
%18 = load double*, double** %9
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
store double %20, double* %16
store i32 0, i32* %15
br label %21
21: ; preds = %61, %7
%22 = load i32, i32* %15
%23 = load i32, i32* %10
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %64
25: ; preds = %21
%26 = load double*, double** %12
%27 = load i32, i32* %15
%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* %17
%33 = load double, double* %16
%34 = load double, double* %17
%35 = fsub double 1.000000e+00, %34
%36 = fmul double 4.000000e+00, %35
%37 = load double, double* %17
%38 = call double @pow(double %37, double 3.000000e+00)
%39 = load double, double* %17
%40 = fmul double 4.000000e+00, %39
%41 = load double, double* %17
%42 = fmul double %40, %41
%43 = fneg double %42
%44 = call double @llvm.fmuladd.f64(double %36, double %38, double %43)
%45 = load double, double* %17
%46 = fsub double 1.000000e+00, %45
%47 = fmul double 6.000000e+00, %46
%48 = load double, double* %17
%49 = call double @llvm.fmuladd.f64(double %47, double %48, double %44)
%50 = fsub double %49, 2.000000e+00
%51 = fmul double %33, %50
%52 = load double, double* %17
%53 = load double, double* %17
%54 = fmul double %52, %53
%55 = call double @exp(double %54)
%56 = fmul double %51, %55
%57 = load double*, double** %14
%58 = load i32, i32* %15
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
store double %56, double* %60
br label %61
61: ; preds = %25
%62 = load i32, i32* %15
%63 = add nsw i32 %62, 1
store i32 %63, i32* %15
br label %21
64: ; preds = %21
ret i32 0
}

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