#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_sd(int nPoints,
                                                 double epsHeaviside,
                                                 double epsDirac, double *u_ls,
                                                 double *H_vof, double *u,
                                                 double *r, double *dr) {
  int i;
  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]);
  }
}


x86 assembly (clang, -O0):
<levelSetConservationCoefficientsEvaluate_sd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d9 <levelSetConservationCoefficientsEvaluate_sd+0xb9>
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
call   1040 <smoothedHeaviside@plt>
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
call   1030 <smoothedDirac@plt>
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1150 <levelSetConservationCoefficientsEvaluate_sd+0x30>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<levelSetConservationCoefficientsEvaluate_sd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
test   %edi,%edi
jle    11af <levelSetConservationCoefficientsEvaluate_sd+0x8f>
mov    %r9,%r15
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x0(%r13,%r14,8),%xmm1
addsd  (%rbx,%r14,8),%xmm1
movsd  (%rsp),%xmm0
call   1040 <smoothedHeaviside@plt>
subsd  (%r12,%r14,8),%xmm0
mov    0x10(%rsp),%rax
movsd  %xmm0,(%rax,%r14,8)
movsd  0x0(%r13,%r14,8),%xmm1
addsd  (%rbx,%r14,8),%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <smoothedDirac@plt>
movsd  %xmm0,(%r15,%r14,8)
add    $0x1,%r14
cmp    %r14,%rbp
jne    1160 <levelSetConservationCoefficientsEvaluate_sd+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @levelSetConservationCoefficientsEvaluate_sd(i32 %0, double %1, double %2, double* %3, double* %4, double* %5, double* %6, double* %7) {
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
store i32 %0, i32* %9
store double %1, double* %10
store double %2, double* %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
store i32 0, i32* %17
br label %18
18: ; preds = %63, %8
%19 = load i32, i32* %17
%20 = load i32, i32* %9
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %66
22: ; preds = %18
%23 = load double, double* %10
%24 = load double*, double** %14
%25 = load i32, i32* %17
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %12
%30 = load i32, i32* %17
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = fadd double %28, %33
%35 = call double @smoothedHeaviside(double %23, double %34)
%36 = load double*, double** %13
%37 = load i32, i32* %17
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = fsub double %35, %40
%42 = load double*, double** %15
%43 = load i32, i32* %17
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
store double %41, double* %45
%46 = load double, double* %11
%47 = load double*, double** %14
%48 = load i32, i32* %17
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %12
%53 = load i32, i32* %17
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = fadd double %51, %56
%58 = call double @smoothedDirac(double %46, double %57)
%59 = load double*, double** %16
%60 = load i32, i32* %17
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %59, i64 %61
store double %58, double* %62
br label %63
63: ; preds = %22
%64 = load i32, i32* %17
%65 = add nsw i32 %64, 1
store i32 %65, i32* %17
br label %18
66: ; preds = %18
ret void
}

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