#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);
void calculateNumericalDiffusionEikonal(int nElements_global,
                                        int nQuadraturePoints_element,
                                        double shockCapturingDiffusion,
                                        double *elementDiameter,
                                        double *strong_residual,
                                        double *numDiff) {
  int eN, k;
  double h;
  for (eN = 0; eN < nElements_global; eN++) {
    h = elementDiameter[eN];
    for (k = 0; k < nQuadraturePoints_element; k++) {
      numDiff[eN * nQuadraturePoints_element + k] =
          shockCapturingDiffusion * 0.5 * h *
          fabs(strong_residual[eN * nQuadraturePoints_element + k]);
    }
  }
}


x86 assembly (clang, -O0):
<calculateNumericalDiffusionEikonal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c1 <calculateNumericalDiffusionEikonal+0xc1>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ae <calculateNumericalDiffusionEikonal+0xae>
movsd  0xeb5(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xe7e(%rip),%xmm2
pand   %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1147 <calculateNumericalDiffusionEikonal+0x47>
jmp    11b3 <calculateNumericalDiffusionEikonal+0xb3>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1122 <calculateNumericalDiffusionEikonal+0x22>
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateNumericalDiffusionEikonal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,-0x40(%rsp)
test   %edi,%edi
jle    139b <calculateNumericalDiffusionEikonal+0x29b>
mov    %r8,%r12
mulsd  0xede(%rip),%xmm0
movslq %esi,%r8
mov    %edi,%eax
mov    %rax,-0x8(%rsp)
mov    %r8d,%r13d
mov    %r13d,%eax
and    $0xfffffffc,%eax
mov    %rax,-0x18(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x20(%rsp)
mov    %rax,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,-0x28(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,-0x30(%rsp)
mov    %r13,%rax
neg    %rax
mov    %rax,-0x10(%rsp)
lea    0x30(%r12),%rbx
lea    0x0(,%r8,8),%r9
mov    -0x40(%rsp),%rax
lea    0x30(%rax),%rbp
lea    0x8(%rax),%r14
lea    0x8(%r12),%r11
xor    %r15d,%r15d
movapd 0xe7c(%rip),%xmm1
movapd 0xe74(%rip),%xmm2
mov    %r8,-0x38(%rsp)
jmp    11cb <calculateNumericalDiffusionEikonal+0xcb>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15
add    %r9,%rbx
add    %r9,%rbp
add    %r9,%r14
add    %r9,%r11
cmp    -0x8(%rsp),%r15
je     139b <calculateNumericalDiffusionEikonal+0x29b>
test   %esi,%esi
jle    11b0 <calculateNumericalDiffusionEikonal+0xb0>
mov    %r15,%r10
imul   %r8,%r10
movsd  (%rdx,%r15,8),%xmm3
mulsd  %xmm0,%xmm3
cmp    $0x4,%esi
jae    11f0 <calculateNumericalDiffusionEikonal+0xf0>
xor    %eax,%eax
jmp    1310 <calculateNumericalDiffusionEikonal+0x210>
nopl   0x0(%rax)
mov    %rdx,%rcx
lea    (%r10,%r13,1),%rdx
mov    %r12,%r8
lea    (%r12,%r10,8),%r12
mov    -0x40(%rsp),%rax
lea    (%rax,%rdx,8),%rdi
cmp    %rdi,%r12
jae    122b <calculateNumericalDiffusionEikonal+0x12b>
mov    %r8,%r12
lea    (%r8,%rdx,8),%rdx
lea    (%rax,%r10,8),%rdi
cmp    %rdx,%rdi
jae    122b <calculateNumericalDiffusionEikonal+0x12b>
xor    %eax,%eax
mov    %rcx,%rdx
mov    -0x38(%rsp),%r8
jmp    1310 <calculateNumericalDiffusionEikonal+0x210>
movapd %xmm3,%xmm4
unpcklpd %xmm3,%xmm4
cmpq   $0x0,-0x20(%rsp)
je     1388 <calculateNumericalDiffusionEikonal+0x288>
mov    -0x30(%rsp),%rdx
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
movupd -0x30(%rbp,%r12,8),%xmm5
movupd -0x20(%rbp,%r12,8),%xmm6
andpd  %xmm2,%xmm5
andpd  %xmm2,%xmm6
mulpd  %xmm4,%xmm5
mulpd  %xmm4,%xmm6
movupd %xmm5,-0x30(%rbx,%r12,8)
movupd %xmm6,-0x20(%rbx,%r12,8)
movupd -0x10(%rbp,%r12,8),%xmm5
movupd 0x0(%rbp,%r12,8),%xmm6
andpd  %xmm2,%xmm5
andpd  %xmm2,%xmm6
mulpd  %xmm4,%xmm5
mulpd  %xmm4,%xmm6
movupd %xmm5,-0x10(%rbx,%r12,8)
movupd %xmm6,(%rbx,%r12,8)
add    $0x8,%r12
add    $0xfffffffffffffffe,%rdx
jne    1250 <calculateNumericalDiffusionEikonal+0x150>
testb  $0x1,-0x28(%rsp)
je     12ed <calculateNumericalDiffusionEikonal+0x1ed>
add    %r10,%r12
mov    -0x40(%rsp),%rax
movupd (%rax,%r12,8),%xmm5
movupd 0x10(%rax,%r12,8),%xmm6
andpd  %xmm2,%xmm5
andpd  %xmm2,%xmm6
mulpd  %xmm4,%xmm5
mulpd  %xmm4,%xmm6
mov    %r8,%rax
movupd %xmm5,(%r8,%r12,8)
movupd %xmm6,0x10(%r8,%r12,8)
mov    -0x18(%rsp),%rdx
mov    %rdx,%rax
cmp    %r13,%rdx
mov    %rcx,%rdx
mov    %r8,%r12
mov    -0x38(%rsp),%r8
je     11b0 <calculateNumericalDiffusionEikonal+0xb0>
nopl   0x0(%rax)
mov    %rax,%rdi
test   $0x1,%r13b
je     133c <calculateNumericalDiffusionEikonal+0x23c>
add    %rax,%r10
mov    -0x40(%rsp),%rcx
movsd  (%rcx,%r10,8),%xmm4
andpd  %xmm2,%xmm4
mulsd  %xmm3,%xmm4
movsd  %xmm4,(%r12,%r10,8)
mov    %rax,%rdi
or     $0x1,%rdi
not    %rax
cmp    -0x10(%rsp),%rax
je     11b0 <calculateNumericalDiffusionEikonal+0xb0>
nopw   0x0(%rax,%rax,1)
movsd  -0x8(%r14,%rdi,8),%xmm4
andpd  %xmm1,%xmm4
mulsd  %xmm3,%xmm4
movsd  %xmm4,-0x8(%r11,%rdi,8)
movsd  (%r14,%rdi,8),%xmm4
andpd  %xmm1,%xmm4
mulsd  %xmm3,%xmm4
movsd  %xmm4,(%r11,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%r13
jne    1350 <calculateNumericalDiffusionEikonal+0x250>
jmp    11b0 <calculateNumericalDiffusionEikonal+0xb0>
xor    %r12d,%r12d
testb  $0x1,-0x28(%rsp)
jne    12b8 <calculateNumericalDiffusionEikonal+0x1b8>
jmp    12ed <calculateNumericalDiffusionEikonal+0x1ed>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @calculateNumericalDiffusionEikonal(i32 %0, i32 %1, double %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %140
8: ; preds = %6
%9 = icmp sgt i32 %1, 0
%10 = fmul double %2, 5.000000e-01
%11 = sext i32 %1 to i64
%12 = zext i32 %0 to i64
%13 = zext i32 %1 to i64
%14 = and i64 %13, 4294967292
%15 = add nsw i64 %14, -4
%16 = lshr exact i64 %15, 2
%17 = add nuw nsw i64 %16, 1
%18 = icmp ult i32 %1, 4
%19 = and i64 %13, 4294967292
%20 = and i64 %17, 1
%21 = icmp eq i64 %15, 0
%22 = and i64 %17, 9223372036854775806
%23 = icmp eq i64 %20, 0
%24 = icmp eq i64 %19, %13
%25 = and i64 %13, 1
%26 = icmp eq i64 %25, 0
%27 = sub nsw i64 0, %13
br label %28
28: ; preds = %8, %137
%29 = phi i64 [ 0, %8 ], [ %138, %137 ]
%30 = mul i64 %29, %11
%31 = getelementptr double, double* %5, i64 %30
%32 = add i64 %30, %13
%33 = getelementptr double, double* %5, i64 %32
%34 = getelementptr double, double* %4, i64 %30
%35 = getelementptr double, double* %4, i64 %32
br i1 %9, label %36, label %137
36: ; preds = %28
%37 = getelementptr inbounds double, double* %3, i64 %29
%38 = load double, double* %37
%39 = fmul double %10, %38
%40 = mul nsw i64 %29, %11
br i1 %18, label %106, label %41
41: ; preds = %36
%42 = icmp ult double* %31, %35
%43 = icmp ult double* %34, %33
%44 = and i1 %42, %43
br i1 %44, label %106, label %45
45: ; preds = %41
%46 = insertelement <2 x double> poison, double %39, i64 0
%47 = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> zeroinitializer
%48 = insertelement <2 x double> poison, double %39, i64 0
%49 = shufflevector <2 x double> %48, <2 x double> poison, <2 x i32> zeroinitializer
br i1 %21, label %87, label %50
50: ; preds = %45, %50
%51 = phi i64 [ %84, %50 ], [ 0, %45 ]
%52 = phi i64 [ %85, %50 ], [ 0, %45 ]
%53 = add nsw i64 %51, %40
%54 = getelementptr inbounds double, double* %4, i64 %53
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds double, double* %54, i64 2
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %56)
%61 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %59)
%62 = fmul <2 x double> %47, %60
%63 = fmul <2 x double> %49, %61
%64 = getelementptr inbounds double, double* %5, i64 %53
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %62, <2 x double>* %65
%66 = getelementptr inbounds double, double* %64, i64 2
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> %63, <2 x double>* %67
%68 = or i64 %51, 4
%69 = add nsw i64 %68, %40
%70 = getelementptr inbounds double, double* %4, i64 %69
%71 = bitcast double* %70 to <2 x double>*
%72 = load <2 x double>, <2 x double>* %71
%73 = getelementptr inbounds double, double* %70, i64 2
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %72)
%77 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %75)
%78 = fmul <2 x double> %47, %76
%79 = fmul <2 x double> %49, %77
%80 = getelementptr inbounds double, double* %5, i64 %69
%81 = bitcast double* %80 to <2 x double>*
store <2 x double> %78, <2 x double>* %81
%82 = getelementptr inbounds double, double* %80, i64 2
%83 = bitcast double* %82 to <2 x double>*
store <2 x double> %79, <2 x double>* %83
%84 = add nuw i64 %51, 8
%85 = add i64 %52, 2
%86 = icmp eq i64 %85, %22
br i1 %86, label %87, label %50
87: ; preds = %50, %45
%88 = phi i64 [ 0, %45 ], [ %84, %50 ]
br i1 %23, label %105, label %89
89: ; preds = %87
%90 = add nsw i64 %88, %40
%91 = getelementptr inbounds double, double* %4, i64 %90
%92 = bitcast double* %91 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = getelementptr inbounds double, double* %91, i64 2
%95 = bitcast double* %94 to <2 x double>*
%96 = load <2 x double>, <2 x double>* %95
%97 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %93)
%98 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %96)
%99 = fmul <2 x double> %47, %97
%100 = fmul <2 x double> %49, %98
%101 = getelementptr inbounds double, double* %5, i64 %90
%102 = bitcast double* %101 to <2 x double>*
store <2 x double> %99, <2 x double>* %102
%103 = getelementptr inbounds double, double* %101, i64 2
%104 = bitcast double* %103 to <2 x double>*
store <2 x double> %100, <2 x double>* %104
br label %105
105: ; preds = %87, %89
br i1 %24, label %137, label %106
106: ; preds = %41, %36, %105
%107 = phi i64 [ 0, %41 ], [ 0, %36 ], [ %19, %105 ]
%108 = xor i64 %107, -1
br i1 %26, label %117, label %109
109: ; preds = %106
%110 = add nsw i64 %107, %40
%111 = getelementptr inbounds double, double* %4, i64 %110
%112 = load double, double* %111
%113 = tail call double @llvm.fabs.f64(double %112)
%114 = fmul double %39, %113
%115 = getelementptr inbounds double, double* %5, i64 %110
store double %114, double* %115
%116 = or i64 %107, 1
br label %117
117: ; preds = %109, %106
%118 = phi i64 [ %107, %106 ], [ %116, %109 ]
%119 = icmp eq i64 %108, %27
br i1 %119, label %137, label %120
120: ; preds = %117, %120
%121 = phi i64 [ %135, %120 ], [ %118, %117 ]
%122 = add nsw i64 %121, %40
%123 = getelementptr inbounds double, double* %4, i64 %122
%124 = load double, double* %123
%125 = tail call double @llvm.fabs.f64(double %124)
%126 = fmul double %39, %125
%127 = getelementptr inbounds double, double* %5, i64 %122
store double %126, double* %127
%128 = add nuw nsw i64 %121, 1
%129 = add nsw i64 %128, %40
%130 = getelementptr inbounds double, double* %4, i64 %129
%131 = load double, double* %130
%132 = tail call double @llvm.fabs.f64(double %131)
%133 = fmul double %39, %132
%134 = getelementptr inbounds double, double* %5, i64 %129
store double %133, double* %134
%135 = add nuw nsw i64 %121, 2
%136 = icmp eq i64 %135, %13
br i1 %136, label %137, label %120
137: ; preds = %117, %120, %105, %28
%138 = add nuw nsw i64 %29, 1
%139 = icmp eq i64 %138, %12
br i1 %139, label %140, label %28
140: ; preds = %137, %6
ret void
}