#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);
int fabs(double);
double lgamma(double);
double log(double);
void gcf(double *xptr, double a, double x, double *yptr) {
  int n;
  double xp, yp, gold, b0, g, a0, b1, fac, a1, ana, anf;
  yp = lgamma(a);
  gold = b0 = 0.;
  a0 = b1 = fac = g = 1.;
  a1 = x;
  n = 1;
  while (fabs((g - gold) / g) > 1e-7) {
    if (a1 != 0 && n != 1)
      gold = g;
    ana = n - a;
    a0 = (a1 + a0 * ana) * fac;
    b0 = (b1 + b0 * ana) * fac;
    anf = n * fac;
    a1 = x * a0 + anf * a1;
    b1 = x * b0 + anf * b1;
    if (a1 != 0) {
      fac = 1 / a1;
      g = b1 * fac;
    }
    n++;
  }
  xp = exp(-x + a * log(x) - yp) * g;
  *xptr = xp;
  *yptr = yp;
}


x86 assembly (clang, -O0):
<gcf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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>
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe7c(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe6f(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe62(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe55(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x1,-0x24(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe27(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    130a <gcf+0x1ca>
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1208 <gcf+0xc8>
jp     1208 <gcf+0xc8>
jmp    121c <gcf+0xdc>
cmpl   $0x1,-0x24(%rbp)
je     121c <gcf+0xdc>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12db <gcf+0x19b>
jp     12db <gcf+0x19b>
jmp    12fc <gcf+0x1bc>
movsd  0xd1d(%rip),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c1 <gcf+0x81>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1060 <log@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x38(%rbp),%xmm0
call   1040 <exp@plt>
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcf>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rsi,%r14
movapd %xmm1,0x20(%rsp)
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
call   1050 <lgamma@plt>
movsd  %xmm0,(%rsp)
movsd  0xe91(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    12c2 <gcf+0x182>
movapd 0xe86(%rip),%xmm5
movapd 0x20(%rsp),%xmm0
movsd  %xmm0,%xmm5
unpcklpd %xmm0,%xmm0
movapd %xmm0,0x40(%rsp)
movsd  0xe5a(%rip),%xmm6
movsd  0xe52(%rip),%xmm1
mov    $0x1,%ebp
xorpd  %xmm0,%xmm0
movapd %xmm1,%xmm2
movapd %xmm1,0x30(%rsp)
movapd %xmm1,0x10(%rsp)
jmp    1225 <gcf+0xe5>
nopl   0x0(%rax)
movapd %xmm4,0x10(%rsp)
cmpneqsd 0xe29(%rip),%xmm5
andpd  %xmm5,%xmm1
andnpd %xmm0,%xmm5
orpd   %xmm1,%xmm5
movapd %xmm5,0x50(%rsp)
add    $0x1,%ebp
movapd %xmm4,%xmm0
subsd  %xmm5,%xmm0
divsd  %xmm4,%xmm0
movapd %xmm7,0x60(%rsp)
call   1030 <fabs@plt>
movapd 0x50(%rsp),%xmm0
movapd 0x60(%rsp),%xmm5
test   %eax,%eax
movapd 0x70(%rsp),%xmm6
jle    12c2 <gcf+0x182>
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm1
cmp    $0x1,%ebp
movapd %xmm2,%xmm4
jne    123c <gcf+0xfc>
movapd %xmm0,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %ebp,%xmm2
movapd 0x30(%rsp),%xmm7
movapd %xmm7,%xmm3
mulsd  %xmm2,%xmm3
subsd  0x8(%rsp),%xmm2
unpcklpd %xmm2,%xmm2
mulpd  %xmm2,%xmm6
movapd %xmm6,%xmm2
addpd  %xmm5,%xmm2
movapd %xmm7,%xmm6
unpcklpd %xmm7,%xmm6
mulpd  %xmm2,%xmm6
unpcklpd %xmm3,%xmm3
mulpd  %xmm5,%xmm3
movapd 0x40(%rsp),%xmm7
movapd %xmm6,0x70(%rsp)
mulpd  %xmm6,%xmm7
addpd  %xmm3,%xmm7
ucomisd 0xd71(%rip),%xmm7
jne    129f <gcf+0x15f>
jnp    11d0 <gcf+0x90>
movsd  0xd59(%rip),%xmm2
divsd  %xmm7,%xmm2
movapd %xmm7,%xmm4
unpckhpd %xmm7,%xmm4
movapd %xmm2,0x30(%rsp)
mulsd  %xmm2,%xmm4
jmp    11d0 <gcf+0x90>
movapd 0x20(%rsp),%xmm0
call   1060 <log@plt>
mulsd  0x8(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
subsd  (%rsp),%xmm0
call   1040 <exp@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
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
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double* %0, double** %5
store double %1, double* %6
store double %2, double* %7
store double* %3, double** %8
%21 = load double, double* %6
%22 = call double @lgamma(double %21)
store double %22, double* %11
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %12
store double 1.000000e+00, double* %14
store double 1.000000e+00, double* %17
store double 1.000000e+00, double* %16
store double 1.000000e+00, double* %15
%23 = load double, double* %7
store double %23, double* %18
store i32 1, i32* %9
br label %24
24: ; preds = %82, %4
%25 = load double, double* %14
%26 = load double, double* %12
%27 = fsub double %25, %26
%28 = load double, double* %14
%29 = fdiv double %27, %28
%30 = call i32 @fabs(double %29)
%31 = sitofp i32 %30 to double
%32 = fcmp ogt double %31, 0x3E7AD7F29ABCAF48
br i1 %32, label %33, label %85
33: ; preds = %24
%34 = load double, double* %18
%35 = fcmp une double %34, 0.000000e+00
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i32, i32* %9
%38 = icmp ne i32 %37, 1
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = load double, double* %14
store double %40, double* %12
br label %41
41: ; preds = %39, %36, %33
%42 = load i32, i32* %9
%43 = sitofp i32 %42 to double
%44 = load double, double* %6
%45 = fsub double %43, %44
store double %45, double* %19
%46 = load double, double* %18
%47 = load double, double* %15
%48 = load double, double* %19
%49 = call double @llvm.fmuladd.f64(double %47, double %48, double %46)
%50 = load double, double* %17
%51 = fmul double %49, %50
store double %51, double* %15
%52 = load double, double* %16
%53 = load double, double* %13
%54 = load double, double* %19
%55 = call double @llvm.fmuladd.f64(double %53, double %54, double %52)
%56 = load double, double* %17
%57 = fmul double %55, %56
store double %57, double* %13
%58 = load i32, i32* %9
%59 = sitofp i32 %58 to double
%60 = load double, double* %17
%61 = fmul double %59, %60
store double %61, double* %20
%62 = load double, double* %7
%63 = load double, double* %15
%64 = load double, double* %20
%65 = load double, double* %18
%66 = fmul double %64, %65
%67 = call double @llvm.fmuladd.f64(double %62, double %63, double %66)
store double %67, double* %18
%68 = load double, double* %7
%69 = load double, double* %13
%70 = load double, double* %20
%71 = load double, double* %16
%72 = fmul double %70, %71
%73 = call double @llvm.fmuladd.f64(double %68, double %69, double %72)
store double %73, double* %16
%74 = load double, double* %18
%75 = fcmp une double %74, 0.000000e+00
br i1 %75, label %76, label %82
76: ; preds = %41
%77 = load double, double* %18
%78 = fdiv double 1.000000e+00, %77
store double %78, double* %17
%79 = load double, double* %16
%80 = load double, double* %17
%81 = fmul double %79, %80
store double %81, double* %14
br label %82
82: ; preds = %76, %41
%83 = load i32, i32* %9
%84 = add nsw i32 %83, 1
store i32 %84, i32* %9
br label %24
85: ; preds = %24
%86 = load double, double* %7
%87 = fneg double %86
%88 = load double, double* %6
%89 = load double, double* %7
%90 = call double @log(double %89)
%91 = call double @llvm.fmuladd.f64(double %88, double %90, double %87)
%92 = load double, double* %11
%93 = fsub double %91, %92
%94 = call double @exp(double %93)
%95 = load double, double* %14
%96 = fmul double %94, %95
store double %96, double* %10
%97 = load double, double* %10
%98 = load double*, double** %5
store double %97, double* %98
%99 = load double, double* %11
%100 = load double*, double** %8
store double %99, double* %100
ret void
}

LLVM IR (-O2):
define void @gcf(double* nocapture writeonly %0, double %1, double %2, double* nocapture writeonly %3) {
%5 = tail call double @lgamma(double %1)
%6 = tail call i32 @fabs(double 1.000000e+00)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %51
8: ; preds = %4
%9 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %2, i64 0
%10 = insertelement <2 x double> poison, double %2, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
br label %12
12: ; preds = %8, %43
%13 = phi i32 [ %46, %43 ], [ 1, %8 ]
%14 = phi double [ %23, %43 ], [ 0.000000e+00, %8 ]
%15 = phi double [ %45, %43 ], [ 1.000000e+00, %8 ]
%16 = phi double [ %44, %43 ], [ 1.000000e+00, %8 ]
%17 = phi <2 x double> [ %31, %43 ], [ <double 1.000000e+00, double 0.000000e+00>, %8 ]
%18 = phi <2 x double> [ %36, %43 ], [ %9, %8 ]
%19 = extractelement <2 x double> %18, i64 0
%20 = fcmp une double %19, 0.000000e+00
%21 = icmp ne i32 %13, 1
%22 = select i1 %20, i1 %21, i1 false
%23 = select i1 %22, double %16, double %14
%24 = sitofp i32 %13 to double
%25 = fsub double %24, %1
%26 = insertelement <2 x double> poison, double %25, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %17, <2 x double> %27, <2 x double> %18)
%29 = insertelement <2 x double> poison, double %15, i64 0
%30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
%31 = fmul <2 x double> %30, %28
%32 = fmul double %15, %24
%33 = insertelement <2 x double> poison, double %32, i64 0
%34 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%35 = fmul <2 x double> %18, %34
%36 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %31, <2 x double> %35)
%37 = extractelement <2 x double> %36, i64 0
%38 = fcmp une double %37, 0.000000e+00
br i1 %38, label %39, label %43
39: ; preds = %12
%40 = fdiv double 1.000000e+00, %37
%41 = extractelement <2 x double> %36, i64 1
%42 = fmul double %41, %40
br label %43
43: ; preds = %39, %12
%44 = phi double [ %42, %39 ], [ %16, %12 ]
%45 = phi double [ %40, %39 ], [ %15, %12 ]
%46 = add nuw nsw i32 %13, 1
%47 = fsub double %44, %23
%48 = fdiv double %47, %44
%49 = tail call i32 @fabs(double %48)
%50 = icmp sgt i32 %49, 0
br i1 %50, label %12, label %51
51: ; preds = %43, %4
%52 = phi double [ 1.000000e+00, %4 ], [ %44, %43 ]
%53 = fneg double %2
%54 = tail call double @log(double %2)
%55 = tail call double @llvm.fmuladd.f64(double %1, double %54, double %53)
%56 = fsub double %55, %5
%57 = tail call double @exp(double %56)
%58 = fmul double %52, %57
store double %58, double* %0
store double %5, double* %3
ret void
}