#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;
double DBL_MIN;
double exp(double);
double fabs(double);
double gammaln(double);
double log(double);
int /*<<< orphan*/ puts(char *);
void gammacf(double *gcf, double a, double x) {
  int i, ITMAX = 100;
  double an, b, c, d, del, h, gln, eps = DBL_EPSILON, FPMIN = DBL_MIN;
  gln = gammaln(a);
  b = x + 1.0 - a;
  c = 1.0 / FPMIN;
  d = 1.0 / b;
  h = d;
  for (i = 1; i <= ITMAX; ++i) {
    an = -i * (i - a);
    b += 2.0;
    d = an * d + b;
    if (fabs(d) < FPMIN)
      d = FPMIN;
    c = b + an / c;
    if (fabs(c) < FPMIN)
      c = FPMIN;
    d = 1.0 / d;
    del = d * c;
    h *= del;
    if (fabs(del - 1.0) <= eps)
      break;
  }
  if (i > ITMAX)
    puts("uwerr: a too large, ITMAX too small in gammacf.");
  *gcf = exp(-x + a * log(x) - gln) * h;
}


x86 assembly (clang, -O0):
<gammacf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movl   $0x64,-0x20(%rbp)
mov    0x2e81(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x2e61(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <gammaln@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xe69(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe52(%rip),%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe40(%rip),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     130e <gammacf+0x1ce>
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  0xdfd(%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 0xdd3(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    125a <gammacf+0x11a>
movsd  -0x68(%rbp),%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 0xd92(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    129b <gammacf+0x15b>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd5d(%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  0xd28(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xd2d(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12fb <gammacf+0x1bb>
jmp    130e <gammacf+0x1ce>
jmp    1300 <gammacf+0x1c0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11db <gammacf+0x9b>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1326 <gammacf+0x1e6>
lea    0xcff(%rip),%rdi
call   1040 <puts@plt>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <log@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x58(%rbp),%xmm0
call   1050 <exp@plt>
mulsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gammacf>:
push   %rbx
sub    $0x40,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    %rdi,%rbx
mov    0x2e8d(%rip),%rax
movsd  (%rax),%xmm1
movsd  %xmm1,0x20(%rsp)
mov    0x2e6c(%rip),%rax
movsd  (%rax),%xmm1
movaps %xmm1,0x30(%rsp)
call   1030 <gammaln@plt>
movapd 0x30(%rsp),%xmm13
movsd  0x20(%rsp),%xmm12
movsd  0x18(%rsp),%xmm10
movsd  %xmm0,0x28(%rsp)
movsd  0xe62(%rip),%xmm11
movsd  0x10(%rsp),%xmm1
addsd  %xmm11,%xmm1
subsd  %xmm10,%xmm1
movapd %xmm11,%xmm2
divsd  %xmm13,%xmm2
movapd %xmm11,%xmm4
divsd  %xmm1,%xmm4
mov    $0x1,%eax
mov    $0xffffffff,%ecx
movsd  0xe34(%rip),%xmm8
movapd 0xe44(%rip),%xmm0
movsd  0xe2b(%rip),%xmm9
movapd %xmm4,%xmm6
nopl   0x0(%rax)
xorps  %xmm7,%xmm7
cvtsi2sd %ecx,%xmm7
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
subsd  %xmm10,%xmm3
mulsd  %xmm7,%xmm3
addsd  %xmm8,%xmm1
mulsd  %xmm3,%xmm6
addsd  %xmm1,%xmm6
movapd %xmm6,%xmm7
andpd  %xmm0,%xmm7
cmpltsd %xmm13,%xmm7
movapd %xmm7,%xmm5
andnpd %xmm6,%xmm5
andpd  %xmm13,%xmm7
orpd   %xmm5,%xmm7
divsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm3,%xmm2
andpd  %xmm0,%xmm2
cmpltsd %xmm13,%xmm2
movapd %xmm2,%xmm5
andnpd %xmm3,%xmm5
andpd  %xmm13,%xmm2
orpd   %xmm5,%xmm2
movapd %xmm11,%xmm6
divsd  %xmm7,%xmm6
movapd %xmm6,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm4
addsd  %xmm9,%xmm3
andpd  %xmm0,%xmm3
ucomisd %xmm3,%xmm12
jae    12a6 <gammacf+0x166>
add    $0x1,%eax
add    $0xffffffff,%ecx
cmp    $0xffffff9b,%ecx
jne    11f0 <gammacf+0xb0>
lea    0xd9b(%rip),%rdi
movsd  %xmm4,0x8(%rsp)
call   1040 <puts@plt>
movsd  0x8(%rsp),%xmm4
movsd  %xmm4,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <log@plt>
mulsd  0x18(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
call   1050 <exp@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@DBL_EPSILON = global double 0.000000e+00
@DBL_MIN = global double 0.000000e+00
@.str = [48 x i8] c"uwerr: a too large, ITMAX too small in gammacf.\00"
define void @gammacf(double* nocapture writeonly %0, double %1, double %2) {
%4 = load double, double* @DBL_EPSILON
%5 = load double, double* @DBL_MIN
%6 = tail call double @gammaln(double %1)
%7 = fadd double %2, 1.000000e+00
%8 = fsub double %7, %1
%9 = fdiv double 1.000000e+00, %5
%10 = fdiv double 1.000000e+00, %8
br label %14
11: ; preds = %14
%12 = add nuw nsw i32 %15, 1
%13 = icmp eq i32 %12, 101
br i1 %13, label %41, label %14
14: ; preds = %3, %11
%15 = phi i32 [ 1, %3 ], [ %12, %11 ]
%16 = phi double [ %8, %3 ], [ %25, %11 ]
%17 = phi double [ %9, %3 ], [ %34, %11 ]
%18 = phi double [ %10, %3 ], [ %37, %11 ]
%19 = phi double [ %10, %3 ], [ %35, %11 ]
%20 = sub nsw i32 0, %15
%21 = sitofp i32 %20 to double
%22 = sitofp i32 %15 to double
%23 = fsub double %22, %1
%24 = fmul double %23, %21
%25 = fadd double %16, 2.000000e+00
%26 = tail call double @llvm.fmuladd.f64(double %24, double %19, double %25)
%27 = tail call double @llvm.fabs.f64(double %26)
%28 = fcmp olt double %27, %5
%29 = select i1 %28, double %5, double %26
%30 = fdiv double %24, %17
%31 = fadd double %25, %30
%32 = tail call double @llvm.fabs.f64(double %31)
%33 = fcmp olt double %32, %5
%34 = select i1 %33, double %5, double %31
%35 = fdiv double 1.000000e+00, %29
%36 = fmul double %35, %34
%37 = fmul double %18, %36
%38 = fadd double %36, -1.000000e+00
%39 = tail call double @llvm.fabs.f64(double %38)
%40 = fcmp ugt double %39, %4
br i1 %40, label %11, label %43
41: ; preds = %11
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %43
43: ; preds = %14, %41
%44 = fneg double %2
%45 = tail call double @log(double %2)
%46 = tail call double @llvm.fmuladd.f64(double %1, double %45, double %44)
%47 = fsub double %46, %6
%48 = tail call double @exp(double %47)
%49 = fmul double %37, %48
store double %49, double* %0
ret void
}