#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 smoothedHeaviside(double const, double const);
void TwoPhaseInvScaledLaplace_2D_Evaluate(
    const int nPoints, const double eps, const double rho_0, const double nu_0,
    const double rho_1, const double nu_1, const double *phi,
    double *mom_p_diff_ten, double *mom_u_diff_ten, double *mom_v_diff_ten) {
  int k;
  double rho, nu, mu, H;
  for (k = 0; k < nPoints; k++) {
    H = smoothedHeaviside(eps, phi[k]);
    rho = rho_0 * (1.0 - H) + rho_1 * H;
    nu = nu_0 * (1.0 - H) + nu_1 * H;
    mu = rho_0 * nu_0 * (1.0 - H) + rho_1 * nu_1 * H;
    mom_p_diff_ten[k * 2 + 0] = 1.0 / rho;
    mom_p_diff_ten[k * 2 + 1] = 1.0 / rho;
    mom_u_diff_ten[k * 2 + 0] = 1.0 / rho;
    mom_u_diff_ten[k * 2 + 1] = 1.0 / rho;
    mom_v_diff_ten[k * 2 + 0] = 1.0 / rho;
    mom_v_diff_ten[k * 2 + 1] = 1.0 / rho;
  }
}


x86 assembly (clang, -O0):
<TwoPhaseInvScaledLaplace_2D_Evaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12d5 <TwoPhaseInvScaledLaplace_2D_Evaluate+0x1c5>
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <smoothedHeaviside@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm2
subsd  -0x78(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe54(%rip),%xmm2
subsd  -0x78(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe26(%rip),%xmm2
subsd  -0x78(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdfd(%rip),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xddb(%rip),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xdb9(%rip),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xd97(%rip),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xd75(%rip),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x50(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xd53(%rip),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x50(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    114e <TwoPhaseInvScaledLaplace_2D_Evaluate+0x3e>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TwoPhaseInvScaledLaplace_2D_Evaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
jle    11be <TwoPhaseInvScaledLaplace_2D_Evaluate+0xae>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %edi,%r13d
shl    $0x3,%r13
xor    %ebp,%ebp
movsd  %xmm3,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
nopl   0x0(%rax)
movsd  (%r12,%rbp,1),%xmm1
movsd  (%rsp),%xmm0
call   1030 <smoothedHeaviside@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm3
movsd  0xe8c(%rip),%xmm4
movapd %xmm4,%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm4,%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,(%rbx,%rbp,2)
movsd  %xmm0,0x8(%rbx,%rbp,2)
movsd  %xmm0,(%r15,%rbp,2)
movsd  %xmm0,0x8(%r15,%rbp,2)
movsd  %xmm0,(%r14,%rbp,2)
movsd  %xmm0,0x8(%r14,%rbp,2)
add    $0x8,%rbp
cmp    %rbp,%r13
jne    1150 <TwoPhaseInvScaledLaplace_2D_Evaluate+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @TwoPhaseInvScaledLaplace_2D_Evaluate(i32 %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7, double* %8, double* %9) {
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
store i32 %0, i32* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
store double* %9, double** %20
store i32 0, i32* %21
br label %26
26: ; preds = %111, %10
%27 = load i32, i32* %21
%28 = load i32, i32* %11
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %114
30: ; preds = %26
%31 = load double, double* %12
%32 = load double*, double** %17
%33 = load i32, i32* %21
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = call double @smoothedHeaviside(double %31, double %36)
store double %37, double* %25
%38 = load double, double* %13
%39 = load double, double* %25
%40 = fsub double 1.000000e+00, %39
%41 = load double, double* %15
%42 = load double, double* %25
%43 = fmul double %41, %42
%44 = call double @llvm.fmuladd.f64(double %38, double %40, double %43)
store double %44, double* %22
%45 = load double, double* %14
%46 = load double, double* %25
%47 = fsub double 1.000000e+00, %46
%48 = load double, double* %16
%49 = load double, double* %25
%50 = fmul double %48, %49
%51 = call double @llvm.fmuladd.f64(double %45, double %47, double %50)
store double %51, double* %23
%52 = load double, double* %13
%53 = load double, double* %14
%54 = fmul double %52, %53
%55 = load double, double* %25
%56 = fsub double 1.000000e+00, %55
%57 = load double, double* %15
%58 = load double, double* %16
%59 = fmul double %57, %58
%60 = load double, double* %25
%61 = fmul double %59, %60
%62 = call double @llvm.fmuladd.f64(double %54, double %56, double %61)
store double %62, double* %24
%63 = load double, double* %22
%64 = fdiv double 1.000000e+00, %63
%65 = load double*, double** %18
%66 = load i32, i32* %21
%67 = mul nsw i32 %66, 2
%68 = add nsw i32 %67, 0
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %65, i64 %69
store double %64, double* %70
%71 = load double, double* %22
%72 = fdiv double 1.000000e+00, %71
%73 = load double*, double** %18
%74 = load i32, i32* %21
%75 = mul nsw i32 %74, 2
%76 = add nsw i32 %75, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %73, i64 %77
store double %72, double* %78
%79 = load double, double* %22
%80 = fdiv double 1.000000e+00, %79
%81 = load double*, double** %19
%82 = load i32, i32* %21
%83 = mul nsw i32 %82, 2
%84 = add nsw i32 %83, 0
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %81, i64 %85
store double %80, double* %86
%87 = load double, double* %22
%88 = fdiv double 1.000000e+00, %87
%89 = load double*, double** %19
%90 = load i32, i32* %21
%91 = mul nsw i32 %90, 2
%92 = add nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %89, i64 %93
store double %88, double* %94
%95 = load double, double* %22
%96 = fdiv double 1.000000e+00, %95
%97 = load double*, double** %20
%98 = load i32, i32* %21
%99 = mul nsw i32 %98, 2
%100 = add nsw i32 %99, 0
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %97, i64 %101
store double %96, double* %102
%103 = load double, double* %22
%104 = fdiv double 1.000000e+00, %103
%105 = load double*, double** %20
%106 = load i32, i32* %21
%107 = mul nsw i32 %106, 2
%108 = add nsw i32 %107, 1
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double, double* %105, i64 %109
store double %104, double* %110
br label %111
111: ; preds = %30
%112 = load i32, i32* %21
%113 = add nsw i32 %112, 1
store i32 %113, i32* %21
br label %26
114: ; preds = %26
ret void
}

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