#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 DBL_EPSILON;
int /*<<< orphan*/ error(char *);
double exp(double);
double fabs(double);
double gammln(double);
double log(double);
double gcf(double *gammcf, double a, double x) {
  int i;
  double an, b, c, d, del, h;
  double gln = gammln(a);
  b = x + 1.0 - a;
  c = 1.0 / 1.0e-30;
  d = 1.0 / b;
  h = d;
  for (i = 0; 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) < DBL_EPSILON)
      break;
  }
  if (i > 100)
    error("a too large, ITMAX too small in gcf");
  *gammcf = exp(-x + a * log(x) - gln) * h;
  return gln;
}


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)
movsd  -0x10(%rbp),%xmm0
call   1060 <gammln@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xe93(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe84(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe6f(%rip),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    12ef <gcf+0x1af>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe3e(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movaps 0xe14(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdf8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    122f <gcf+0xef>
movsd  0xde6(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
divsd  -0x38(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xdcd(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdb1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1276 <gcf+0x136>
movsd  0xd9f(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd82(%rip),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  0xd4d(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xd62(%rip),%xmm0
pand   %xmm0,%xmm1
mov    0x2d1f(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    12dc <gcf+0x19c>
jmp    12ef <gcf+0x1af>
jmp    12e1 <gcf+0x1a1>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ac <gcf+0x6c>
cmpl   $0x64,-0x1c(%rbp)
jle    1305 <gcf+0x1c5>
lea    0xd30(%rip),%rdi
call   1040 <error@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   1050 <log@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x58(%rbp),%xmm0
call   1030 <exp@plt>
mulsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcf>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
mov    %rdi,%rbx
call   1050 <gammln@plt>
movsd  (%rsp),%xmm14
movsd  %xmm0,0x10(%rsp)
movsd  0xea3(%rip),%xmm8
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm13
addsd  %xmm8,%xmm1
subsd  %xmm14,%xmm1
movapd %xmm8,%xmm2
divsd  %xmm1,%xmm2
mov    0x2e66(%rip),%rax
movsd  (%rax),%xmm15
movsd  0xe78(%rip),%xmm10
xor    %eax,%eax
movsd  0xe75(%rip),%xmm9
movapd 0xe8d(%rip),%xmm5
movsd  0xe6d(%rip),%xmm6
movsd  0xe6c(%rip),%xmm11
movapd 0xe73(%rip),%xmm12
xor    %ecx,%ecx
movapd %xmm2,%xmm0
movapd %xmm10,%xmm3
nopl   0x0(%rax,%rax,1)
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
xorps  %xmm7,%xmm7
cvtsi2sd %ecx,%xmm7
subsd  %xmm14,%xmm7
mulsd  %xmm4,%xmm7
addsd  %xmm9,%xmm1
mulsd  %xmm7,%xmm0
movapd %xmm0,%xmm4
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm0
andpd  %xmm5,%xmm0
ucomisd %xmm0,%xmm6
movapd %xmm10,%xmm0
ja     1214 <gcf+0xe4>
movapd %xmm8,%xmm0
divsd  %xmm4,%xmm0
divsd  %xmm3,%xmm7
addsd  %xmm1,%xmm7
movapd %xmm7,%xmm3
andpd  %xmm5,%xmm3
cmpltsd %xmm6,%xmm3
movapd %xmm3,%xmm4
andnpd %xmm7,%xmm4
andpd  %xmm6,%xmm3
orpd   %xmm4,%xmm3
movapd %xmm0,%xmm4
mulsd  %xmm3,%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm11,%xmm4
andpd  %xmm12,%xmm4
ucomisd %xmm4,%xmm15
ja     1267 <gcf+0x137>
add    $0x1,%ecx
lea    -0x1(%rax),%edx
cmp    $0xffffff9d,%eax
mov    %edx,%eax
jne    11d0 <gcf+0xa0>
movapd %xmm13,%xmm0
movsd  %xmm2,0x18(%rsp)
call   1040 <log@plt>
mulsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
movsd  0x10(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

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

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