#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 fmin(double, double);
double pow(double, int);
void stage_one(double *vec, double *fact, double *sigmas, double *var_f, int p,
               double *Cik, double *Cik1_Cik, double *ECik, double *col_sums) {
  int j, m;
  double cik, cik_1, sigmacum;
  for (j = 0; j < p - 1; ++j) {
    col_sums[0] = 0.;
    col_sums[1] = 0., sigmacum = 0;
    for (m = 0; m < (p - (j + 1)); ++m) {
      cik = vec[(m + j * p)];
      cik_1 = vec[(m + (1 + j) * p)];
      Cik[m] = cik;
      Cik1_Cik[m] = cik_1 / cik;
      col_sums[0] += cik;
      col_sums[1] += cik_1;
    }
    fact[j] = col_sums[1] / col_sums[0];
    ECik[j] = col_sums[0];
    for (m = 0; m < (p - (j + 1)); ++m) {
      sigmacum += Cik[m] * pow((Cik1_Cik[m] - fact[j]), 2);
    }
    sigmas[j] = sigmacum / (p - j - 2);
  }
  sigmas[p - 2] = fmin(pow(sigmas[p - 3], 2) / sigmas[p - 4],
                       fmin(sigmas[p - 4], sigmas[p - 3]));
  for (j = 0; j < p - 1; ++j) {
    var_f[j] = sigmas[j] / ECik[j];
  }
}


x86 assembly (clang, -O0):
<stage_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1307 <stage_one+0x1f7>
mov    0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x24(%rbp),%ecx
mov    -0x34(%rbp),%edx
add    $0x1,%edx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    1228 <stage_one+0x118>
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%edx
add    $0x1,%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    0x20(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    0x20(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    117a <stage_one+0x6a>
mov    0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    0x20(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x24(%rbp),%ecx
mov    -0x34(%rbp),%edx
add    $0x1,%edx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    12d6 <stage_one+0x1c6>
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1262 <stage_one+0x152>
movsd  -0x50(%rbp),%xmm0
mov    -0x24(%rbp),%eax
sub    -0x34(%rbp),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1143 <stage_one+0x33>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm3
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm3
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm4
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps %xmm1,%xmm5
movaps %xmm4,%xmm2
cmpunordsd %xmm2,%xmm2
movaps %xmm2,%xmm0
pand   %xmm5,%xmm0
minsd  %xmm4,%xmm1
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13f7 <stage_one+0x2e7>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13b1 <stage_one+0x2a1>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stage_one>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r8d,%r15d
mov    %rcx,%r14
lea    -0x1(%r15),%r13d
mov    %r13d,%eax
mov    %rax,0x58(%rsp)
cmp    $0x1,%r8d
mov    %rdx,%r8
mov    %rdx,0x28(%rsp)
jle    1402 <stage_one+0x2f2>
mov    %rdi,%rbx
mov    %rsi,0x20(%rsp)
mov    %r14,0x70(%rsp)
mov    0xd0(%rsp),%rbp
mov    0xc0(%rsp),%rcx
lea    -0x2(%r15),%edx
mov    %edx,0x1c(%rsp)
mov    %r15,0x68(%rsp)
mov    %r15d,%r10d
mov    %rcx,%r15
lea    (%rdi,%r10,8),%rdi
lea    0x0(,%r10,8),%r11
xor    %ecx,%ecx
xorps  %xmm3,%xmm3
mov    %r13d,0x34(%rsp)
mov    %r10,0x40(%rsp)
mov    %r11,0x38(%rsp)
mov    %r9,0x60(%rsp)
jmp    11fd <stage_one+0xed>
nopl   0x0(%rax)
mov    0x20(%rsp),%rax
mov    %rcx,%rsi
movabs $0x7ff8000000000000,%rcx
mov    %rcx,(%rax,%r12,8)
mov    %rsi,%rcx
movsd  0x0(%rbp),%xmm0
mov    0xc8(%rsp),%rax
movsd  %xmm0,(%rax,%r12,8)
xorpd  %xmm1,%xmm1
mov    0x1c(%rsp),%eax
sub    %r12d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r8,%r12,8)
add    $0xffffffff,%r13d
add    %r11,%rdi
add    %r11,%rbx
cmp    0x58(%rsp),%rcx
je     1408 <stage_one+0x2f8>
mov    %rcx,%r12
mov    %r13d,%r13d
add    $0x1,%rcx
movups %xmm3,0x0(%rbp)
cmp    %r10,%rcx
jae    11a0 <stage_one+0x90>
mov    %r13d,%esi
and    $0xfffffffe,%esi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm0
movsd  (%rdi,%rax,8),%xmm1
movsd  %xmm0,(%r9,%rax,8)
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,(%r15,%rax,8)
movupd 0x0(%rbp),%xmm2
unpcklpd %xmm1,%xmm0
addpd  %xmm2,%xmm0
movupd %xmm0,0x0(%rbp)
add    $0x1,%rax
cmp    %rax,%r13
jne    1220 <stage_one+0x110>
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm0,%xmm1
mov    0x20(%rsp),%rax
movsd  %xmm1,(%rax,%r12,8)
movsd  0x0(%rbp),%xmm0
mov    0xc8(%rsp),%rax
movsd  %xmm0,(%rax,%r12,8)
xorpd  %xmm1,%xmm1
cmp    %r10,%rcx
jae    11d0 <stage_one+0xc0>
mov    %rdi,0x50(%rsp)
mov    %rbx,0x78(%rsp)
cmp    $0x1,%r13d
mov    %rcx,0x48(%rsp)
xorpd  %xmm1,%xmm1
jne    12b1 <stage_one+0x1a1>
xor    %r14d,%r14d
jmp    135e <stage_one+0x24e>
mov    %rsi,0x80(%rsp)
xor    %r14d,%r14d
mov    0x20(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,0x10(%rsp)
mov    0x60(%rsp),%rbp
movsd  0x0(%rbp,%r14,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0xc0(%rsp),%rbx
movsd  (%rbx,%r14,8),%xmm0
subsd  (%r15,%r12,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rbp,%r14,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rbx,%r14,8),%xmm0
subsd  (%r15,%r12,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movapd %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
add    $0x2,%r14
cmp    %r14,0x80(%rsp)
jne    12d0 <stage_one+0x1c0>
test   $0x1,%r13b
mov    0x28(%rsp),%r8
mov    0xd0(%rsp),%rbp
mov    0x78(%rsp),%rbx
mov    0xc0(%rsp),%r15
mov    0x60(%rsp),%r9
mov    0x40(%rsp),%r10
mov    0x50(%rsp),%rdi
mov    0x38(%rsp),%r11
xorps  %xmm3,%xmm3
mov    0x48(%rsp),%rcx
je     11d0 <stage_one+0xc0>
movsd  (%r9,%r14,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r15,%r14,8),%xmm0
mov    0x20(%rsp),%rax
subsd  (%rax,%r12,8),%xmm0
mov    $0x2,%edi
mov    %r9,%r14
movsd  %xmm1,0x10(%rsp)
call   1030 <pow@plt>
movsd  0x10(%rsp),%xmm1
mov    %r14,%r9
xorps  %xmm3,%xmm3
mov    0x38(%rsp),%r11
mov    0x50(%rsp),%rdi
mov    0x40(%rsp),%r10
mov    0x48(%rsp),%rcx
mov    0x28(%rsp),%r8
mulsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm1
jmp    11d0 <stage_one+0xc0>
lea    -0x2(%r15),%ebp
jmp    141b <stage_one+0x30b>
mov    0x70(%rsp),%r14
mov    0x68(%rsp),%r15
mov    0x34(%rsp),%r13d
mov    0x1c(%rsp),%ebp
movslq %r15d,%rbx
movsd  -0x18(%r8,%rbx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    0x28(%rsp),%rdi
movsd  -0x20(%rdi,%rbx,8),%xmm1
movsd  -0x18(%rdi,%rbx,8),%xmm2
divsd  %xmm1,%xmm0
movapd %xmm1,%xmm3
cmpunordsd %xmm1,%xmm3
movapd %xmm3,%xmm4
andpd  %xmm2,%xmm4
minsd  %xmm1,%xmm2
andnpd %xmm2,%xmm3
orpd   %xmm4,%xmm3
movapd %xmm3,%xmm1
minsd  %xmm0,%xmm1
cmpunordsd %xmm0,%xmm0
movapd %xmm0,%xmm2
andpd  %xmm3,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
movslq %ebp,%rax
movlpd %xmm0,(%rdi,%rax,8)
cmp    $0x2,%r15d
mov    0xc8(%rsp),%rbp
mov    0x58(%rsp),%rbx
jl     15c9 <stage_one+0x4b9>
cmp    $0x2,%r13d
jae    1502 <stage_one+0x3f2>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
test   $0x1,%bl
je     14c5 <stage_one+0x3b5>
movsd  (%rdi,%rax,8),%xmm0
divsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,(%r14,%rax,8)
or     $0x1,%rax
add    %rbx,%rcx
je     15c9 <stage_one+0x4b9>
xchg   %ax,%ax
movsd  (%rdi,%rax,8),%xmm0
divsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,(%r14,%rax,8)
movsd  0x8(%rdi,%rax,8),%xmm0
divsd  0x8(%rbp,%rax,8),%xmm0
movsd  %xmm0,0x8(%r14,%rax,8)
add    $0x2,%rax
cmp    %rax,%rbx
jne    14d0 <stage_one+0x3c0>
jmp    15c9 <stage_one+0x4b9>
lea    (%r14,%rbx,8),%rax
lea    (%rdi,%rbx,8),%rcx
cmp    %r14,%rcx
seta   %r8b
lea    0x0(,%rbx,8),%rcx
add    %rbp,%rcx
cmp    %rdi,%rax
seta   %dl
cmp    %r14,%rcx
seta   %cl
cmp    %rbp,%rax
seta   %sil
xor    %eax,%eax
test   %dl,%r8b
jne    14a5 <stage_one+0x395>
and    %sil,%cl
jne    14a5 <stage_one+0x395>
mov    %ebx,%eax
and    $0xfffffffe,%eax
lea    -0x2(%rax),%rdx
mov    %rdx,%rcx
shr    %rcx
add    $0x1,%rcx
test   %rdx,%rdx
je     15db <stage_one+0x4cb>
mov    %rcx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movupd (%rdi,%rdx,8),%xmm0
movupd 0x0(%rbp,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,(%r14,%rdx,8)
movupd 0x10(%rdi,%rdx,8),%xmm0
movupd 0x10(%rbp,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,0x10(%r14,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rsi
jne    1570 <stage_one+0x460>
test   $0x1,%cl
je     15c0 <stage_one+0x4b0>
movupd (%rdi,%rdx,8),%xmm0
movupd 0x0(%rbp,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,(%r14,%rdx,8)
cmp    %rbx,%rax
jne    14a5 <stage_one+0x395>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%cl
jne    15ab <stage_one+0x49b>
jmp    15c0 <stage_one+0x4b0>

LLVM IR (-O0):
define void @stage_one(double* %0, double* %1, double* %2, double* %3, i32 %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double* %0, double** %10
store double* %1, double** %11
store double* %2, double** %12
store double* %3, double** %13
store i32 %4, i32* %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
store i32 0, i32* %19
br label %24
24: ; preds = %147, %9
%25 = load i32, i32* %19
%26 = load i32, i32* %14
%27 = sub nsw i32 %26, 1
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %150
29: ; preds = %24
%30 = load double*, double** %18
%31 = getelementptr inbounds double, double* %30, i64 0
store double 0.000000e+00, double* %31
%32 = load double*, double** %18
%33 = getelementptr inbounds double, double* %32, i64 1
store double 0.000000e+00, double* %33
store double 0.000000e+00, double* %23
store i32 0, i32* %20
br label %34
34: ; preds = %83, %29
%35 = load i32, i32* %20
%36 = load i32, i32* %14
%37 = load i32, i32* %19
%38 = add nsw i32 %37, 1
%39 = sub nsw i32 %36, %38
%40 = icmp slt i32 %35, %39
br i1 %40, label %41, label %86
41: ; preds = %34
%42 = load double*, double** %10
%43 = load i32, i32* %20
%44 = load i32, i32* %19
%45 = load i32, i32* %14
%46 = mul nsw i32 %44, %45
%47 = add nsw i32 %43, %46
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %42, i64 %48
%50 = load double, double* %49
store double %50, double* %21
%51 = load double*, double** %10
%52 = load i32, i32* %20
%53 = load i32, i32* %19
%54 = add nsw i32 1, %53
%55 = load i32, i32* %14
%56 = mul nsw i32 %54, %55
%57 = add nsw i32 %52, %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %51, i64 %58
%60 = load double, double* %59
store double %60, double* %22
%61 = load double, double* %21
%62 = load double*, double** %15
%63 = load i32, i32* %20
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %62, i64 %64
store double %61, double* %65
%66 = load double, double* %22
%67 = load double, double* %21
%68 = fdiv double %66, %67
%69 = load double*, double** %16
%70 = load i32, i32* %20
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
store double %68, double* %72
%73 = load double, double* %21
%74 = load double*, double** %18
%75 = getelementptr inbounds double, double* %74, i64 0
%76 = load double, double* %75
%77 = fadd double %76, %73
store double %77, double* %75
%78 = load double, double* %22
%79 = load double*, double** %18
%80 = getelementptr inbounds double, double* %79, i64 1
%81 = load double, double* %80
%82 = fadd double %81, %78
store double %82, double* %80
br label %83
83: ; preds = %41
%84 = load i32, i32* %20
%85 = add nsw i32 %84, 1
store i32 %85, i32* %20
br label %34
86: ; preds = %34
%87 = load double*, double** %18
%88 = getelementptr inbounds double, double* %87, i64 1
%89 = load double, double* %88
%90 = load double*, double** %18
%91 = getelementptr inbounds double, double* %90, i64 0
%92 = load double, double* %91
%93 = fdiv double %89, %92
%94 = load double*, double** %11
%95 = load i32, i32* %19
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
store double %93, double* %97
%98 = load double*, double** %18
%99 = getelementptr inbounds double, double* %98, i64 0
%100 = load double, double* %99
%101 = load double*, double** %17
%102 = load i32, i32* %19
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
store double %100, double* %104
store i32 0, i32* %20
br label %105
105: ; preds = %132, %86
%106 = load i32, i32* %20
%107 = load i32, i32* %14
%108 = load i32, i32* %19
%109 = add nsw i32 %108, 1
%110 = sub nsw i32 %107, %109
%111 = icmp slt i32 %106, %110
br i1 %111, label %112, label %135
112: ; preds = %105
%113 = load double*, double** %15
%114 = load i32, i32* %20
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %113, i64 %115
%117 = load double, double* %116
%118 = load double*, double** %16
%119 = load i32, i32* %20
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %118, i64 %120
%122 = load double, double* %121
%123 = load double*, double** %11
%124 = load i32, i32* %19
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %123, i64 %125
%127 = load double, double* %126
%128 = fsub double %122, %127
%129 = call double @pow(double %128, i32 2)
%130 = load double, double* %23
%131 = call double @llvm.fmuladd.f64(double %117, double %129, double %130)
store double %131, double* %23
br label %132
132: ; preds = %112
%133 = load i32, i32* %20
%134 = add nsw i32 %133, 1
store i32 %134, i32* %20
br label %105
135: ; preds = %105
%136 = load double, double* %23
%137 = load i32, i32* %14
%138 = load i32, i32* %19
%139 = sub nsw i32 %137, %138
%140 = sub nsw i32 %139, 2
%141 = sitofp i32 %140 to double
%142 = fdiv double %136, %141
%143 = load double*, double** %12
%144 = load i32, i32* %19
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double, double* %143, i64 %145
store double %142, double* %146
br label %147
147: ; preds = %135
%148 = load i32, i32* %19
%149 = add nsw i32 %148, 1
store i32 %149, i32* %19
br label %24
150: ; preds = %24
%151 = load double*, double** %12
%152 = load i32, i32* %14
%153 = sub nsw i32 %152, 3
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds double, double* %151, i64 %154
%156 = load double, double* %155
%157 = call double @pow(double %156, i32 2)
%158 = load double*, double** %12
%159 = load i32, i32* %14
%160 = sub nsw i32 %159, 4
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double, double* %158, i64 %161
%163 = load double, double* %162
%164 = fdiv double %157, %163
%165 = load double*, double** %12
%166 = load i32, i32* %14
%167 = sub nsw i32 %166, 4
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %165, i64 %168
%170 = load double, double* %169
%171 = load double*, double** %12
%172 = load i32, i32* %14
%173 = sub nsw i32 %172, 3
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %171, i64 %174
%176 = load double, double* %175
%177 = call double @llvm.minnum.f64(double %170, double %176)
%178 = call double @llvm.minnum.f64(double %164, double %177)
%179 = load double*, double** %12
%180 = load i32, i32* %14
%181 = sub nsw i32 %180, 2
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double, double* %179, i64 %182
store double %178, double* %183
store i32 0, i32* %19
br label %184
184: ; preds = %205, %150
%185 = load i32, i32* %19
%186 = load i32, i32* %14
%187 = sub nsw i32 %186, 1
%188 = icmp slt i32 %185, %187
br i1 %188, label %189, label %208
189: ; preds = %184
%190 = load double*, double** %12
%191 = load i32, i32* %19
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds double, double* %190, i64 %192
%194 = load double, double* %193
%195 = load double*, double** %17
%196 = load i32, i32* %19
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds double, double* %195, i64 %197
%199 = load double, double* %198
%200 = fdiv double %194, %199
%201 = load double*, double** %13
%202 = load i32, i32* %19
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds double, double* %201, i64 %203
store double %200, double* %204
br label %205
205: ; preds = %189
%206 = load i32, i32* %19
%207 = add nsw i32 %206, 1
store i32 %207, i32* %19
br label %184
208: ; preds = %184
ret void
}

LLVM IR (-O2):
define void @stage_one(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture writeonly %3, i32 %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture %8) {
%10 = add i32 %4, -1
%11 = icmp sgt i32 %4, 1
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = add nsw i32 %4, -2
br label %111
14: ; preds = %9
%15 = add nsw i32 %4, -2
%16 = zext i32 %4 to i64
%17 = zext i32 %10 to i64
%18 = bitcast double* %8 to i8*
%19 = bitcast double* %8 to <2 x double>*
%20 = bitcast double* %8 to <2 x double>*
br label %21
21: ; preds = %14, %102
%22 = phi i64 [ 0, %14 ], [ %25, %102 ]
%23 = phi i32 [ %10, %14 ], [ %109, %102 ]
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %22, 1
%26 = icmp ult i64 %25, %16
br i1 %26, label %31, label %27
27: ; preds = %21
%28 = getelementptr inbounds double, double* %1, i64 %22
store double 0x7FF8000000000000, double* %28
%29 = load double, double* %8
%30 = getelementptr inbounds double, double* %7, i64 %22
store double %29, double* %30
br label %102
31: ; preds = %21
%32 = mul nsw i64 %22, %16
%33 = mul nsw i64 %25, %16
%34 = zext i32 %23 to i64
br label %35
35: ; preds = %31, %35
%36 = phi i64 [ 0, %31 ], [ %50, %35 ]
%37 = add nuw nsw i64 %36, %32
%38 = getelementptr inbounds double, double* %0, i64 %37
%39 = load double, double* %38
%40 = add nuw nsw i64 %36, %33
%41 = getelementptr inbounds double, double* %0, i64 %40
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %5, i64 %36
store double %39, double* %43
%44 = fdiv double %42, %39
%45 = getelementptr inbounds double, double* %6, i64 %36
store double %44, double* %45
%46 = load <2 x double>, <2 x double>* %19
%47 = insertelement <2 x double> poison, double %39, i64 0
%48 = insertelement <2 x double> %47, double %42, i64 1
%49 = fadd <2 x double> %48, %46
store <2 x double> %49, <2 x double>* %20
%50 = add nuw nsw i64 %36, 1
%51 = icmp eq i64 %50, %34
br i1 %51, label %52, label %35
52: ; preds = %35
%53 = extractelement <2 x double> %49, i64 0
%54 = extractelement <2 x double> %49, i64 1
%55 = fdiv double %54, %53
%56 = getelementptr inbounds double, double* %1, i64 %22
store double %55, double* %56
%57 = load double, double* %8
%58 = getelementptr inbounds double, double* %7, i64 %22
store double %57, double* %58
br i1 %26, label %59, label %102
59: ; preds = %52
%60 = and i64 %24, 1
%61 = icmp eq i32 %23, 1
br i1 %61, label %88, label %62
62: ; preds = %59
%63 = and i64 %24, 4294967294
br label %64
64: ; preds = %64, %62
%65 = phi i64 [ 0, %62 ], [ %85, %64 ]
%66 = phi double [ 0.000000e+00, %62 ], [ %84, %64 ]
%67 = phi i64 [ 0, %62 ], [ %86, %64 ]
%68 = getelementptr inbounds double, double* %5, i64 %65
%69 = load double, double* %68
%70 = getelementptr inbounds double, double* %6, i64 %65
%71 = load double, double* %70
%72 = load double, double* %56
%73 = fsub double %71, %72
%74 = tail call double @pow(double %73, i32 2)
%75 = tail call double @llvm.fmuladd.f64(double %69, double %74, double %66)
%76 = or i64 %65, 1
%77 = getelementptr inbounds double, double* %5, i64 %76
%78 = load double, double* %77
%79 = getelementptr inbounds double, double* %6, i64 %76
%80 = load double, double* %79
%81 = load double, double* %56
%82 = fsub double %80, %81
%83 = tail call double @pow(double %82, i32 2)
%84 = tail call double @llvm.fmuladd.f64(double %78, double %83, double %75)
%85 = add nuw nsw i64 %65, 2
%86 = add i64 %67, 2
%87 = icmp eq i64 %86, %63
br i1 %87, label %88, label %64
88: ; preds = %64, %59
%89 = phi double [ undef, %59 ], [ %84, %64 ]
%90 = phi i64 [ 0, %59 ], [ %85, %64 ]
%91 = phi double [ 0.000000e+00, %59 ], [ %84, %64 ]
%92 = icmp eq i64 %60, 0
br i1 %92, label %102, label %93
93: ; preds = %88
%94 = getelementptr inbounds double, double* %5, i64 %90
%95 = load double, double* %94
%96 = getelementptr inbounds double, double* %6, i64 %90
%97 = load double, double* %96
%98 = load double, double* %56
%99 = fsub double %97, %98
%100 = tail call double @pow(double %99, i32 2)
%101 = tail call double @llvm.fmuladd.f64(double %95, double %100, double %91)
br label %102
102: ; preds = %93, %88, %27, %52
%103 = phi double [ 0.000000e+00, %52 ], [ 0.000000e+00, %27 ], [ %89, %88 ], [ %101, %93 ]
%104 = trunc i64 %22 to i32
%105 = sub i32 %15, %104
%106 = sitofp i32 %105 to double
%107 = fdiv double %103, %106
%108 = getelementptr inbounds double, double* %2, i64 %22
store double %107, double* %108
%109 = add i32 %23, -1
%110 = icmp eq i64 %25, %17
br i1 %110, label %111, label %21
111: ; preds = %102, %12
%112 = phi i32 [ %13, %12 ], [ %15, %102 ]
%113 = add nsw i32 %4, -3
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double, double* %2, i64 %114
%116 = load double, double* %115
%117 = tail call double @pow(double %116, i32 2)
%118 = add nsw i32 %4, -4
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %2, i64 %119
%121 = load double, double* %120
%122 = fdiv double %117, %121
%123 = load double, double* %115
%124 = tail call double @llvm.minnum.f64(double %121, double %123)
%125 = tail call double @llvm.minnum.f64(double %122, double %124)
%126 = sext i32 %112 to i64
%127 = getelementptr inbounds double, double* %2, i64 %126
store double %125, double* %127
br i1 %11, label %128, label %225
128: ; preds = %111
%129 = zext i32 %10 to i64
%130 = icmp ult i32 %10, 2
br i1 %130, label %191, label %131
131: ; preds = %128
%132 = getelementptr double, double* %3, i64 %129
%133 = getelementptr double, double* %2, i64 %129
%134 = getelementptr double, double* %7, i64 %129
%135 = icmp ugt double* %133, %3
%136 = icmp ugt double* %132, %2
%137 = and i1 %135, %136
%138 = icmp ugt double* %134, %3
%139 = icmp ugt double* %132, %7
%140 = and i1 %138, %139
%141 = or i1 %137, %140
br i1 %141, label %191, label %142
142: ; preds = %131
%143 = and i64 %129, 4294967294
%144 = add nsw i64 %143, -2
%145 = lshr exact i64 %144, 1
%146 = add nuw i64 %145, 1
%147 = and i64 %146, 1
%148 = icmp eq i64 %144, 0
br i1 %148, label %176, label %149
149: ; preds = %142
%150 = and i64 %146, -2
br label %151
151: ; preds = %151, %149
%152 = phi i64 [ 0, %149 ], [ %173, %151 ]
%153 = phi i64 [ 0, %149 ], [ %174, %151 ]
%154 = getelementptr inbounds double, double* %2, i64 %152
%155 = bitcast double* %154 to <2 x double>*
%156 = load <2 x double>, <2 x double>* %155
%157 = getelementptr inbounds double, double* %7, i64 %152
%158 = bitcast double* %157 to <2 x double>*
%159 = load <2 x double>, <2 x double>* %158
%160 = fdiv <2 x double> %156, %159
%161 = getelementptr inbounds double, double* %3, i64 %152
%162 = bitcast double* %161 to <2 x double>*
store <2 x double> %160, <2 x double>* %162
%163 = or i64 %152, 2
%164 = getelementptr inbounds double, double* %2, i64 %163
%165 = bitcast double* %164 to <2 x double>*
%166 = load <2 x double>, <2 x double>* %165
%167 = getelementptr inbounds double, double* %7, i64 %163
%168 = bitcast double* %167 to <2 x double>*
%169 = load <2 x double>, <2 x double>* %168
%170 = fdiv <2 x double> %166, %169
%171 = getelementptr inbounds double, double* %3, i64 %163
%172 = bitcast double* %171 to <2 x double>*
store <2 x double> %170, <2 x double>* %172
%173 = add nuw i64 %152, 4
%174 = add nuw i64 %153, 2
%175 = icmp eq i64 %174, %150
br i1 %175, label %176, label %151
176: ; preds = %151, %142
%177 = phi i64 [ 0, %142 ], [ %173, %151 ]
%178 = icmp eq i64 %147, 0
br i1 %178, label %189, label %179
179: ; preds = %176
%180 = getelementptr inbounds double, double* %2, i64 %177
%181 = bitcast double* %180 to <2 x double>*
%182 = load <2 x double>, <2 x double>* %181
%183 = getelementptr inbounds double, double* %7, i64 %177
%184 = bitcast double* %183 to <2 x double>*
%185 = load <2 x double>, <2 x double>* %184
%186 = fdiv <2 x double> %182, %185
%187 = getelementptr inbounds double, double* %3, i64 %177
%188 = bitcast double* %187 to <2 x double>*
store <2 x double> %186, <2 x double>* %188
br label %189
189: ; preds = %176, %179
%190 = icmp eq i64 %143, %129
br i1 %190, label %225, label %191
191: ; preds = %131, %128, %189
%192 = phi i64 [ 0, %131 ], [ 0, %128 ], [ %143, %189 ]
%193 = xor i64 %192, -1
%194 = and i64 %129, 1
%195 = icmp eq i64 %194, 0
br i1 %195, label %204, label %196
196: ; preds = %191
%197 = getelementptr inbounds double, double* %2, i64 %192
%198 = load double, double* %197
%199 = getelementptr inbounds double, double* %7, i64 %192
%200 = load double, double* %199
%201 = fdiv double %198, %200
%202 = getelementptr inbounds double, double* %3, i64 %192
store double %201, double* %202
%203 = or i64 %192, 1
br label %204
204: ; preds = %196, %191
%205 = phi i64 [ %192, %191 ], [ %203, %196 ]
%206 = sub nsw i64 0, %129
%207 = icmp eq i64 %193, %206
br i1 %207, label %225, label %208
208: ; preds = %204, %208
%209 = phi i64 [ %223, %208 ], [ %205, %204 ]
%210 = getelementptr inbounds double, double* %2, i64 %209
%211 = load double, double* %210
%212 = getelementptr inbounds double, double* %7, i64 %209
%213 = load double, double* %212
%214 = fdiv double %211, %213
%215 = getelementptr inbounds double, double* %3, i64 %209
store double %214, double* %215
%216 = add nuw nsw i64 %209, 1
%217 = getelementptr inbounds double, double* %2, i64 %216
%218 = load double, double* %217
%219 = getelementptr inbounds double, double* %7, i64 %216
%220 = load double, double* %219
%221 = fdiv double %218, %220
%222 = getelementptr inbounds double, double* %3, i64 %216
store double %221, double* %222
%223 = add nuw nsw i64 %209, 2
%224 = icmp eq i64 %223, %129
br i1 %224, label %225, label %208
225: ; preds = %204, %208, %189, %111
ret void
}