#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 */
int pow(double, int);
scalar_t__ sqrt(double);
void analyticMode_cpu(double *dEr, double *r, double cut, int *item_to_type,
                      int num_samples_r, double *EPS, double *SIG, int width,
                      int height, int x, int y) {
  if (x == y || r[y * width + x] >= cut) {
    dEr[y * width + x] = 0;
    return;
  }
  int type_i = item_to_type[x];
  int type_j = item_to_type[y];
  double sig12 = (double)(SIG[type_i] + SIG[type_j]) / 2;
  double eps12 = (double)sqrt(EPS[type_i] * EPS[type_j]);
  dEr[y * width + x] = (double)24.0 * eps12 *
                       (pow(sig12, 6) / pow(r[y * width + x], 7) -
                        2 * pow(sig12, 12) / pow(r[y * width + x], 13));
}


x86 assembly (clang, -O0):
<analyticMode_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    0x20(%rbp),%eax
cmp    0x28(%rbp),%eax
je     117d <analyticMode_cpu+0x5d>
mov    -0x10(%rbp),%rax
mov    0x28(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     119b <analyticMode_cpu+0x7b>
mov    -0x8(%rbp),%rax
mov    0x28(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    0x20(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    12c1 <analyticMode_cpu+0x1a1>
mov    -0x20(%rbp),%rax
movslq 0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
movslq 0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x40(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  0xe2f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1040 <sqrt@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xded(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x6,%edi
call   1030 <pow@plt>
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x7,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x54(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0xc,%edi
call   1030 <pow@plt>
shl    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0xd,%edi
call   1030 <pow@plt>
movsd  -0x60(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    0x28(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analyticMode_cpu>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r12
mov    %rdi,%r14
mov    0x58(%rsp),%eax
mov    0x50(%rsp),%ecx
mov    0x40(%rsp),%esi
imul   %eax,%esi
add    %ecx,%esi
movslq %esi,%rbx
xorpd  %xmm1,%xmm1
cmp    %eax,%ecx
je     1215 <analyticMode_cpu+0xf5>
movsd  (%r12,%rbx,8),%xmm2
ucomisd %xmm0,%xmm2
jae    1215 <analyticMode_cpu+0xf5>
movslq %ecx,%rcx
movslq (%rdx,%rcx,4),%rcx
cltq
movslq (%rdx,%rax,4),%rax
movsd  (%r9,%rcx,8),%xmm0
addsd  (%r9,%rax,8),%xmm0
mulsd  0xe7d(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%r8,%rcx,8),%xmm0
mulsd  (%r8,%rax,8),%xmm0
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mulsd  0xe5f(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mov    $0x6,%edi
call   1030 <pow@plt>
mov    %eax,%ebp
movsd  (%r12,%rbx,8),%xmm0
mov    $0x7,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%r15d
movsd  (%rsp),%xmm0
mov    $0xc,%edi
call   1030 <pow@plt>
mov    %eax,%ebp
add    %eax,%ebp
movsd  (%r12,%rbx,8),%xmm0
mov    $0xd,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
sub    %eax,%r15d
xorps  %xmm1,%xmm1
cvtsi2sd %r15d,%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  %xmm1,(%r14,%rbx,8)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @analyticMode_cpu(double* nocapture writeonly %0, double* nocapture %1, double %2, i32* nocapture %3, i32 %4, double* nocapture %5, double* nocapture %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = icmp eq i32 %9, %10
%13 = mul nsw i32 %10, %7
%14 = add nsw i32 %13, %9
%15 = sext i32 %14 to i64
br i1 %12, label %55, label %16
16: ; preds = %11
%17 = getelementptr inbounds double, double* %1, i64 %15
%18 = load double, double* %17
%19 = fcmp ult double %18, %2
br i1 %19, label %20, label %55
20: ; preds = %16
%21 = sext i32 %9 to i64
%22 = getelementptr inbounds i32, i32* %3, i64 %21
%23 = load i32, i32* %22
%24 = sext i32 %10 to i64
%25 = getelementptr inbounds i32, i32* %3, i64 %24
%26 = load i32, i32* %25
%27 = sext i32 %23 to i64
%28 = getelementptr inbounds double, double* %6, i64 %27
%29 = load double, double* %28
%30 = sext i32 %26 to i64
%31 = getelementptr inbounds double, double* %6, i64 %30
%32 = load double, double* %31
%33 = fadd double %29, %32
%34 = fmul double %33, 5.000000e-01
%35 = getelementptr inbounds double, double* %5, i64 %27
%36 = load double, double* %35
%37 = getelementptr inbounds double, double* %5, i64 %30
%38 = load double, double* %37
%39 = fmul double %36, %38
%40 = tail call i64 @sqrt(double %39)
%41 = sitofp i64 %40 to double
%42 = fmul double %41, 2.400000e+01
%43 = tail call i32 @pow(double %34, i32 6)
%44 = load double, double* %17
%45 = tail call i32 @pow(double %44, i32 7)
%46 = sdiv i32 %43, %45
%47 = tail call i32 @pow(double %34, i32 12)
%48 = shl nsw i32 %47, 1
%49 = load double, double* %17
%50 = tail call i32 @pow(double %49, i32 13)
%51 = sdiv i32 %48, %50
%52 = sub nsw i32 %46, %51
%53 = sitofp i32 %52 to double
%54 = fmul double %42, %53
br label %55
55: ; preds = %16, %11, %20
%56 = phi double [ %54, %20 ], [ 0.000000e+00, %11 ], [ 0.000000e+00, %16 ]
%57 = getelementptr inbounds double, double* %0, i64 %15
store double %56, double* %57
ret void
}