#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 */
int /*<<< orphan*/ assert(int);
double exp(double);
double fabs(double);
double lgamma(double);
double log(double);
void gcf(double *gammcf, double a, double x, double *gln) {
  int i;
  double an, b, c, d, del, h;
  *gln = lgamma(a);
  b = x + 1.0 - a;
  c = 1.0 / 1.0e-30;
  d = 1.0 / b;
  h = d;
  for (i = 1; i <= 100; i++) {
    an = -i * (i - a);
    b += 2.0;
    d = an * d + b;
    if (fabs(d) < 1.0e-30)
      d = 1.0e-30;
    c = b + an / c;
    if (fabs(c) < 1.0e-30)
      c = 1.0e-30;
    d = 1.0 / d;
    del = d * c;
    h *= del;
    if (fabs(del - 1.0) < 1.0e-9)
      break;
  }
  assert(i <= 100);
  *gammcf = exp(-x + a * log(x) - (*gln)) * h;
}


x86 assembly (clang, -O0):
<gcf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <lgamma@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe8c(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe7d(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe68(%rip),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jg     12f3 <gcf+0x1b3>
xor    %eax,%eax
sub    -0x24(%rbp),%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe37(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm1
movaps 0xe1d(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdf1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1236 <gcf+0xf6>
movsd  0xddf(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
divsd  -0x40(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movaps 0xdd6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdaa(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    127d <gcf+0x13d>
movsd  0xd98(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd7b(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  0xd46(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xd6b(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd4f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12e0 <gcf+0x1a0>
jmp    12f3 <gcf+0x1b3>
jmp    12e5 <gcf+0x1a5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b3 <gcf+0x73>
cmpl   $0x64,-0x24(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <log@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
call   1040 <exp@plt>
mulsd  -0x58(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcf>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%r14
call   1050 <lgamma@plt>
movsd  0x8(%rsp),%xmm13
movsd  %xmm0,(%rbx)
movsd  0xe8f(%rip),%xmm8
movsd  (%rsp),%xmm1
addsd  %xmm8,%xmm1
subsd  %xmm13,%xmm1
movapd %xmm8,%xmm0
divsd  %xmm1,%xmm0
movsd  0xe76(%rip),%xmm11
mov    $0x1,%edx
mov    $0x1,%cl
mov    $0xffffffff,%eax
movsd  0xe69(%rip),%xmm9
movapd 0xe81(%rip),%xmm4
movsd  0xe61(%rip),%xmm5
movsd  0xe60(%rip),%xmm10
movapd 0xe67(%rip),%xmm12
movsd  0xe56(%rip),%xmm14
movapd %xmm0,%xmm7
movapd %xmm11,%xmm2
nopl   0x0(%rax,%rax,1)
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
xorps  %xmm6,%xmm6
cvtsi2sd %edx,%xmm6
subsd  %xmm13,%xmm6
mulsd  %xmm3,%xmm6
addsd  %xmm9,%xmm1
mulsd  %xmm6,%xmm7
movapd %xmm7,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm3,%xmm7
andpd  %xmm4,%xmm7
ucomisd %xmm7,%xmm5
movapd %xmm11,%xmm7
ja     1224 <gcf+0xe4>
movapd %xmm8,%xmm7
divsd  %xmm3,%xmm7
divsd  %xmm2,%xmm6
addsd  %xmm1,%xmm6
movapd %xmm6,%xmm2
andpd  %xmm4,%xmm2
cmpltsd %xmm5,%xmm2
movapd %xmm2,%xmm3
andnpd %xmm6,%xmm3
andpd  %xmm5,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm7,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm10,%xmm3
andpd  %xmm12,%xmm3
ucomisd %xmm3,%xmm14
ja     127d <gcf+0x13d>
cmp    $0x64,%edx
lea    0x1(%rdx),%esi
setb   %cl
add    $0xffffffff,%eax
mov    %esi,%edx
cmp    $0x65,%esi
jne    11e0 <gcf+0xa0>
movzbl %cl,%edi
and    $0x1,%edi
movsd  %xmm0,0x10(%rsp)
call   1030 <assert@plt>
movsd  (%rsp),%xmm0
call   1060 <log@plt>
mulsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
subsd  (%rbx),%xmm0
call   1040 <exp@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @gcf(double* %0, double %1, double %2, double* %3) {
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double* %0, double** %5
store double %1, double* %6
store double %2, double* %7
store double* %3, double** %8
%16 = load double, double* %6
%17 = call double @lgamma(double %16)
%18 = load double*, double** %8
store double %17, double* %18
%19 = load double, double* %7
%20 = fadd double %19, 1.000000e+00
%21 = load double, double* %6
%22 = fsub double %20, %21
store double %22, double* %11
store double 0x46293E5939A08CE9, double* %12
%23 = load double, double* %11
%24 = fdiv double 1.000000e+00, %23
store double %24, double* %13
%25 = load double, double* %13
store double %25, double* %15
store i32 1, i32* %9
br label %26
26: ; preds = %73, %4
%27 = load i32, i32* %9
%28 = icmp sle i32 %27, 100
br i1 %28, label %29, label %76
29: ; preds = %26
%30 = load i32, i32* %9
%31 = sub nsw i32 0, %30
%32 = sitofp i32 %31 to double
%33 = load i32, i32* %9
%34 = sitofp i32 %33 to double
%35 = load double, double* %6
%36 = fsub double %34, %35
%37 = fmul double %32, %36
store double %37, double* %10
%38 = load double, double* %11
%39 = fadd double %38, 2.000000e+00
store double %39, double* %11
%40 = load double, double* %10
%41 = load double, double* %13
%42 = load double, double* %11
%43 = call double @llvm.fmuladd.f64(double %40, double %41, double %42)
store double %43, double* %13
%44 = load double, double* %13
%45 = call double @llvm.fabs.f64(double %44)
%46 = fcmp olt double %45, 1.000000e-30
br i1 %46, label %47, label %48
47: ; preds = %29
store double 1.000000e-30, double* %13
br label %48
48: ; preds = %47, %29
%49 = load double, double* %11
%50 = load double, double* %10
%51 = load double, double* %12
%52 = fdiv double %50, %51
%53 = fadd double %49, %52
store double %53, double* %12
%54 = load double, double* %12
%55 = call double @llvm.fabs.f64(double %54)
%56 = fcmp olt double %55, 1.000000e-30
br i1 %56, label %57, label %58
57: ; preds = %48
store double 1.000000e-30, double* %12
br label %58
58: ; preds = %57, %48
%59 = load double, double* %13
%60 = fdiv double 1.000000e+00, %59
store double %60, double* %13
%61 = load double, double* %13
%62 = load double, double* %12
%63 = fmul double %61, %62
store double %63, double* %14
%64 = load double, double* %14
%65 = load double, double* %15
%66 = fmul double %65, %64
store double %66, double* %15
%67 = load double, double* %14
%68 = fsub double %67, 1.000000e+00
%69 = call double @llvm.fabs.f64(double %68)
%70 = fcmp olt double %69, 1.000000e-09
br i1 %70, label %71, label %72
71: ; preds = %58
br label %76
72: ; preds = %58
br label %73
73: ; preds = %72
%74 = load i32, i32* %9
%75 = add nsw i32 %74, 1
store i32 %75, i32* %9
br label %26
76: ; preds = %71, %26
%77 = load i32, i32* %9
%78 = icmp sle i32 %77, 100
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = load double, double* %7
%82 = fneg double %81
%83 = load double, double* %6
%84 = load double, double* %7
%85 = call double @log(double %84)
%86 = call double @llvm.fmuladd.f64(double %83, double %85, double %82)
%87 = load double*, double** %8
%88 = load double, double* %87
%89 = fsub double %86, %88
%90 = call double @exp(double %89)
%91 = load double, double* %15
%92 = fmul double %90, %91
%93 = load double*, double** %5
store double %92, double* %93
ret void
}

LLVM IR (-O2):
define void @gcf(double* nocapture writeonly %0, double %1, double %2, double* nocapture %3) {
%5 = tail call double @lgamma(double %1)
store double %5, double* %3
%6 = fadd double %2, 1.000000e+00
%7 = fsub double %6, %1
%8 = fdiv double 1.000000e+00, %7
br label %13
9: ; preds = %13
%10 = add nuw nsw i32 %16, 1
%11 = icmp ult i32 %16, 100
%12 = icmp eq i32 %10, 101
br i1 %12, label %41, label %13
13: ; preds = %4, %9
%14 = phi i1 [ true, %4 ], [ %11, %9 ]
%15 = phi double [ %8, %4 ], [ %37, %9 ]
%16 = phi i32 [ 1, %4 ], [ %10, %9 ]
%17 = phi double [ %8, %4 ], [ %35, %9 ]
%18 = phi double [ 0x46293E5939A08CE9, %4 ], [ %33, %9 ]
%19 = phi double [ %7, %4 ], [ %25, %9 ]
%20 = sub nsw i32 0, %16
%21 = sitofp i32 %20 to double
%22 = sitofp i32 %16 to double
%23 = fsub double %22, %1
%24 = fmul double %23, %21
%25 = fadd double %19, 2.000000e+00
%26 = tail call double @llvm.fmuladd.f64(double %24, double %17, double %25)
%27 = tail call double @llvm.fabs.f64(double %26)
%28 = fcmp olt double %27, 1.000000e-30
%29 = fdiv double %24, %18
%30 = fadd double %25, %29
%31 = tail call double @llvm.fabs.f64(double %30)
%32 = fcmp olt double %31, 1.000000e-30
%33 = select i1 %32, double 1.000000e-30, double %30
%34 = fdiv double 1.000000e+00, %26
%35 = select i1 %28, double 0x46293E5939A08CE9, double %34
%36 = fmul double %35, %33
%37 = fmul double %15, %36
%38 = fadd double %36, -1.000000e+00
%39 = tail call double @llvm.fabs.f64(double %38)
%40 = fcmp olt double %39, 1.000000e-09
br i1 %40, label %41, label %9
41: ; preds = %13, %9
%42 = phi i1 [ %14, %13 ], [ %11, %9 ]
%43 = zext i1 %42 to i32
%44 = tail call i32 @assert(i32 %43)
%45 = fneg double %2
%46 = tail call double @log(double %2)
%47 = tail call double @llvm.fmuladd.f64(double %1, double %46, double %45)
%48 = load double, double* %3
%49 = fsub double %47, %48
%50 = tail call double @exp(double %49)
%51 = fmul double %37, %50
store double %51, double* %0
ret void
}