#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 fmax(double const, double);
double const pow(double, double const);
double sqrt(double const);
void diffusiveWave2DEvaluate(const int nd, const int nPoints,
                             const double alpha, const double gamma,
                             const double epsilon, const double *x,
                             const double *u, const double *grad_u, double *m,
                             double *dm, double *a, double *da) {
  int i;
  double depth = 0.0;
  double hold = 0.0;
  for (i = 0; i < nPoints; i++) {
    m[i] = u[i];
    dm[i] = 1.0;
    depth = fmax(u[i] - x[i * 3 + 2], 0.0);
    hold = sqrt(grad_u[2 * i] * grad_u[2 * i] +
                grad_u[2 * i + 1] * grad_u[2 * i + 1]);
    a[i * 4] = a[i * 4 + 3] =
        (pow(depth, alpha)) / (pow(hold, 1.0 - gamma) + epsilon);
    da[i * 4] = da[i * 4 + 3] =
        (alpha * pow(depth, alpha - 1.0)) / (pow(hold, 1.0 - gamma) + epsilon);
  }
}


x86 assembly (clang, -O0):
<diffusiveWave2DEvaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x20(%rbp),%rax
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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    132d <diffusiveWave2DEvaluate+0x20d>
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
imul   $0x3,-0x44(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
maxsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  0xda8(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x18(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xd4a(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  0xd23(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1170 <diffusiveWave2DEvaluate+0x50>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diffusiveWave2DEvaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x38(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm0,0x10(%rsp)
test   %esi,%esi
jle    12ca <diffusiveWave2DEvaluate+0x1aa>
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbx
mov    0x88(%rsp),%rbp
movsd  0xea0(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0xe96(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %esi,%r14d
add    $0x10,%rbx
shl    $0x3,%r14
xor    %r13d,%r13d
xorpd  %xmm2,%xmm2
jmp    126d <diffusiveWave2DEvaluate+0x14d>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm3,0x8(%rsp)
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
xorpd  %xmm2,%xmm2
movsd  %xmm0,0x18(%rsp)
maxsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
movapd %xmm3,%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1030 <pow@plt>
addsd  0x28(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rbp,%r13,4)
movsd  %xmm1,0x0(%rbp,%r13,4)
movsd  0x8(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1030 <pow@plt>
xorpd  %xmm2,%xmm2
addsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    0x90(%rsp),%rax
movsd  %xmm1,0x18(%rax,%r13,4)
movsd  %xmm1,(%rax,%r13,4)
add    $0x18,%rbx
add    $0x8,%r13
cmp    %r13,%r14
je     12ca <diffusiveWave2DEvaluate+0x1aa>
movsd  (%r12,%r13,1),%xmm0
mov    0x38(%rsp),%rax
movsd  %xmm0,(%rax,%r13,1)
mov    0x80(%rsp),%rax
movabs $0x3ff0000000000000,%rcx
mov    %rcx,(%rax,%r13,1)
movsd  (%r12,%r13,1),%xmm3
subsd  (%rbx),%xmm3
movsd  (%r15,%r13,2),%xmm0
movsd  0x8(%r15,%r13,2),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
jb     11a0 <diffusiveWave2DEvaluate+0x80>
sqrtsd %xmm0,%xmm0
jmp    11b5 <diffusiveWave2DEvaluate+0x95>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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