#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 const exp(double const);
double fabs(double);
double plfit_kolmogorov(double z) {
  const double fj[4] = {-2, -8, -18, -32};
  const double w = 2.50662827;
  const double c1 = -1.2337005501361697;
  const double c2 = -11.103304951225528;
  const double c3 = -30.842513753404244;
  double u = fabs(z);
  double v;
  if (u < 0.2)
    return 1;
  if (u < 0.755) {
    v = 1.0 / (u * u);
    return 1 - w * (exp(c1 * v) + exp(c2 * v) + exp(c3 * v)) / u;
  }
  if (u < 6.8116) {
    double r[4] = {0, 0, 0, 0};
    long int maxj = (long int)(3.0 / u + 0.5);
    long int j;
    if (maxj < 1)
      maxj = 1;
    v = u * u;
    for (j = 0; j < maxj; j++) {
      r[j] = exp(fj[j] * v);
    }
    return 2 * (r[0] - r[1] + r[2] - r[3]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<plfit_kolmogorov>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    0xf39(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xf36(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xf33(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xf30(%rip),%rax
mov    %rax,-0x18(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea7(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe92(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe7d(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xec4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe53(%rip),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    11ca <plfit_kolmogorov+0xaa>
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137f <plfit_kolmogorov+0x25f>
movsd  0xe56(%rip),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    1283 <plfit_kolmogorov+0x163>
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
movsd  0xe61(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe18(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xdf6(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xdc5(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  0xdbc(%rip),%xmm1
mulsd  %xmm0,%xmm1
divsd  -0x58(%rbp),%xmm1
movsd  0xddb(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137f <plfit_kolmogorov+0x25f>
movsd  0xda5(%rip),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    1377 <plfit_kolmogorov+0x257>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
movsd  0xd92(%rip),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  0xd7d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x88(%rbp)
cmpq   $0x1,-0x88(%rbp)
01
jge    12e4 <plfit_kolmogorov+0x1c4>
movq   $0x1,-0x88(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movq   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%rax
cmp    -0x88(%rbp),%rax
jge    134d <plfit_kolmogorov+0x22d>
mov    -0x90(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mulsd  -0x60(%rbp),%xmm0
call   1040 <exp@plt>
mov    -0x90(%rbp),%rax
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    12fe <plfit_kolmogorov+0x1de>
movsd  -0x80(%rbp),%xmm1
subsd  -0x78(%rbp),%xmm1
addsd  -0x70(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
movsd  0xcdf(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    137f <plfit_kolmogorov+0x25f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plfit_kolmogorov>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movapd %xmm0,%xmm2
movapd 0xedb(%rip),%xmm3
andpd  %xmm0,%xmm3
movsd  0xee7(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    1144 <plfit_kolmogorov+0x34>
movsd  0xed1(%rip),%xmm0
jmp    1273 <plfit_kolmogorov+0x163>
movsd  0xed4(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    11dc <plfit_kolmogorov+0xcc>
mulsd  %xmm2,%xmm2
movsd  0xeae(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xecc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm3,0x40(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xeb7(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1030 <exp@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe9a(%rip),%xmm0
call   1030 <exp@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe8f(%rip),%xmm0
divsd  0x40(%rsp),%xmm0
addsd  0xe39(%rip),%xmm0
jmp    1273 <plfit_kolmogorov+0x163>
xorpd  %xmm0,%xmm0
movsd  0xe40(%rip),%xmm1
ucomisd %xmm3,%xmm1
jbe    1273 <plfit_kolmogorov+0x163>
movsd  0xe36(%rip),%xmm0
divsd  %xmm3,%xmm0
xorpd  %xmm1,%xmm1
movapd %xmm1,0x30(%rsp)
addsd  0xe28(%rip),%xmm0
cvttsd2si %xmm0,%r14
movapd %xmm1,0x20(%rsp)
mulsd  %xmm2,%xmm2
lea    0xe3a(%rip),%r15
xor    %ebx,%ebx
movapd %xmm2,0x10(%rsp)
xchg   %ax,%ax
movsd  (%r15),%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
movapd 0x10(%rsp),%xmm2
movsd  %xmm0,0x20(%rsp,%rbx,8)
add    $0x1,%rbx
add    $0x8,%r15
cmp    %r14,%rbx
jl     1230 <plfit_kolmogorov+0x120>
movsd  0x20(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
subsd  0x38(%rsp),%xmm0
addsd  %xmm0,%xmm0
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.plfit_kolmogorov.fj = [4 x double] [double -2.000000e+00, double -8.000000e+00, double -1.800000e+01, double -3.200000e+01]
define double @plfit_kolmogorov(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca [4 x double]
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca [4 x double]
%12 = alloca i64
%13 = alloca i64
store double %0, double* %3
%14 = bitcast [4 x double]* %4 to i8*
store double 0x40040D931F570850, double* %5
store double 0xBFF3BD3CC9BE45DE, double* %6
store double 0xC02634E462F60E9A, double* %7
store double 0xC03ED7AEFB394D2B, double* %8
%15 = load double, double* %3
%16 = call double @llvm.fabs.f64(double %15)
store double %16, double* %9
%17 = load double, double* %9
%18 = fcmp olt double %17, 2.000000e-01
br i1 %18, label %19, label %20
19: ; preds = %1
store double 1.000000e+00, double* %2
br label %89
20: ; preds = %1
%21 = load double, double* %9
%22 = fcmp olt double %21, 7.550000e-01
br i1 %22, label %23, label %43
23: ; preds = %20
%24 = load double, double* %9
%25 = load double, double* %9
%26 = fmul double %24, %25
%27 = fdiv double 1.000000e+00, %26
store double %27, double* %10
%28 = load double, double* %10
%29 = fmul double 0xBFF3BD3CC9BE45DE, %28
%30 = call double @exp(double %29)
%31 = load double, double* %10
%32 = fmul double 0xC02634E462F60E9A, %31
%33 = call double @exp(double %32)
%34 = fadd double %30, %33
%35 = load double, double* %10
%36 = fmul double 0xC03ED7AEFB394D2B, %35
%37 = call double @exp(double %36)
%38 = fadd double %34, %37
%39 = fmul double 0x40040D931F570850, %38
%40 = load double, double* %9
%41 = fdiv double %39, %40
%42 = fsub double 1.000000e+00, %41
store double %42, double* %2
br label %89
43: ; preds = %20
%44 = load double, double* %9
%45 = fcmp olt double %44, 6.811600e+00
br i1 %45, label %46, label %88
46: ; preds = %43
%47 = bitcast [4 x double]* %11 to i8*
%48 = load double, double* %9
%49 = fdiv double 3.000000e+00, %48
%50 = fadd double %49, 5.000000e-01
%51 = fptosi double %50 to i64
store i64 %51, i64* %12
%52 = load i64, i64* %12
%53 = icmp slt i64 %52, 1
br i1 %53, label %54, label %55
54: ; preds = %46
store i64 1, i64* %12
br label %55
55: ; preds = %54, %46
%56 = load double, double* %9
%57 = load double, double* %9
%58 = fmul double %56, %57
store double %58, double* %10
store i64 0, i64* %13
br label %59
59: ; preds = %72, %55
%60 = load i64, i64* %13
%61 = load i64, i64* %12
%62 = icmp slt i64 %60, %61
br i1 %62, label %63, label %75
63: ; preds = %59
%64 = load i64, i64* %13
%65 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 %64
%66 = load double, double* %65
%67 = load double, double* %10
%68 = fmul double %66, %67
%69 = call double @exp(double %68)
%70 = load i64, i64* %13
%71 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 %70
store double %69, double* %71
br label %72
72: ; preds = %63
%73 = load i64, i64* %13
%74 = add nsw i64 %73, 1
store i64 %74, i64* %13
br label %59
75: ; preds = %59
%76 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
%77 = load double, double* %76
%78 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 1
%79 = load double, double* %78
%80 = fsub double %77, %79
%81 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 2
%82 = load double, double* %81
%83 = fadd double %80, %82
%84 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 3
%85 = load double, double* %84
%86 = fsub double %83, %85
%87 = fmul double 2.000000e+00, %86
store double %87, double* %2
br label %89
88: ; preds = %43
store double 0.000000e+00, double* %2
br label %89
89: ; preds = %88, %75, %23, %19
%90 = load double, double* %2
ret double %90
}

LLVM IR (-O2):
@__const.plfit_kolmogorov.fj = [4 x double] [double -2.000000e+00, double -8.000000e+00, double -1.800000e+01, double -3.200000e+01]
define double @plfit_kolmogorov(double %0) {
%2 = alloca [4 x double]
%3 = tail call double @llvm.fabs.f64(double %0)
%4 = fcmp olt double %3, 2.000000e-01
br i1 %4, label %53, label %5
5: ; preds = %1
%6 = fcmp olt double %3, 7.550000e-01
br i1 %6, label %7, label %21
7: ; preds = %5
%8 = fmul double %0, %0
%9 = fdiv double 1.000000e+00, %8
%10 = fmul double %9, 0xBFF3BD3CC9BE45DE
%11 = tail call double @exp(double %10)
%12 = fmul double %9, 0xC02634E462F60E9A
%13 = tail call double @exp(double %12)
%14 = fadd double %11, %13
%15 = fmul double %9, 0xC03ED7AEFB394D2B
%16 = tail call double @exp(double %15)
%17 = fadd double %14, %16
%18 = fmul double %17, 0x40040D931F570850
%19 = fdiv double %18, %3
%20 = fsub double 1.000000e+00, %19
br label %53
21: ; preds = %5
%22 = fcmp olt double %3, 6.811600e+00
br i1 %22, label %23, label %53
23: ; preds = %21
%24 = bitcast [4 x double]* %2 to i8*
%25 = fdiv double 3.000000e+00, %3
%26 = fadd double %25, 5.000000e-01
%27 = fptosi double %26 to i64
%28 = icmp sgt i64 %27, 1
%29 = select i1 %28, i64 %27, i64 1
%30 = fmul double %0, %0
br label %31
31: ; preds = %23, %31
%32 = phi i64 [ 0, %23 ], [ %38, %31 ]
%33 = getelementptr inbounds [4 x double], [4 x double]* @__const.plfit_kolmogorov.fj, i64 0, i64 %32
%34 = load double, double* %33
%35 = fmul double %30, %34
%36 = tail call double @exp(double %35)
%37 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 %32
store double %36, double* %37
%38 = add nuw nsw i64 %32, 1
%39 = icmp eq i64 %38, %29
br i1 %39, label %40, label %31
40: ; preds = %31
%41 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%42 = load double, double* %41
%43 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 1
%44 = load double, double* %43
%45 = fsub double %42, %44
%46 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 2
%47 = load double, double* %46
%48 = fadd double %45, %47
%49 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 3
%50 = load double, double* %49
%51 = fsub double %48, %50
%52 = fmul double %51, 2.000000e+00
br label %53
53: ; preds = %21, %1, %40, %7
%54 = phi double [ %20, %7 ], [ %52, %40 ], [ 1.000000e+00, %1 ], [ 0.000000e+00, %21 ]
ret double %54
}