#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 DurbinMatrix(int, double);
double KSfbar(int, double);
double Pelz(int, double);
double Pomeranz(int, double);
double cdfSpecial(int, double);
double KScdf(int n, double x) {
  const double w = n * x * x;
  double u = cdfSpecial(n, x);
  if (u >= 0.0)
    return u;
  if (n <= 500) {
    if (w < 0.754693)
      return DurbinMatrix(n, x);
    if (w < 4.0)
      return Pomeranz(n, x);
    return 1.0 - KSfbar(n, x);
  }
  if ((w * x * n <= 7.0) && (n <= 100000))
    return DurbinMatrix(n, x);
  return Pelz(n, x);
}


x86 assembly (clang, -O0):
<KScdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1070 <cdfSpecial@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11a7 <KScdf+0x57>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1289 <KScdf+0x139>
cmpl   $0x1f4,-0xc(%rbp)
jg     122e <KScdf+0xde>
movsd  0xe4c(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11de <KScdf+0x8e>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1030 <DurbinMatrix@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1289 <KScdf+0x139>
movsd  0xe2a(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1208 <KScdf+0xb8>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1040 <Pomeranz@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1289 <KScdf+0x139>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1060 <KSfbar@plt>
movaps %xmm0,%xmm1
movsd  0xdf8(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1289 <KScdf+0x139>
movsd  -0x20(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdb7(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1277 <KScdf+0x127>
cmpl   $0x186a0,-0xc(%rbp)
jg     1277 <KScdf+0x127>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1030 <DurbinMatrix@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1289 <KScdf+0x139>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1050 <Pelz@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KScdf>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movsd  %xmm0,0x8(%rsp)
call   1070 <cdfSpecial@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    1204 <KScdf+0xb4>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movapd %xmm1,%xmm2
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
cmp    $0x1f4,%ebx
jg     11b9 <KScdf+0x69>
movsd  0xe6f(%rip),%xmm1
ucomisd %xmm2,%xmm1
ja     11d7 <KScdf+0x87>
movsd  0xe69(%rip),%xmm1
mov    %ebx,%edi
ucomisd %xmm2,%xmm1
jbe    11ef <KScdf+0x9f>
add    $0x10,%rsp
pop    %rbx
jmp    1040 <Pomeranz@plt>
cmp    $0x186a0,%ebx
ja     11e3 <KScdf+0x93>
mulsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xe2f(%rip),%xmm1
ucomisd %xmm2,%xmm1
jb     11e3 <KScdf+0x93>
mov    %ebx,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <DurbinMatrix@plt>
mov    %ebx,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <Pelz@plt>
call   1060 <KSfbar@plt>
movapd %xmm0,%xmm1
movsd  0xe18(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @KScdf(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to double
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = load double, double* %5
%13 = fmul double %11, %12
store double %13, double* %6
%14 = load i32, i32* %4
%15 = load double, double* %5
%16 = call double @cdfSpecial(i32 %14, double %15)
store double %16, double* %7
%17 = load double, double* %7
%18 = fcmp oge double %17, 0.000000e+00
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = load double, double* %7
store double %20, double* %3
br label %62
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp sle i32 %22, 500
br i1 %23, label %24, label %43
24: ; preds = %21
%25 = load double, double* %6
%26 = fcmp olt double %25, 7.546930e-01
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %4
%29 = load double, double* %5
%30 = call double @DurbinMatrix(i32 %28, double %29)
store double %30, double* %3
br label %62
31: ; preds = %24
%32 = load double, double* %6
%33 = fcmp olt double %32, 4.000000e+00
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %4
%36 = load double, double* %5
%37 = call double @Pomeranz(i32 %35, double %36)
store double %37, double* %3
br label %62
38: ; preds = %31
%39 = load i32, i32* %4
%40 = load double, double* %5
%41 = call double @KSfbar(i32 %39, double %40)
%42 = fsub double 1.000000e+00, %41
store double %42, double* %3
br label %62
43: ; preds = %21
%44 = load double, double* %6
%45 = load double, double* %5
%46 = fmul double %44, %45
%47 = load i32, i32* %4
%48 = sitofp i32 %47 to double
%49 = fmul double %46, %48
%50 = fcmp ole double %49, 7.000000e+00
br i1 %50, label %51, label %58
51: ; preds = %43
%52 = load i32, i32* %4
%53 = icmp sle i32 %52, 100000
br i1 %53, label %54, label %58
54: ; preds = %51
%55 = load i32, i32* %4
%56 = load double, double* %5
%57 = call double @DurbinMatrix(i32 %55, double %56)
store double %57, double* %3
br label %62
58: ; preds = %51, %43
%59 = load i32, i32* %4
%60 = load double, double* %5
%61 = call double @Pelz(i32 %59, double %60)
store double %61, double* %3
br label %62
62: ; preds = %58, %54, %38, %34, %27, %19
%63 = load double, double* %3
ret double %63
}

LLVM IR (-O2):
define double @KScdf(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = fmul double %3, %1
%5 = fmul double %4, %1
%6 = tail call double @cdfSpecial(i32 %0, double %1)
%7 = fcmp ult double %6, 0.000000e+00
br i1 %7, label %8, label %31
8: ; preds = %2
%9 = icmp slt i32 %0, 501
br i1 %9, label %10, label %21
10: ; preds = %8
%11 = fcmp olt double %5, 7.546930e-01
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = tail call double @DurbinMatrix(i32 %0, double %1)
br label %31
14: ; preds = %10
%15 = fcmp olt double %5, 4.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = tail call double @Pomeranz(i32 %0, double %1)
br label %31
18: ; preds = %14
%19 = tail call double @KSfbar(i32 %0, double %1)
%20 = fsub double 1.000000e+00, %19
br label %31
21: ; preds = %8
%22 = fmul double %5, %1
%23 = fmul double %22, %3
%24 = fcmp ole double %23, 7.000000e+00
%25 = icmp ult i32 %0, 100001
%26 = and i1 %25, %24
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = tail call double @DurbinMatrix(i32 %0, double %1)
br label %31
29: ; preds = %21
%30 = tail call double @Pelz(i32 %0, double %1)
br label %31
31: ; preds = %2, %29, %27, %18, %16, %12
%32 = phi double [ %13, %12 ], [ %17, %16 ], [ %20, %18 ], [ %28, %27 ], [ %30, %29 ], [ %6, %2 ]
ret double %32
}