#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 abs(double);
double atan2(double, double);
int /*<<< orphan*/ compute_evt_plane_avg(double *, int *, int *, double **,
                                         double **, double **, int **);
double cos(int);
double pow(double, double);
double sin(double);
double subMean(int, double, double);
void compute_flow_contrib_rm(int ibin, int *ptCount, int *evCount,
                             double *EventBinFlowContrib,
                             double ptArray[10000][25],
                             double phiArray[10000][25],
                             double rapArray[10000][25],
                             int chArray[10000][25]) {
  int nch = 0;
  int i;
  int nPartsEvtPlane = 0;
  double rapCutFlow = 1.0;
  double evtPlanesAvg[4] = {0.0, 0.0, 0.0, 0.0};
  double evtPlanes[2] = {0.0, 0.0};
  double meanCosVn = 0.0;
  double meanSinVn = 0.0;
  double cosVn = 0.0;
  double sinVn = 0.0;
  double v2Sum = 0.0;
  double v3Sum = 0.0;
  if (ptCount[ibin] > 0) {
    evCount[ibin]++;
    compute_evt_plane_avg(evtPlanesAvg, &nPartsEvtPlane, ptCount, ptArray,
                          phiArray, rapArray, chArray);
    for (i = 0; i < ptCount[ibin]; i++) {
      if (abs(chArray[i][ibin]) > 0 && abs(rapArray[i][ibin]) <= rapCutFlow) {
        nch++;
        cosVn = ptArray[i][ibin] * cos(2.0 * phiArray[i][ibin]);
        sinVn = ptArray[i][ibin] * sin(2.0 * phiArray[i][ibin]);
        meanCosVn = subMean(nPartsEvtPlane, evtPlanesAvg[0], cosVn);
        meanSinVn = subMean(nPartsEvtPlane, evtPlanesAvg[1], sinVn);
        evtPlanes[0] = atan2(meanSinVn, meanCosVn) / 2.0;
        cosVn = ptArray[i][ibin] * cos(3.0 * phiArray[i][ibin]);
        sinVn = ptArray[i][ibin] * sin(3.0 * phiArray[i][ibin]);
        meanCosVn = subMean(nPartsEvtPlane, evtPlanesAvg[2], cosVn);
        meanSinVn = subMean(nPartsEvtPlane, evtPlanesAvg[3], sinVn);
        evtPlanes[1] = atan2(meanSinVn, meanCosVn) / 3.0;
        v2Sum += cos(2 * phiArray[i][ibin] - evtPlanes[0]);
        v3Sum += cos(3 * phiArray[i][ibin] - evtPlanes[1]);
      }
    }
  }
  if (nch > 0) {
    EventBinFlowContrib[0] = v2Sum / (double)nch;
    EventBinFlowContrib[1] = pow(v2Sum / (double)nch, 2.0);
    EventBinFlowContrib[2] = v3Sum / (double)nch;
    EventBinFlowContrib[3] = pow(v3Sum / (double)nch, 2.0);
  } else {
    EventBinFlowContrib[0] = 0.0;
    EventBinFlowContrib[1] = 0.0;
    EventBinFlowContrib[2] = 0.0;
    EventBinFlowContrib[3] = 0.0;
  }
}


x86 assembly (clang, -O0):
<compute_flow_contrib_rm>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x3c(%rbp)
movsd  0xe40(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    160f <compute_flow_contrib_rm+0x48f>
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%rax
lea    -0x3c(%rbp),%rsi
mov    %rax,(%rsp)
call   1070 <compute_evt_plane_avg@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x4(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    160a <compute_flow_contrib_rm+0x48a>
mov    0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
call   1030 <abs@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    15f7 <compute_flow_contrib_rm+0x477>
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     15f7 <compute_flow_contrib_rm+0x477>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  0xcd8(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  0xc72(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x3c(%rbp),%edi
movsd  -0x70(%rbp),%xmm0
movsd  -0x98(%rbp),%xmm1
ff
call   1050 <subMean@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x3c(%rbp),%edi
movsd  -0x68(%rbp),%xmm0
movsd  -0xa0(%rbp),%xmm1
ff
call   1050 <subMean@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
call   1040 <atan2@plt>
movsd  0xbfa(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  0xbb8(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  0xb52(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x3c(%rbp),%edi
movsd  -0x60(%rbp),%xmm0
movsd  -0x98(%rbp),%xmm1
ff
call   1050 <subMean@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x3c(%rbp),%edi
movsd  -0x58(%rbp),%xmm0
movsd  -0xa0(%rbp),%xmm1
ff
call   1050 <subMean@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
call   1040 <atan2@plt>
movsd  0xada(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x80(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1090 <cos@plt>
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x78(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xa3a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1090 <cos@plt>
addsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    15fc <compute_flow_contrib_rm+0x47c>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1276 <compute_flow_contrib_rm+0xf6>
jmp    160f <compute_flow_contrib_rm+0x48f>
cmpl   $0x0,-0x34(%rbp)
jle    169f <compute_flow_contrib_rm+0x51f>
movsd  -0xa8(%rbp),%xmm0
ff
cvtsi2sdl -0x34(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0xa8(%rbp),%xmm0
ff
cvtsi2sdl -0x34(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0x9bd(%rip),%xmm1
call   10a0 <pow@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0xb0(%rbp),%xmm0
ff
cvtsi2sdl -0x34(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0xb0(%rbp),%xmm0
ff
cvtsi2sdl -0x34(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0x97c(%rip),%xmm1
call   10a0 <pow@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    16ce <compute_flow_contrib_rm+0x54e>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_flow_contrib_rm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rcx,%r14
movl   $0x0,0x1c(%rsp)
xorpd  %xmm0,%xmm0
movapd %xmm0,0x60(%rsp)
movapd %xmm0,0x50(%rsp)
movslq %edi,%rbp
cmpl   $0x0,(%rsi,%rbp,4)
jle    1469 <compute_flow_contrib_rm+0x309>
mov    %r9,%rbx
mov    %r8,%r15
mov    %rsi,%r12
mov    0xb8(%rsp),%rax
mov    0xb0(%rsp),%r9
addl   $0x1,(%rdx,%rbp,4)
mov    %rax,(%rsp)
lea    0x50(%rsp),%rdi
lea    0x1c(%rsp),%rsi
mov    %r12,%rdx
mov    %r8,%rcx
mov    %rbx,%r8
call   1060 <compute_evt_plane_avg@plt>
cmpl   $0x0,(%r12,%rbp,4)
jle    1469 <compute_flow_contrib_rm+0x309>
mov    %r14,0x40(%rsp)
lea    0x0(,%rbp,4),%r13
xor    %r14d,%r14d
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x38(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
movl   $0x0,0x2c(%rsp)
jmp    1225 <compute_flow_contrib_rm+0xc5>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
movslq (%r12,%rbp,4),%rax
add    $0x64,%r13
cmp    %rax,%r14
jge    1420 <compute_flow_contrib_rm+0x2c0>
mov    0xb8(%rsp),%rax
xorps  %xmm0,%xmm0
cvtsi2sdl (%rax,%r13,1),%xmm0
call   1030 <abs@plt>
ucomisd 0xddd(%rip),%xmm0
jbe    1210 <compute_flow_contrib_rm+0xb0>
mov    0xb0(%rsp),%rax
movsd  (%rax,%r13,2),%xmm0
call   1030 <abs@plt>
movsd  0xda0(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     1210 <compute_flow_contrib_rm+0xb0>
addl   $0x1,0x2c(%rsp)
movsd  (%r15,%r13,2),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx,%r13,2),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <cos@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%r15,%r13,2),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rbx,%r13,2),%xmm0
addsd  %xmm0,%xmm0
call   1070 <sin@plt>
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
mov    0x1c(%rsp),%edi
movsd  0x50(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1050 <subMean@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x1c(%rsp),%edi
movsd  0x58(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1050 <subMean@plt>
movsd  0x10(%rsp),%xmm1
call   1040 <atan2@plt>
movsd  %xmm0,0x48(%rsp)
movsd  (%r15,%r13,2),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx,%r13,2),%xmm0
movsd  0xce8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <cos@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%r15,%r13,2),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rbx,%r13,2),%xmm0
mulsd  0xcb1(%rip),%xmm0
call   1070 <sin@plt>
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
mov    0x1c(%rsp),%edi
movsd  0x60(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1050 <subMean@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x1c(%rsp),%edi
movsd  0x68(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1050 <subMean@plt>
movsd  0x10(%rsp),%xmm1
call   1040 <atan2@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx,%r13,2),%xmm0
movsd  0x48(%rsp),%xmm1
mulsd  0xc4f(%rip),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <cos@plt>
movsd  0x30(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
movsd  0x10(%rsp),%xmm1
divsd  0xc28(%rip),%xmm1
movsd  (%rbx,%r13,2),%xmm0
mulsd  0xc0a(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <cos@plt>
movsd  0x38(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
jmp    1210 <compute_flow_contrib_rm+0xb0>
mov    0x2c(%rsp),%eax
test   %eax,%eax
mov    0x40(%rsp),%r14
jle    1469 <compute_flow_contrib_rm+0x309>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%r14)
movsd  0x38(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%r14)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x18(%r14)
jmp    1478 <compute_flow_contrib_rm+0x318>
xorpd  %xmm0,%xmm0
movupd %xmm0,0x10(%r14)
movupd %xmm0,(%r14)
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @compute_flow_contrib_rm(i32 %0, i32* %1, i32* %2, double* %3, [25 x double]* %4, [25 x double]* %5, [25 x double]* %6, [25 x i32]* %7) {
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca double*
%13 = alloca [25 x double]*
%14 = alloca [25 x double]*
%15 = alloca [25 x double]*
%16 = alloca [25 x i32]*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca [4 x double]
%22 = alloca [2 x double]
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
store i32 %0, i32* %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store double* %3, double** %12
store [25 x double]* %4, [25 x double]** %13
store [25 x double]* %5, [25 x double]** %14
store [25 x double]* %6, [25 x double]** %15
store [25 x i32]* %7, [25 x i32]** %16
store i32 0, i32* %17
store i32 0, i32* %19
store double 1.000000e+00, double* %20
%29 = bitcast [4 x double]* %21 to i8*
%30 = bitcast [2 x double]* %22 to i8*
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %27
store double 0.000000e+00, double* %28
%31 = load i32*, i32** %10
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %235
37: ; preds = %8
%38 = load i32*, i32** %11
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 1
store i32 %43, i32* %41
%44 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 0
%45 = load i32*, i32** %10
%46 = load [25 x double]*, [25 x double]** %13
%47 = bitcast [25 x double]* %46 to double**
%48 = load [25 x double]*, [25 x double]** %14
%49 = bitcast [25 x double]* %48 to double**
%50 = load [25 x double]*, [25 x double]** %15
%51 = bitcast [25 x double]* %50 to double**
%52 = load [25 x i32]*, [25 x i32]** %16
%53 = bitcast [25 x i32]* %52 to i32**
%54 = call i32 @compute_evt_plane_avg(double* %44, i32* %19, i32* %45, double** %47, double** %49, double** %51, i32** %53)
store i32 0, i32* %18
br label %55
55: ; preds = %231, %37
%56 = load i32, i32* %18
%57 = load i32*, i32** %10
%58 = load i32, i32* %9
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32, i32* %57, i64 %59
%61 = load i32, i32* %60
%62 = icmp slt i32 %56, %61
br i1 %62, label %63, label %234
63: ; preds = %55
%64 = load [25 x i32]*, [25 x i32]** %16
%65 = load i32, i32* %18
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [25 x i32], [25 x i32]* %64, i64 %66
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [25 x i32], [25 x i32]* %67, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = sitofp i32 %71 to double
%73 = call double @abs(double %72)
%74 = fcmp ogt double %73, 0.000000e+00
br i1 %74, label %75, label %230
75: ; preds = %63
%76 = load [25 x double]*, [25 x double]** %15
%77 = load i32, i32* %18
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [25 x double], [25 x double]* %76, i64 %78
%80 = load i32, i32* %9
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [25 x double], [25 x double]* %79, i64 0, i64 %81
%83 = load double, double* %82
%84 = call double @abs(double %83)
%85 = load double, double* %20
%86 = fcmp ole double %84, %85
br i1 %86, label %87, label %230
87: ; preds = %75
%88 = load i32, i32* %17
%89 = add nsw i32 %88, 1
store i32 %89, i32* %17
%90 = load [25 x double]*, [25 x double]** %13
%91 = load i32, i32* %18
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [25 x double], [25 x double]* %90, i64 %92
%94 = load i32, i32* %9
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [25 x double], [25 x double]* %93, i64 0, i64 %95
%97 = load double, double* %96
%98 = load [25 x double]*, [25 x double]** %14
%99 = load i32, i32* %18
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [25 x double], [25 x double]* %98, i64 %100
%102 = load i32, i32* %9
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [25 x double], [25 x double]* %101, i64 0, i64 %103
%105 = load double, double* %104
%106 = fmul double 2.000000e+00, %105
%107 = fptosi double %106 to i32
%108 = call double @cos(i32 %107)
%109 = fmul double %97, %108
store double %109, double* %25
%110 = load [25 x double]*, [25 x double]** %13
%111 = load i32, i32* %18
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [25 x double], [25 x double]* %110, i64 %112
%114 = load i32, i32* %9
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [25 x double], [25 x double]* %113, i64 0, i64 %115
%117 = load double, double* %116
%118 = load [25 x double]*, [25 x double]** %14
%119 = load i32, i32* %18
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [25 x double], [25 x double]* %118, i64 %120
%122 = load i32, i32* %9
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [25 x double], [25 x double]* %121, i64 0, i64 %123
%125 = load double, double* %124
%126 = fmul double 2.000000e+00, %125
%127 = call double @sin(double %126)
%128 = fmul double %117, %127
store double %128, double* %26
%129 = load i32, i32* %19
%130 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 0
%131 = load double, double* %130
%132 = load double, double* %25
%133 = call double @subMean(i32 %129, double %131, double %132)
store double %133, double* %23
%134 = load i32, i32* %19
%135 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 1
%136 = load double, double* %135
%137 = load double, double* %26
%138 = call double @subMean(i32 %134, double %136, double %137)
store double %138, double* %24
%139 = load double, double* %24
%140 = load double, double* %23
%141 = call double @atan2(double %139, double %140)
%142 = fdiv double %141, 2.000000e+00
%143 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 0, i64 0
store double %142, double* %143
%144 = load [25 x double]*, [25 x double]** %13
%145 = load i32, i32* %18
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [25 x double], [25 x double]* %144, i64 %146
%148 = load i32, i32* %9
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [25 x double], [25 x double]* %147, i64 0, i64 %149
%151 = load double, double* %150
%152 = load [25 x double]*, [25 x double]** %14
%153 = load i32, i32* %18
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds [25 x double], [25 x double]* %152, i64 %154
%156 = load i32, i32* %9
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [25 x double], [25 x double]* %155, i64 0, i64 %157
%159 = load double, double* %158
%160 = fmul double 3.000000e+00, %159
%161 = fptosi double %160 to i32
%162 = call double @cos(i32 %161)
%163 = fmul double %151, %162
store double %163, double* %25
%164 = load [25 x double]*, [25 x double]** %13
%165 = load i32, i32* %18
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [25 x double], [25 x double]* %164, i64 %166
%168 = load i32, i32* %9
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [25 x double], [25 x double]* %167, i64 0, i64 %169
%171 = load double, double* %170
%172 = load [25 x double]*, [25 x double]** %14
%173 = load i32, i32* %18
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds [25 x double], [25 x double]* %172, i64 %174
%176 = load i32, i32* %9
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds [25 x double], [25 x double]* %175, i64 0, i64 %177
%179 = load double, double* %178
%180 = fmul double 3.000000e+00, %179
%181 = call double @sin(double %180)
%182 = fmul double %171, %181
store double %182, double* %26
%183 = load i32, i32* %19
%184 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 2
%185 = load double, double* %184
%186 = load double, double* %25
%187 = call double @subMean(i32 %183, double %185, double %186)
store double %187, double* %23
%188 = load i32, i32* %19
%189 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 3
%190 = load double, double* %189
%191 = load double, double* %26
%192 = call double @subMean(i32 %188, double %190, double %191)
store double %192, double* %24
%193 = load double, double* %24
%194 = load double, double* %23
%195 = call double @atan2(double %193, double %194)
%196 = fdiv double %195, 3.000000e+00
%197 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 0, i64 1
store double %196, double* %197
%198 = load [25 x double]*, [25 x double]** %14
%199 = load i32, i32* %18
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds [25 x double], [25 x double]* %198, i64 %200
%202 = load i32, i32* %9
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds [25 x double], [25 x double]* %201, i64 0, i64 %203
%205 = load double, double* %204
%206 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 0, i64 0
%207 = load double, double* %206
%208 = fneg double %207
%209 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %205, double %208)
%210 = fptosi double %209 to i32
%211 = call double @cos(i32 %210)
%212 = load double, double* %27
%213 = fadd double %212, %211
store double %213, double* %27
%214 = load [25 x double]*, [25 x double]** %14
%215 = load i32, i32* %18
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds [25 x double], [25 x double]* %214, i64 %216
%218 = load i32, i32* %9
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds [25 x double], [25 x double]* %217, i64 0, i64 %219
%221 = load double, double* %220
%222 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 0, i64 1
%223 = load double, double* %222
%224 = fneg double %223
%225 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %221, double %224)
%226 = fptosi double %225 to i32
%227 = call double @cos(i32 %226)
%228 = load double, double* %28
%229 = fadd double %228, %227
store double %229, double* %28
br label %230
230: ; preds = %87, %75, %63
br label %231
231: ; preds = %230
%232 = load i32, i32* %18
%233 = add nsw i32 %232, 1
store i32 %233, i32* %18
br label %55
234: ; preds = %55
br label %235
235: ; preds = %234, %8
%236 = load i32, i32* %17
%237 = icmp sgt i32 %236, 0
br i1 %237, label %238, label %265
238: ; preds = %235
%239 = load double, double* %27
%240 = load i32, i32* %17
%241 = sitofp i32 %240 to double
%242 = fdiv double %239, %241
%243 = load double*, double** %12
%244 = getelementptr inbounds double, double* %243, i64 0
store double %242, double* %244
%245 = load double, double* %27
%246 = load i32, i32* %17
%247 = sitofp i32 %246 to double
%248 = fdiv double %245, %247
%249 = call double @pow(double %248, double 2.000000e+00)
%250 = load double*, double** %12
%251 = getelementptr inbounds double, double* %250, i64 1
store double %249, double* %251
%252 = load double, double* %28
%253 = load i32, i32* %17
%254 = sitofp i32 %253 to double
%255 = fdiv double %252, %254
%256 = load double*, double** %12
%257 = getelementptr inbounds double, double* %256, i64 2
store double %255, double* %257
%258 = load double, double* %28
%259 = load i32, i32* %17
%260 = sitofp i32 %259 to double
%261 = fdiv double %258, %260
%262 = call double @pow(double %261, double 2.000000e+00)
%263 = load double*, double** %12
%264 = getelementptr inbounds double, double* %263, i64 3
store double %262, double* %264
br label %274
265: ; preds = %235
%266 = load double*, double** %12
%267 = getelementptr inbounds double, double* %266, i64 0
store double 0.000000e+00, double* %267
%268 = load double*, double** %12
%269 = getelementptr inbounds double, double* %268, i64 1
store double 0.000000e+00, double* %269
%270 = load double*, double** %12
%271 = getelementptr inbounds double, double* %270, i64 2
store double 0.000000e+00, double* %271
%272 = load double*, double** %12
%273 = getelementptr inbounds double, double* %272, i64 3
store double 0.000000e+00, double* %273
br label %274
274: ; preds = %265, %238
ret void
}

LLVM IR (-O2):
define void @compute_flow_contrib_rm(i32 %0, i32* %1, i32* nocapture %2, double* nocapture writeonly %3, [25 x double]* %4, [25 x double]* %5, [25 x double]* %6, [25 x i32]* %7) {
%9 = alloca i32
%10 = alloca [4 x double]
%11 = bitcast i32* %9 to i8*
store i32 0, i32* %9
%12 = bitcast [4 x double]* %10 to i8*
%13 = sext i32 %0 to i64
%14 = getelementptr inbounds i32, i32* %1, i64 %13
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %119
17: ; preds = %8
%18 = getelementptr inbounds i32, i32* %2, i64 %13
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %18
%21 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 0
%22 = bitcast [25 x double]* %4 to double**
%23 = bitcast [25 x double]* %5 to double**
%24 = bitcast [25 x double]* %6 to double**
%25 = bitcast [25 x i32]* %7 to i32**
%26 = call i32 @compute_evt_plane_avg(double* %21, i32* %9, i32* %1, double** %22, double** %23, double** %24, i32** %25)
%27 = load i32, i32* %14
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %119
29: ; preds = %17
%30 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 1
%31 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 2
%32 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 3
br label %33
33: ; preds = %29, %100
%34 = phi i64 [ 0, %29 ], [ %104, %100 ]
%35 = phi double [ 0.000000e+00, %29 ], [ %103, %100 ]
%36 = phi double [ 0.000000e+00, %29 ], [ %102, %100 ]
%37 = phi i32 [ 0, %29 ], [ %101, %100 ]
%38 = getelementptr inbounds [25 x i32], [25 x i32]* %7, i64 %34, i64 %13
%39 = load i32, i32* %38
%40 = sitofp i32 %39 to double
%41 = call double @abs(double %40)
%42 = fcmp ogt double %41, 0.000000e+00
br i1 %42, label %43, label %100
43: ; preds = %33
%44 = getelementptr inbounds [25 x double], [25 x double]* %6, i64 %34, i64 %13
%45 = load double, double* %44
%46 = call double @abs(double %45)
%47 = fcmp ugt double %46, 1.000000e+00
br i1 %47, label %100, label %48
48: ; preds = %43
%49 = add nsw i32 %37, 1
%50 = getelementptr inbounds [25 x double], [25 x double]* %4, i64 %34, i64 %13
%51 = load double, double* %50
%52 = getelementptr inbounds [25 x double], [25 x double]* %5, i64 %34, i64 %13
%53 = load double, double* %52
%54 = fmul double %53, 2.000000e+00
%55 = fptosi double %54 to i32
%56 = call double @cos(i32 %55)
%57 = fmul double %51, %56
%58 = load double, double* %50
%59 = load double, double* %52
%60 = fmul double %59, 2.000000e+00
%61 = call double @sin(double %60)
%62 = fmul double %58, %61
%63 = load i32, i32* %9
%64 = load double, double* %21
%65 = call double @subMean(i32 %63, double %64, double %57)
%66 = load i32, i32* %9
%67 = load double, double* %30
%68 = call double @subMean(i32 %66, double %67, double %62)
%69 = call double @atan2(double %68, double %65)
%70 = load double, double* %50
%71 = load double, double* %52
%72 = fmul double %71, 3.000000e+00
%73 = fptosi double %72 to i32
%74 = call double @cos(i32 %73)
%75 = fmul double %70, %74
%76 = load double, double* %50
%77 = load double, double* %52
%78 = fmul double %77, 3.000000e+00
%79 = call double @sin(double %78)
%80 = fmul double %76, %79
%81 = load i32, i32* %9
%82 = load double, double* %31
%83 = call double @subMean(i32 %81, double %82, double %75)
%84 = load i32, i32* %9
%85 = load double, double* %32
%86 = call double @subMean(i32 %84, double %85, double %80)
%87 = call double @atan2(double %86, double %83)
%88 = load double, double* %52
%89 = fmul double %69, -5.000000e-01
%90 = call double @llvm.fmuladd.f64(double %88, double 2.000000e+00, double %89)
%91 = fptosi double %90 to i32
%92 = call double @cos(i32 %91)
%93 = fadd double %36, %92
%94 = load double, double* %52
%95 = fdiv double %87, -3.000000e+00
%96 = call double @llvm.fmuladd.f64(double %94, double 3.000000e+00, double %95)
%97 = fptosi double %96 to i32
%98 = call double @cos(i32 %97)
%99 = fadd double %35, %98
br label %100
100: ; preds = %33, %43, %48
%101 = phi i32 [ %49, %48 ], [ %37, %43 ], [ %37, %33 ]
%102 = phi double [ %93, %48 ], [ %36, %43 ], [ %36, %33 ]
%103 = phi double [ %99, %48 ], [ %35, %43 ], [ %35, %33 ]
%104 = add nuw nsw i64 %34, 1
%105 = load i32, i32* %14
%106 = sext i32 %105 to i64
%107 = icmp slt i64 %104, %106
br i1 %107, label %33, label %108
108: ; preds = %100
%109 = icmp sgt i32 %101, 0
br i1 %109, label %110, label %119
110: ; preds = %108
%111 = sitofp i32 %101 to double
%112 = fdiv double %102, %111
store double %112, double* %3
%113 = fmul double %112, %112
%114 = getelementptr inbounds double, double* %3, i64 1
store double %113, double* %114
%115 = fdiv double %103, %111
%116 = getelementptr inbounds double, double* %3, i64 2
store double %115, double* %116
%117 = fmul double %115, %115
%118 = getelementptr inbounds double, double* %3, i64 3
store double %117, double* %118
br label %121
119: ; preds = %17, %8, %108
%120 = bitcast double* %3 to i8*
br label %121
121: ; preds = %119, %110
ret void
}