#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);
double log(int);
double sqrt(double);
void ClassifySegments(double *SegAmp, int *SegLen, double *SegState, int K,
                      double BaseAmp, double ploidy, double sigma2, double T) {
  int k;
  double c;
  double aux;
  for (k = 0; k <= K; k++) {
    if (fabs(SegAmp[k] - BaseAmp) / sqrt(sigma2 / (double)SegLen[k]) < T) {
      SegState[k] = ploidy;
    } else if ((SegAmp[k] - BaseAmp) > 0) {
      for (c = ploidy; c < 100; c++) {
        aux = (SegAmp[k] - BaseAmp - log(c) / log(2) + log(ploidy) / log(2)) /
              sqrt(sigma2 / (double)SegLen[k]);
        if ((SegAmp[k] - BaseAmp - log(c) / log(2) + log(ploidy) / log(2)) /
                sqrt(sigma2 / (double)SegLen[k]) <
            T) {
          break;
        }
      }
      SegState[k] = c;
    } else if ((SegAmp[k] - BaseAmp) < 0) {
      for (c = ploidy; c > 0; c--) {
        if ((SegAmp[k] - BaseAmp - log(c) / log(2) + log(ploidy) / log(2)) /
                sqrt(sigma2 / (double)SegLen[k]) >
            -T) {
          break;
        }
      }
      SegState[k] = c;
    }
  }
}


x86 assembly (clang, -O0):
<ClassifySegments>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
movsd  %xmm3,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1531 <ClassifySegments+0x411>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x28(%rbp),%xmm0
movaps 0xe86(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x60(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11cd <ClassifySegments+0xad>
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    151e <ClassifySegments+0x3fe>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13be <ClassifySegments+0x29e>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe1a(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    13a7 <ClassifySegments+0x287>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
cvttsd2si -0x50(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
mov    $0x2,%edi
call   1030 <log@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
cvttsd2si -0x30(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
mov    $0x2,%edi
call   1030 <log@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
cvttsd2si -0x50(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    $0x2,%edi
call   1030 <log@plt>
movsd  -0x88(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
cvttsd2si -0x30(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x78(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x68(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    138b <ClassifySegments+0x26b>
jmp    13a7 <ClassifySegments+0x287>
jmp    1390 <ClassifySegments+0x270>
movsd  0xc88(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11f6 <ClassifySegments+0xd6>
movsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1519 <ClassifySegments+0x3f9>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x28(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1514 <ClassifySegments+0x3f4>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1502 <ClassifySegments+0x3e2>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
cvttsd2si -0x50(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
mov    $0x2,%edi
call   1030 <log@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
cvttsd2si -0x30(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
mov    $0x2,%edi
call   1030 <log@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
jbe    14e6 <ClassifySegments+0x3c6>
jmp    1502 <ClassifySegments+0x3e2>
jmp    14eb <ClassifySegments+0x3cb>
movsd  0xb1d(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13e7 <ClassifySegments+0x2c7>
movsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1519 <ClassifySegments+0x3f9>
jmp    151e <ClassifySegments+0x3fe>
jmp    1523 <ClassifySegments+0x403>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1155 <ClassifySegments+0x35>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClassifySegments>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movapd %xmm3,0x50(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rdx,0x98(%rsp)
test   %ecx,%ecx
js     14e6 <ClassifySegments+0x3c6>
mov    %ecx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r12
cvttsd2si 0x8(%rsp),%r13d
movapd 0xe95(%rip),%xmm0
xorpd  0x50(%rsp),%xmm0
movapd %xmm0,0xa0(%rsp)
add    $0x1,%r15d
xor    %r14d,%r14d
xorpd  %xmm3,%xmm3
movsd  %xmm2,0x18(%rsp)
jmp    11b5 <ClassifySegments+0x95>
nopl   (%rax)
mov    0x98(%rsp),%rax
movsd  %xmm2,(%rax,%r14,8)
xorpd  %xmm3,%xmm3
add    $0x1,%r14
cmp    %r15,%r14
movsd  0x18(%rsp),%xmm2
je     14e6 <ClassifySegments+0x3c6>
xorps  %xmm1,%xmm1
cvtsi2sdl (%rbx,%r14,4),%xmm1
movsd  (%r12,%r14,8),%xmm4
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
ucomisd %xmm3,%xmm0
jb     11e0 <ClassifySegments+0xc0>
sqrtsd %xmm0,%xmm0
jmp    11f1 <ClassifySegments+0xd1>
nopl   0x0(%rax,%rax,1)
movapd %xmm4,0x20(%rsp)
call   1040 <sqrt@plt>
movapd 0x20(%rsp),%xmm4
subsd  0x10(%rsp),%xmm4
andpd  0xe11(%rip),%xmm4
divsd  %xmm0,%xmm4
movapd 0x50(%rsp),%xmm0
ucomisd %xmm4,%xmm0
movsd  0x8(%rsp),%xmm2
ja     1190 <ClassifySegments+0x70>
movsd  (%r12,%r14,8),%xmm1
movapd %xmm1,%xmm0
subsd  0x10(%rsp),%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jbe    13c0 <ClassifySegments+0x2a0>
movsd  0x8(%rsp),%xmm0
movsd  0xde3(%rip),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm0,%xmm2
jbe    1190 <ClassifySegments+0x70>
movsd  0x8(%rsp),%xmm2
nopl   0x0(%rax)
movsd  %xmm2,0x20(%rsp)
cvttsd2si %xmm2,%ebp
mov    %ebp,%edi
call   1030 <log@plt>
mov    $0x2,%edi
call   1030 <log@plt>
mov    %r13d,%edi
call   1030 <log@plt>
mov    $0x2,%edi
call   1030 <log@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl (%rbx,%r14,4),%xmm1
movsd  0x18(%rsp),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     139f <ClassifySegments+0x27f>
movsd  (%r12,%r14,8),%xmm0
movsd  %xmm0,0x80(%rsp)
mov    %ebp,%edi
call   1030 <log@plt>
movapd %xmm0,0x70(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
movapd %xmm0,0x60(%rsp)
mov    %r13d,%edi
call   1030 <log@plt>
movapd %xmm0,0x30(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
xorpd  %xmm2,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sdl (%rbx,%r14,4),%xmm1
movapd %xmm0,%xmm5
movsd  0x18(%rsp),%xmm0
divsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
jb     1320 <ClassifySegments+0x200>
sqrtsd %xmm0,%xmm0
jmp    1331 <ClassifySegments+0x211>
nopl   0x0(%rax)
movapd %xmm5,0x40(%rsp)
call   1040 <sqrt@plt>
movapd 0x40(%rsp),%xmm5
movsd  0x20(%rsp),%xmm2
movsd  0x80(%rsp),%xmm1
subsd  0x10(%rsp),%xmm1
movapd 0x70(%rsp),%xmm3
unpcklpd 0x30(%rsp),%xmm3
movapd 0x60(%rsp),%xmm4
unpcklpd %xmm5,%xmm4
divpd  %xmm4,%xmm3
subsd  %xmm3,%xmm1
unpckhpd %xmm3,%xmm3
addsd  %xmm1,%xmm3
divsd  %xmm0,%xmm3
movapd 0x50(%rsp),%xmm0
ucomisd %xmm3,%xmm0
ja     1190 <ClassifySegments+0x70>
addsd  0xca8(%rip),%xmm2
movsd  0xc98(%rip),%xmm0
ucomisd %xmm2,%xmm0
ja     1260 <ClassifySegments+0x140>
jmp    1190 <ClassifySegments+0x70>
ucomisd %xmm1,%xmm0
jae    12ae <ClassifySegments+0x18e>
call   1040 <sqrt@plt>
jmp    12ae <ClassifySegments+0x18e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
ucomisd %xmm0,%xmm3
jbe    11a2 <ClassifySegments+0x82>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm3,%xmm0
movapd %xmm0,%xmm2
jbe    1190 <ClassifySegments+0x70>
movsd  %xmm1,0x30(%rsp)
movsd  0x8(%rsp),%xmm2
nopw   0x0(%rax,%rax,1)
movsd  %xmm2,0x20(%rsp)
cvttsd2si %xmm2,%edi
call   1030 <log@plt>
movapd %xmm0,0x80(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
movapd %xmm0,0x70(%rsp)
mov    %r13d,%edi
call   1030 <log@plt>
movapd %xmm0,0x60(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl (%rbx,%r14,4),%xmm1
movapd %xmm0,%xmm5
movsd  0x18(%rsp),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1460 <ClassifySegments+0x340>
sqrtsd %xmm0,%xmm0
jmp    1475 <ClassifySegments+0x355>
nopw   0x0(%rax,%rax,1)
movapd %xmm5,0x40(%rsp)
call   1040 <sqrt@plt>
movapd 0x40(%rsp),%xmm5
xorpd  %xmm1,%xmm1
movsd  0x30(%rsp),%xmm2
subsd  0x10(%rsp),%xmm2
movapd 0x80(%rsp),%xmm3
unpcklpd 0x60(%rsp),%xmm3
movapd 0x70(%rsp),%xmm4
unpcklpd %xmm5,%xmm4
divpd  %xmm4,%xmm3
subsd  %xmm3,%xmm2
unpckhpd %xmm3,%xmm3
addsd  %xmm2,%xmm3
divsd  %xmm0,%xmm3
ucomisd 0xa0(%rsp),%xmm3
movsd  0x20(%rsp),%xmm2
ja     1190 <ClassifySegments+0x70>
addsd  0xb55(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    1190 <ClassifySegments+0x70>
movsd  (%r12,%r14,8),%xmm0
movsd  %xmm0,0x30(%rsp)
jmp    13f0 <ClassifySegments+0x2d0>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ClassifySegments(double* nocapture %0, i32* nocapture %1, double* nocapture writeonly %2, i32 %3, double %4, double %5, double %6, double %7) {
%9 = icmp slt i32 %3, 0
br i1 %9, label %111, label %10
10: ; preds = %8
%11 = fcmp ogt double %5, 0.000000e+00
%12 = fptosi double %5 to i32
%13 = fneg double %7
%14 = fcmp olt double %5, 1.000000e+02
%15 = add nuw i32 %3, 1
%16 = zext i32 %15 to i64
br label %17
17: ; preds = %10, %108
%18 = phi i64 [ 0, %10 ], [ %109, %108 ]
%19 = getelementptr inbounds double, double* %0, i64 %18
%20 = load double, double* %19
%21 = fsub double %20, %4
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = getelementptr inbounds i32, i32* %1, i64 %18
%24 = load i32, i32* %23
%25 = sitofp i32 %24 to double
%26 = fdiv double %6, %25
%27 = tail call double @sqrt(double %26)
%28 = fdiv double %22, %27
%29 = fcmp olt double %28, %7
br i1 %29, label %105, label %30
30: ; preds = %17
%31 = load double, double* %19
%32 = fsub double %31, %4
%33 = fcmp ogt double %32, 0.000000e+00
br i1 %33, label %34, label %73
34: ; preds = %30
br i1 %14, label %35, label %105
35: ; preds = %34, %70
%36 = phi double [ %71, %70 ], [ %5, %34 ]
%37 = fptosi double %36 to i32
%38 = tail call double @log(i32 %37)
%39 = tail call double @log(i32 2)
%40 = tail call double @log(i32 %12)
%41 = tail call double @log(i32 2)
%42 = load i32, i32* %23
%43 = sitofp i32 %42 to double
%44 = fdiv double %6, %43
%45 = fcmp olt double %44, 0.000000e+00
br i1 %45, label %46, label %48
46: ; preds = %35
%47 = tail call double @sqrt(double %44)
br label %48
48: ; preds = %35, %46
%49 = load double, double* %19
%50 = fsub double %49, %4
%51 = tail call double @log(i32 %37)
%52 = tail call double @log(i32 2)
%53 = tail call double @log(i32 %12)
%54 = tail call double @log(i32 2)
%55 = insertelement <2 x double> poison, double %51, i64 0
%56 = insertelement <2 x double> %55, double %53, i64 1
%57 = insertelement <2 x double> poison, double %52, i64 0
%58 = insertelement <2 x double> %57, double %54, i64 1
%59 = fdiv <2 x double> %56, %58
%60 = extractelement <2 x double> %59, i64 0
%61 = fsub double %50, %60
%62 = extractelement <2 x double> %59, i64 1
%63 = fadd double %61, %62
%64 = load i32, i32* %23
%65 = sitofp i32 %64 to double
%66 = fdiv double %6, %65
%67 = tail call double @sqrt(double %66)
%68 = fdiv double %63, %67
%69 = fcmp olt double %68, %7
br i1 %69, label %105, label %70
70: ; preds = %48
%71 = fadd double %36, 1.000000e+00
%72 = fcmp olt double %71, 1.000000e+02
br i1 %72, label %35, label %105
73: ; preds = %30
%74 = fcmp olt double %32, 0.000000e+00
br i1 %74, label %75, label %108
75: ; preds = %73
br i1 %11, label %76, label %105
76: ; preds = %75, %103
%77 = phi double [ %104, %103 ], [ %31, %75 ]
%78 = phi double [ %101, %103 ], [ %5, %75 ]
%79 = fsub double %77, %4
%80 = fptosi double %78 to i32
%81 = tail call double @log(i32 %80)
%82 = tail call double @log(i32 2)
%83 = tail call double @log(i32 %12)
%84 = tail call double @log(i32 2)
%85 = insertelement <2 x double> poison, double %81, i64 0
%86 = insertelement <2 x double> %85, double %83, i64 1
%87 = insertelement <2 x double> poison, double %82, i64 0
%88 = insertelement <2 x double> %87, double %84, i64 1
%89 = fdiv <2 x double> %86, %88
%90 = extractelement <2 x double> %89, i64 0
%91 = fsub double %79, %90
%92 = extractelement <2 x double> %89, i64 1
%93 = fadd double %91, %92
%94 = load i32, i32* %23
%95 = sitofp i32 %94 to double
%96 = fdiv double %6, %95
%97 = tail call double @sqrt(double %96)
%98 = fdiv double %93, %97
%99 = fcmp ogt double %98, %13
br i1 %99, label %105, label %100
100: ; preds = %76
%101 = fadd double %78, -1.000000e+00
%102 = fcmp ogt double %101, 0.000000e+00
br i1 %102, label %103, label %105
103: ; preds = %100
%104 = load double, double* %19
br label %76
105: ; preds = %76, %100, %48, %70, %75, %34, %17
%106 = phi double [ %5, %17 ], [ %5, %34 ], [ %5, %75 ], [ %36, %48 ], [ %71, %70 ], [ %78, %76 ], [ %101, %100 ]
%107 = getelementptr inbounds double, double* %2, i64 %18
store double %106, double* %107
br label %108
108: ; preds = %105, %73
%109 = add nuw nsw i64 %18, 1
%110 = icmp eq i64 %109, %16
br i1 %110, label %111, label %17
111: ; preds = %108, %8
ret void
}