#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 */
float exp(float);
double fabs(float);
float log(float);
int /*<<< orphan*/ printf(char *);
void gcf(float *gammcf, float a, float x, float *gln) {
  float gammln(float xx);
  int i;
  float an, b, c, d, del, h;
  *gln = gammln(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) < 3.0e-7)
      break;
  }
  if (i > 100)
    printf("Error(gcf):a too large, ITMAX too small\n");
  *gammcf = exp(-x + a * log(x) - (*gln)) * h;
}


x86 assembly (clang, -O0):
<gcf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1070 <gammln@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe73(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xe71(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe3b(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jg     133a <gcf+0x1ea>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xdb0(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    126f <gcf+0x11f>
movss  0xdba(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
divss  -0x28(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xd6c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12b3 <gcf+0x163>
movss  0xd76(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd3c(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
mulss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd00(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xd00(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1327 <gcf+0x1d7>
jmp    133a <gcf+0x1ea>
jmp    132c <gcf+0x1dc>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e3 <gcf+0x93>
cmpl   $0x64,-0x1c(%rbp)
jle    1350 <gcf+0x200>
lea    0xcdd(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x10(%rbp),%xmm0
call   1060 <log@plt>
movss  -0x3c(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x38(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
subss  (%rax),%xmm0
call   1050 <exp@plt>
mulss  -0x34(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcf>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r15
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
mov    %rdi,%r14
call   1070 <gammln@plt>
movss  %xmm0,(%r15)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe78(%rip),%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  0xe73(%rip),%xmm0
movss  %xmm1,0x14(%rsp)
divss  %xmm1,%xmm0
movss  0xe65(%rip),%xmm1
mov    $0x1,%ebp
mov    $0xffffffff,%ebx
movss  %xmm0,0x10(%rsp)
movaps %xmm0,%xmm2
movss  %xmm1,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %ebp,%xmm1
subss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x14(%rsp),%xmm3
addss  0xe24(%rip),%xmm3
movss  %xmm3,0x14(%rsp)
mulss  %xmm1,%xmm2
movaps %xmm2,%xmm0
addss  %xmm3,%xmm0
movss  %xmm0,0x1c(%rsp)
call   1040 <fabs@plt>
movsd  %xmm0,0x20(%rsp)
movss  0x4(%rsp),%xmm0
divss  0x18(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
call   1040 <fabs@plt>
movsd  0xdc5(%rip),%xmm1
ucomisd %xmm0,%xmm1
movss  0xdd5(%rip),%xmm1
ja     1257 <gcf+0x107>
movss  0x4(%rsp),%xmm1
movsd  0xda9(%rip),%xmm0
ucomisd 0x20(%rsp),%xmm0
movss  0xdaf(%rip),%xmm0
ja     127d <gcf+0x12d>
movss  0xda1(%rip),%xmm0
divss  0x1c(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  %xmm1,0x18(%rsp)
mulss  %xmm1,%xmm0
movss  0x10(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
addss  0xd83(%rip),%xmm0
call   1040 <fabs@plt>
movsd  0xd5e(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     12d9 <gcf+0x189>
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    $0xffffff9b,%ebx
movss  0x4(%rsp),%xmm2
jne    11d0 <gcf+0x80>
lea    0xd58(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
call   1060 <log@plt>
mulss  0xc(%rsp),%xmm0
subss  0x8(%rsp),%xmm0
subss  (%r15),%xmm0
call   1050 <exp@plt>
movss  0x10(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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