#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 smoothedDirac(double, double);
double smoothedHeaviside(double, double);
void levelSetConservationCoefficientsEvaluate(
    int nPoints, int nSpace, double epsHeaviside, double epsDirac,
    double epsDiffusion, double *u_ls, double *H_vof, double *u, double *r,
    double *dr, double *a) {
  int i, I, nSpace2 = nSpace * nSpace;
  for (i = 0; i < nPoints; i++) {
    r[i] = smoothedHeaviside(epsHeaviside, u[i] + u_ls[i]) - H_vof[i];
    dr[i] = smoothedDirac(epsDirac, u[i] + u_ls[i]);
    for (I = 0; I < nSpace; I++)
      a[nSpace2 * i + I * nSpace + I] = epsDiffusion;
  }
}


x86 assembly (clang, -O0):
<levelSetConservationCoefficientsEvaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1239 <levelSetConservationCoefficientsEvaluate+0x119>
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
call   1040 <smoothedHeaviside@plt>
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
call   1030 <smoothedDirac@plt>
mov    0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1226 <levelSetConservationCoefficientsEvaluate+0x106>
movsd  -0x20(%rbp),%xmm0
mov    0x18(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x44(%rbp),%ecx
mov    -0x48(%rbp),%edx
imul   -0x8(%rbp),%edx
add    %edx,%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11e8 <levelSetConservationCoefficientsEvaluate+0xc8>
jmp    122b <levelSetConservationCoefficientsEvaluate+0x10b>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1166 <levelSetConservationCoefficientsEvaluate+0x46>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<levelSetConservationCoefficientsEvaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,0x58(%rsp)
mov    %r8,0x50(%rsp)
mov    %rcx,0x48(%rsp)
mov    %rdx,0x40(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x38(%rsp)
movsd  %xmm0,0x30(%rsp)
test   %edi,%edi
jle    12a2 <levelSetConservationCoefficientsEvaluate+0x182>
mov    %edi,%eax
mov    %rax,0x20(%rsp)
mov    %esi,%r15d
mov    %r15,0x18(%rsp)
and    $0xfffffffe,%r15d
lea    0x1(%rsi),%r14d
mov    %esi,%eax
imul   %esi,%eax
mov    %eax,0xc(%rsp)
lea    (%rsi,%rsi,1),%r12d
add    $0x2,%r12d
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %rsi,0x28(%rsp)
mov    0x50(%rsp),%r13
jmp    11b3 <levelSetConservationCoefficientsEvaluate+0x93>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
add    0xc(%rsp),%ebp
cmp    0x20(%rsp),%rbx
je     12a2 <levelSetConservationCoefficientsEvaluate+0x182>
mov    %rbp,0x60(%rsp)
movsd  0x0(%r13,%rbx,8),%xmm1
mov    0x40(%rsp),%rbp
addsd  0x0(%rbp,%rbx,8),%xmm1
movsd  0x30(%rsp),%xmm0
call   1040 <smoothedHeaviside@plt>
mov    0x48(%rsp),%rax
subsd  (%rax,%rbx,8),%xmm0
mov    0x58(%rsp),%rax
movsd  %xmm0,(%rax,%rbx,8)
movsd  0x0(%r13,%rbx,8),%xmm1
addsd  0x0(%rbp,%rbx,8),%xmm1
movsd  0x38(%rsp),%xmm0
call   1030 <smoothedDirac@plt>
mov    0x60(%rsp),%rbp
mov    0x28(%rsp),%rsi
mov    0xa0(%rsp),%rax
movsd  %xmm0,(%rax,%rbx,8)
test   %esi,%esi
jle    11a0 <levelSetConservationCoefficientsEvaluate+0x80>
cmp    $0x1,%esi
jne    1230 <levelSetConservationCoefficientsEvaluate+0x110>
xor    %eax,%eax
jmp    1270 <levelSetConservationCoefficientsEvaluate+0x150>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%ecx
xor    %eax,%eax
movsd  0x10(%rsp),%xmm0
mov    0xa8(%rsp),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %ecx,%rcx
movsd  %xmm0,(%rdi,%rcx,8)
lea    (%r14,%rcx,1),%edx
movslq %edx,%rdx
movsd  %xmm0,(%rdi,%rdx,8)
add    $0x2,%rax
add    %r12d,%ecx
cmp    %rax,%r15
jne    1250 <levelSetConservationCoefficientsEvaluate+0x130>
testb  $0x1,0x18(%rsp)
je     11a0 <levelSetConservationCoefficientsEvaluate+0x80>
mov    %ebx,%ecx
imul   %esi,%ecx
add    %eax,%ecx
imul   %esi,%ecx
add    %eax,%ecx
movslq %ecx,%rax
movsd  0x10(%rsp),%xmm0
mov    0xa8(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
jmp    11a0 <levelSetConservationCoefficientsEvaluate+0x80>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @levelSetConservationCoefficientsEvaluate(i32 %0, i32 %1, double %2, double %3, double %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture writeonly %8, double* nocapture writeonly %9, double* nocapture writeonly %10) {
%12 = icmp sgt i32 %0, 0
br i1 %12, label %13, label %72
13: ; preds = %11
%14 = icmp sgt i32 %1, 0
%15 = zext i32 %0 to i64
%16 = zext i32 %1 to i64
%17 = and i64 %16, 1
%18 = icmp eq i32 %1, 1
%19 = and i64 %16, 4294967294
%20 = icmp eq i64 %17, 0
br label %21
21: ; preds = %13, %69
%22 = phi i64 [ 0, %13 ], [ %70, %69 ]
%23 = getelementptr inbounds double, double* %7, i64 %22
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %5, i64 %22
%26 = load double, double* %25
%27 = fadd double %24, %26
%28 = tail call double @smoothedHeaviside(double %2, double %27)
%29 = getelementptr inbounds double, double* %6, i64 %22
%30 = load double, double* %29
%31 = fsub double %28, %30
%32 = getelementptr inbounds double, double* %8, i64 %22
store double %31, double* %32
%33 = load double, double* %23
%34 = load double, double* %25
%35 = fadd double %33, %34
%36 = tail call double @smoothedDirac(double %3, double %35)
%37 = getelementptr inbounds double, double* %9, i64 %22
store double %36, double* %37
br i1 %14, label %38, label %69
38: ; preds = %21
%39 = trunc i64 %22 to i32
%40 = mul i32 %39, %1
br i1 %18, label %60, label %41
41: ; preds = %38, %41
%42 = phi i64 [ %57, %41 ], [ 0, %38 ]
%43 = phi i64 [ %58, %41 ], [ 0, %38 ]
%44 = trunc i64 %42 to i32
%45 = add i32 %40, %44
%46 = mul i32 %45, %1
%47 = add i32 %46, %44
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %10, i64 %48
store double %4, double* %49
%50 = trunc i64 %42 to i32
%51 = or i32 %50, 1
%52 = add i32 %40, %51
%53 = mul i32 %52, %1
%54 = add i32 %53, %51
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %10, i64 %55
store double %4, double* %56
%57 = add nuw nsw i64 %42, 2
%58 = add i64 %43, 2
%59 = icmp eq i64 %58, %19
br i1 %59, label %60, label %41
60: ; preds = %41, %38
%61 = phi i64 [ 0, %38 ], [ %57, %41 ]
br i1 %20, label %69, label %62
62: ; preds = %60
%63 = trunc i64 %61 to i32
%64 = add i32 %40, %63
%65 = mul i32 %64, %1
%66 = add i32 %65, %63
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %10, i64 %67
store double %4, double* %68
br label %69
69: ; preds = %62, %60, %21
%70 = add nuw nsw i64 %22, 1
%71 = icmp eq i64 %70, %15
br i1 %71, label %72, label %21
72: ; preds = %69, %11
ret void
}