#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 exp(double);
double fabs(double);
double pow(double, double);
double tukeylambdacdf(double x, double lmbda) {
  double pmin, pmid, pmax, plow, phigh, xeval;
  int count;
  xeval = 1.0 / lmbda;
  if (lmbda > 0.0) {
    if (x < (-xeval))
      return 0.0;
    if (x > xeval)
      return 1.0;
  }
  if ((-1e-4 < lmbda) && (lmbda < 1e-4)) {
    if (x >= 0)
      return 1.0 / (1.0 + exp(-x));
    else
      return exp(x) / (1.0 + exp(x));
  }
  pmin = 0.0;
  pmid = 0.5;
  pmax = 1.0;
  plow = pmin;
  phigh = pmax;
  count = 0;
  while ((count < 60) && (fabs(pmid - plow) > 1.0e-14)) {
    xeval = (pow(pmid, lmbda) - pow(1.0 - pmid, lmbda)) / lmbda;
    if (xeval == x)
      return pmid;
    if (xeval > x) {
      phigh = pmid;
      pmid = (pmid + plow) / 2.0;
    } else {
      plow = pmid;
      pmid = (pmid + phigh) / 2.0;
    }
    count++;
  }
  return pmid;
}


x86 assembly (clang, -O0):
<tukeylambdacdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xec6(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11b5 <tukeylambdacdf+0x95>
movsd  -0x10(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    118e <tukeylambdacdf+0x6e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13cf <tukeylambdacdf+0x2af>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    11b0 <tukeylambdacdf+0x90>
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13cf <tukeylambdacdf+0x2af>
jmp    11b5 <tukeylambdacdf+0x95>
movsd  -0x18(%rbp),%xmm0
movsd  0xe46(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    126f <tukeylambdacdf+0x14f>
movsd  0xe3c(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    126f <tukeylambdacdf+0x14f>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1234 <tukeylambdacdf+0x114>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  0xde6(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xdda(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13cf <tukeylambdacdf+0x2af>
movsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
movsd  0xda3(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13cf <tukeylambdacdf+0x2af>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xd99(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd74(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x4c(%rbp)
xor    %eax,%eax
cmpl   $0x3c,-0x4c(%rbp)
mov    %al,-0x59(%rbp)
jge    12e2 <tukeylambdacdf+0x1c2>
movsd  -0x28(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movaps 0xd64(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd48(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    12f2 <tukeylambdacdf+0x1d2>
jmp    13c5 <tukeylambdacdf+0x2a5>
movsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  0xcf2(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    1358 <tukeylambdacdf+0x238>
jp     1358 <tukeylambdacdf+0x238>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13cf <tukeylambdacdf+0x2af>
movsd  -0x48(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1392 <tukeylambdacdf+0x272>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xca4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    13b7 <tukeylambdacdf+0x297>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  0xc7a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12ac <tukeylambdacdf+0x18c>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tukeylambdacdf>:
push   %rbx
sub    $0x50,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    1168 <tukeylambdacdf+0x48>
movsd  0xec5(%rip),%xmm3
divsd  %xmm1,%xmm3
movapd 0xee9(%rip),%xmm4
xorpd  %xmm3,%xmm4
ucomisd %xmm2,%xmm4
ja     12d6 <tukeylambdacdf+0x1b6>
ucomisd %xmm3,%xmm2
jbe    1168 <tukeylambdacdf+0x48>
movsd  0xe9d(%rip),%xmm0
jmp    12d6 <tukeylambdacdf+0x1b6>
ucomisd 0xe98(%rip),%xmm1
movapd %xmm2,0x20(%rsp)
jbe    11a8 <tukeylambdacdf+0x88>
movsd  0xe90(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a8 <tukeylambdacdf+0x88>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jae    1299 <tukeylambdacdf+0x179>
movapd %xmm2,%xmm0
call   1030 <exp@plt>
movapd 0x20(%rsp),%xmm2
jmp    12a9 <tukeylambdacdf+0x189>
movsd  0xe68(%rip),%xmm0
xorpd  %xmm3,%xmm3
mov    $0x3c,%ebx
movsd  0xe3f(%rip),%xmm4
movsd  %xmm1,0x10(%rsp)
jmp    11f6 <tukeylambdacdf+0xd6>
nopl   0x0(%rax)
cmpltsd %xmm7,%xmm2
andpd  %xmm2,%xmm5
andnpd %xmm6,%xmm2
orpd   %xmm5,%xmm2
addsd  %xmm2,%xmm0
mulsd  0xe2b(%rip),%xmm0
add    $0xffffffff,%ebx
je     12d6 <tukeylambdacdf+0x1b6>
movapd %xmm0,%xmm2
subsd  %xmm3,%xmm2
andpd  0xe3a(%rip),%xmm2
ucomisd 0xe12(%rip),%xmm2
jbe    12d6 <tukeylambdacdf+0x1b6>
movapd %xmm4,0x30(%rsp)
movapd %xmm3,0x40(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1040 <pow@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0xdc7(%rip),%xmm0
subsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <pow@plt>
movsd  0x18(%rsp),%xmm7
movsd  0x10(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
subsd  %xmm0,%xmm7
divsd  %xmm1,%xmm7
ucomisd %xmm2,%xmm7
jne    126c <tukeylambdacdf+0x14c>
jnp    12d0 <tukeylambdacdf+0x1b0>
movapd 0x40(%rsp),%xmm5
movapd %xmm5,%xmm3
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm4
movapd 0x30(%rsp),%xmm6
ja     11d0 <tukeylambdacdf+0xb0>
movapd %xmm0,%xmm3
movapd %xmm6,%xmm4
jmp    11d0 <tukeylambdacdf+0xb0>
xorpd  0xd8f(%rip),%xmm2
movsd  0xd57(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm2,%xmm0
call   1030 <exp@plt>
addsd  0xd40(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    12d6 <tukeylambdacdf+0x1b6>
movsd  0x8(%rsp),%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @tukeylambdacdf(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
store double %0, double* %4
store double %1, double* %5
%13 = load double, double* %5
%14 = fdiv double 1.000000e+00, %13
store double %14, double* %11
%15 = load double, double* %5
%16 = fcmp ogt double %15, 0.000000e+00
br i1 %16, label %17, label %29
17: ; preds = %2
%18 = load double, double* %4
%19 = load double, double* %11
%20 = fneg double %19
%21 = fcmp olt double %18, %20
br i1 %21, label %22, label %23
22: ; preds = %17
store double 0.000000e+00, double* %3
br label %102
23: ; preds = %17
%24 = load double, double* %4
%25 = load double, double* %11
%26 = fcmp ogt double %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store double 1.000000e+00, double* %3
br label %102
28: ; preds = %23
br label %29
29: ; preds = %28, %2
%30 = load double, double* %5
%31 = fcmp olt double -1.000000e-04, %30
br i1 %31, label %32, label %51
32: ; preds = %29
%33 = load double, double* %5
%34 = fcmp olt double %33, 1.000000e-04
br i1 %34, label %35, label %51
35: ; preds = %32
%36 = load double, double* %4
%37 = fcmp oge double %36, 0.000000e+00
br i1 %37, label %38, label %44
38: ; preds = %35
%39 = load double, double* %4
%40 = fneg double %39
%41 = call double @exp(double %40)
%42 = fadd double 1.000000e+00, %41
%43 = fdiv double 1.000000e+00, %42
store double %43, double* %3
br label %102
44: ; preds = %35
%45 = load double, double* %4
%46 = call double @exp(double %45)
%47 = load double, double* %4
%48 = call double @exp(double %47)
%49 = fadd double 1.000000e+00, %48
%50 = fdiv double %46, %49
store double %50, double* %3
br label %102
51: ; preds = %32, %29
store double 0.000000e+00, double* %6
store double 5.000000e-01, double* %7
store double 1.000000e+00, double* %8
%52 = load double, double* %6
store double %52, double* %9
%53 = load double, double* %8
store double %53, double* %10
store i32 0, i32* %12
br label %54
54: ; preds = %97, %51
%55 = load i32, i32* %12
%56 = icmp slt i32 %55, 60
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = load double, double* %7
%59 = load double, double* %9
%60 = fsub double %58, %59
%61 = call double @llvm.fabs.f64(double %60)
%62 = fcmp ogt double %61, 0x3D06849B86A12B9B
br label %63
63: ; preds = %57, %54
%64 = phi i1 [ false, %54 ], [ %62, %57 ]
br i1 %64, label %65, label %100
65: ; preds = %63
%66 = load double, double* %7
%67 = load double, double* %5
%68 = call double @pow(double %66, double %67)
%69 = load double, double* %7
%70 = fsub double 1.000000e+00, %69
%71 = load double, double* %5
%72 = call double @pow(double %70, double %71)
%73 = fsub double %68, %72
%74 = load double, double* %5
%75 = fdiv double %73, %74
store double %75, double* %11
%76 = load double, double* %11
%77 = load double, double* %4
%78 = fcmp oeq double %76, %77
br i1 %78, label %79, label %81
79: ; preds = %65
%80 = load double, double* %7
store double %80, double* %3
br label %102
81: ; preds = %65
%82 = load double, double* %11
%83 = load double, double* %4
%84 = fcmp ogt double %82, %83
br i1 %84, label %85, label %91
85: ; preds = %81
%86 = load double, double* %7
store double %86, double* %10
%87 = load double, double* %7
%88 = load double, double* %9
%89 = fadd double %87, %88
%90 = fdiv double %89, 2.000000e+00
store double %90, double* %7
br label %97
91: ; preds = %81
%92 = load double, double* %7
store double %92, double* %9
%93 = load double, double* %7
%94 = load double, double* %10
%95 = fadd double %93, %94
%96 = fdiv double %95, 2.000000e+00
store double %96, double* %7
br label %97
97: ; preds = %91, %85
%98 = load i32, i32* %12
%99 = add nsw i32 %98, 1
store i32 %99, i32* %12
br label %54
100: ; preds = %63
%101 = load double, double* %7
store double %101, double* %3
br label %102
102: ; preds = %100, %79, %44, %38, %27, %22
%103 = load double, double* %3
ret double %103
}

LLVM IR (-O2):
define double @tukeylambdacdf(double %0, double %1) {
%3 = fdiv double 1.000000e+00, %1
%4 = fcmp ogt double %1, 0.000000e+00
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = fneg double %3
%7 = fcmp ogt double %6, %0
br i1 %7, label %50, label %8
8: ; preds = %5
%9 = fcmp olt double %3, %0
br i1 %9, label %50, label %10
10: ; preds = %8, %2
%11 = fcmp ogt double %1, -1.000000e-04
%12 = fcmp olt double %1, 1.000000e-04
%13 = and i1 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = fcmp ult double %0, 0.000000e+00
br i1 %15, label %18, label %16
16: ; preds = %14
%17 = fneg double %0
br label %44
18: ; preds = %14
%19 = tail call double @exp(double %0)
br label %44
20: ; preds = %10, %35
%21 = phi i32 [ %42, %35 ], [ 0, %10 ]
%22 = phi double [ %39, %35 ], [ 1.000000e+00, %10 ]
%23 = phi double [ %38, %35 ], [ 0.000000e+00, %10 ]
%24 = phi double [ %41, %35 ], [ 5.000000e-01, %10 ]
%25 = fsub double %24, %23
%26 = tail call double @llvm.fabs.f64(double %25)
%27 = fcmp ogt double %26, 0x3D06849B86A12B9B
br i1 %27, label %28, label %50
28: ; preds = %20
%29 = tail call double @pow(double %24, double %1)
%30 = fsub double 1.000000e+00, %24
%31 = tail call double @pow(double %30, double %1)
%32 = fsub double %29, %31
%33 = fdiv double %32, %1
%34 = fcmp oeq double %33, %0
br i1 %34, label %50, label %35
35: ; preds = %28
%36 = fcmp ogt double %33, %0
%37 = select i1 %36, double %23, double %22
%38 = select i1 %36, double %23, double %24
%39 = select i1 %36, double %24, double %22
%40 = fadd double %24, %37
%41 = fmul double %40, 5.000000e-01
%42 = add nuw nsw i32 %21, 1
%43 = icmp eq i32 %42, 60
br i1 %43, label %50, label %20
44: ; preds = %16, %18
%45 = phi double [ %0, %18 ], [ %17, %16 ]
%46 = phi double [ %19, %18 ], [ 1.000000e+00, %16 ]
%47 = tail call double @exp(double %45)
%48 = fadd double %47, 1.000000e+00
%49 = fdiv double %46, %48
br label %50
50: ; preds = %20, %35, %28, %44, %8, %5
%51 = phi double [ 0.000000e+00, %5 ], [ 1.000000e+00, %8 ], [ %49, %44 ], [ %24, %28 ], [ %41, %35 ], [ %24, %20 ]
ret double %51
}