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


x86 assembly (clang, -O0):
<poissonsEquationExp2D_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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    1388 <poissonsEquationExp2D_r+0x268>
mov    -0x28(%rbp),%rax
imul   $0x3,-0x3c(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%rax
imul   $0x3,-0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
subsd  -0x58(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe3d(%rip),%xmm1
subsd  -0x50(%rbp),%xmm1
movsd  0xe40(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  0xe12(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdd9(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  0xdc4(%rip),%xmm2
subsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xda7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xd99(%rip),%xmm1
subsd  -0x50(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd83(%rip),%xmm1
subsd  -0x58(%rbp),%xmm1
movsd  0xd86(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
movsd  -0x88(%rbp),%xmm5
ff
movsd  -0x80(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm3
movaps %xmm0,%xmm6
movsd  -0x68(%rbp),%xmm0
movsd  0xd44(%rip),%xmm4
mulsd  -0x58(%rbp),%xmm4
mulsd  -0x58(%rbp),%xmm4
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm6,%xmm5
addsd  %xmm4,%xmm5
movsd  0xd0b(%rip),%xmm4
mulsd  -0x58(%rbp),%xmm4
movsd  0xcf6(%rip),%xmm6
subsd  -0x58(%rbp),%xmm6
mulsd  %xmm6,%xmm4
addsd  %xmm5,%xmm4
movsd  0xcd9(%rip),%xmm5
subsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%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    1162 <poissonsEquationExp2D_r+0x42>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poissonsEquationExp2D_r>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %edx,%edx
jle    12c3 <poissonsEquationExp2D_r+0x1a3>
mov    %r9,%r14
mov    %rcx,%r12
movsd  (%rsi),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %edx,%r15d
add    $0x8,%r12
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  -0x8(%r12),%xmm3
movsd  (%r12),%xmm2
movsd  %xmm2,0x20(%rsp)
movsd  0xe95(%rip),%xmm0
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x28(%rsp)
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
movsd  %xmm3,0x18(%rsp)
subsd  %xmm3,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm0,%xmm2
movsd  0xe6a(%rip),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm3,%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
movsd  0x18(%rsp),%xmm3
movapd %xmm3,%xmm1
movsd  0xe48(%rip),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm3,%xmm2
movsd  0xe32(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  0xe21(%rip),%xmm0
addsd  %xmm0,%xmm2
mulsd  0x10(%rsp),%xmm2
movsd  %xmm2,0x10(%rsp)
mulsd  %xmm3,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  0xde2(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
movsd  0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
mulsd  0xdc2(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm2,%xmm1
mulsd  0xdb0(%rip),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm1
addsd  0xda6(%rip),%xmm1
mulsd  (%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mulsd  %xmm2,%xmm2
movsd  0x18(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
add    $0x18,%r12
cmp    %rbx,%r15
jne    1150 <poissonsEquationExp2D_r+0x30>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @poissonsEquationExp2D_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
%18 = 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
%19 = load double*, double** %9
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
store double %21, double* %16
store i32 0, i32* %15
br label %22
22: ; preds = %99, %7
%23 = load i32, i32* %15
%24 = load i32, i32* %10
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %102
26: ; preds = %22
%27 = load double*, double** %12
%28 = load i32, i32* %15
%29 = mul nsw i32 %28, 3
%30 = add nsw i32 %29, 0
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %27, i64 %31
%33 = load double, double* %32
store double %33, double* %17
%34 = load double*, double** %12
%35 = load i32, i32* %15
%36 = mul nsw i32 %35, 3
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %34, i64 %38
%40 = load double, double* %39
store double %40, double* %18
%41 = load double, double* %16
%42 = load double, double* %18
%43 = load double, double* %18
%44 = fsub double 1.000000e+00, %43
%45 = fmul double %42, %44
%46 = load double, double* %17
%47 = fsub double 1.000000e+00, %46
%48 = fmul double 4.000000e+00, %47
%49 = load double, double* %17
%50 = call double @pow(double %49, i32 3)
%51 = load double, double* %17
%52 = fmul double 4.000000e+00, %51
%53 = load double, double* %17
%54 = fmul double %52, %53
%55 = fneg double %54
%56 = call double @llvm.fmuladd.f64(double %48, double %50, double %55)
%57 = load double, double* %17
%58 = fmul double 6.000000e+00, %57
%59 = load double, double* %17
%60 = fsub double 1.000000e+00, %59
%61 = call double @llvm.fmuladd.f64(double %58, double %60, double %56)
%62 = fsub double %61, 2.000000e+00
%63 = load double, double* %17
%64 = load double, double* %17
%65 = fsub double 1.000000e+00, %64
%66 = fmul double %63, %65
%67 = load double, double* %18
%68 = fsub double 1.000000e+00, %67
%69 = fmul double 4.000000e+00, %68
%70 = load double, double* %18
%71 = call double @pow(double %70, i32 3)
%72 = load double, double* %18
%73 = fmul double 4.000000e+00, %72
%74 = load double, double* %18
%75 = fmul double %73, %74
%76 = fneg double %75
%77 = call double @llvm.fmuladd.f64(double %69, double %71, double %76)
%78 = load double, double* %18
%79 = fmul double 6.000000e+00, %78
%80 = load double, double* %18
%81 = fsub double 1.000000e+00, %80
%82 = call double @llvm.fmuladd.f64(double %79, double %81, double %77)
%83 = fsub double %82, 2.000000e+00
%84 = fmul double %66, %83
%85 = call double @llvm.fmuladd.f64(double %45, double %62, double %84)
%86 = fmul double %41, %85
%87 = load double, double* %17
%88 = load double, double* %17
%89 = load double, double* %18
%90 = load double, double* %18
%91 = fmul double %89, %90
%92 = call double @llvm.fmuladd.f64(double %87, double %88, double %91)
%93 = call double @exp(double %92)
%94 = fmul double %86, %93
%95 = load double*, double** %14
%96 = load i32, i32* %15
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
store double %94, double* %98
br label %99
99: ; preds = %26
%100 = load i32, i32* %15
%101 = add nsw i32 %100, 1
store i32 %101, i32* %15
br label %22
102: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
define i32 @poissonsEquationExp2D_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 %50
10: ; preds = %7
%11 = zext i32 %2 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %48, %12 ]
%14 = mul nuw nsw i64 %13, 3
%15 = getelementptr inbounds double, double* %4, i64 %14
%16 = load double, double* %15
%17 = add nuw nsw i64 %14, 1
%18 = getelementptr inbounds double, double* %4, i64 %17
%19 = load double, double* %18
%20 = fsub double 1.000000e+00, %19
%21 = fmul double %19, %20
%22 = fsub double 1.000000e+00, %16
%23 = fmul double %22, 4.000000e+00
%24 = tail call double @pow(double %16, i32 3)
%25 = fmul double %16, -4.000000e+00
%26 = fmul double %16, %25
%27 = tail call double @llvm.fmuladd.f64(double %23, double %24, double %26)
%28 = fmul double %16, 6.000000e+00
%29 = tail call double @llvm.fmuladd.f64(double %28, double %22, double %27)
%30 = fadd double %29, -2.000000e+00
%31 = fmul double %16, %22
%32 = fmul double %20, 4.000000e+00
%33 = tail call double @pow(double %19, i32 3)
%34 = fmul double %19, -4.000000e+00
%35 = fmul double %19, %34
%36 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %35)
%37 = fmul double %19, 6.000000e+00
%38 = tail call double @llvm.fmuladd.f64(double %37, double %20, double %36)
%39 = fadd double %38, -2.000000e+00
%40 = fmul double %31, %39
%41 = tail call double @llvm.fmuladd.f64(double %21, double %30, double %40)
%42 = fmul double %8, %41
%43 = fmul double %19, %19
%44 = tail call double @llvm.fmuladd.f64(double %16, double %16, double %43)
%45 = tail call double @exp(double %44)
%46 = fmul double %45, %42
%47 = getelementptr inbounds double, double* %6, i64 %13
store double %46, double* %47
%48 = add nuw nsw i64 %13, 1
%49 = icmp eq i64 %48, %11
br i1 %49, label %50, label %12
50: ; preds = %12, %7
ret i32 0
}