#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 fabs(double const);
double fmax(double, double);
double const pow(double, double const);
void diffusiveWave1DEvaluate(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;
    hold = u[i] - x[i * 3 + 2];
    depth = fmax(hold, 0.0);
    hold = fabs(grad_u[i]);
    a[i] = (pow(depth, alpha)) / (pow(hold, 1.0 - gamma) + epsilon);
    da[i] =
        (alpha * pow(depth, alpha - 1.0)) / (pow(hold, 1.0 - gamma) + epsilon);
  }
}


x86 assembly (clang, -O0):
<diffusiveWave1DEvaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12b0 <diffusiveWave1DEvaluate+0x1a0>
mov    -0x30(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  0xe6a(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
imul   $0x3,-0x4c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
maxsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xe2b(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xdf1(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xdad(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xd86(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1160 <diffusiveWave1DEvaluate+0x50>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diffusiveWave1DEvaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm0,0x10(%rsp)
test   %edi,%edi
jle    126a <diffusiveWave1DEvaluate+0x15a>
mov    %r9,%r15
mov    %r8,%r12
mov    %rcx,%rbp
mov    %rdx,%r13
mov    %rsi,%rbx
movsd  0xebd(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xeb3(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %edi,%eax
mov    %rax,0x28(%rsp)
add    $0x10,%rbx
xor    %r14d,%r14d
movsd  %xmm2,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%r13,%r14,8),%xmm0
movsd  %xmm0,(%r12,%r14,8)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r15,%r14,8)
movsd  0x0(%r13,%r14,8),%xmm0
subsd  (%rbx),%xmm0
maxsd  0xe62(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x0(%rbp,%r14,8),%xmm1
andps  0xe5e(%rip),%xmm1
movaps %xmm1,0x40(%rsp)
movsd  0x10(%rsp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,0x38(%rsp)
movapd 0x40(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1030 <pow@plt>
addsd  0x20(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    0x90(%rsp),%rax
movsd  %xmm1,(%rax,%r14,8)
movsd  0x8(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x40(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x20(%rsp),%xmm2
addsd  %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    0x98(%rsp),%rax
movsd  %xmm1,(%rax,%r14,8)
add    $0x1,%r14
add    $0x18,%rbx
cmp    %r14,0x28(%rsp)
jne    1180 <diffusiveWave1DEvaluate+0x70>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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