#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 pow(double, double);
double sqrt(double const);
double approx_gamma(double Z) {
  const double RECIP_E = 0.36787944117144232159552377016147;
  const double TWOPI = 6.283185307179586476925286766559;
  double D = 1.0 / (10.0 * Z);
  D = 1.0 / ((12 * Z) - D);
  D = (D + Z) * RECIP_E;
  D = pow(D, Z);
  D *= sqrt(TWOPI / Z);
  return D;
}


x86 assembly (clang, -O0):
<approx_gamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebe(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed1(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xeb4(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe8a(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe72(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe22(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<approx_gamma>:
push   %rax
movapd %xmm0,%xmm3
movsd  %xmm0,(%rsp)
movsd  0xece(%rip),%xmm0
mulsd  %xmm3,%xmm0
movsd  0xeca(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xec6(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0xebe(%rip),%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
mulsd  0xeb6(%rip),%xmm0
movapd %xmm3,%xmm1
call   1030 <pow@plt>
movapd %xmm0,%xmm2
movsd  0xea9(%rip),%xmm0
divsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1194 <approx_gamma+0x74>
sqrtsd %xmm0,%xmm0
jmp    11a3 <approx_gamma+0x83>
movsd  %xmm2,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @approx_gamma(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
store double 0x3FD78B56362CEF38, double* %3
store double 0x401921FB54442D18, double* %4
%6 = load double, double* %2
%7 = fmul double 1.000000e+01, %6
%8 = fdiv double 1.000000e+00, %7
store double %8, double* %5
%9 = load double, double* %2
%10 = load double, double* %5
%11 = fneg double %10
%12 = call double @llvm.fmuladd.f64(double 1.200000e+01, double %9, double %11)
%13 = fdiv double 1.000000e+00, %12
store double %13, double* %5
%14 = load double, double* %5
%15 = load double, double* %2
%16 = fadd double %14, %15
%17 = fmul double %16, 0x3FD78B56362CEF38
store double %17, double* %5
%18 = load double, double* %5
%19 = load double, double* %2
%20 = call double @pow(double %18, double %19)
store double %20, double* %5
%21 = load double, double* %2
%22 = fdiv double 0x401921FB54442D18, %21
%23 = call double @sqrt(double %22)
%24 = load double, double* %5
%25 = fmul double %24, %23
store double %25, double* %5
%26 = load double, double* %5
ret double %26
}

LLVM IR (-O2):
define double @approx_gamma(double %0) {
%2 = fmul double %0, 1.000000e+01
%3 = fdiv double -1.000000e+00, %2
%4 = tail call double @llvm.fmuladd.f64(double %0, double 1.200000e+01, double %3)
%5 = fdiv double 1.000000e+00, %4
%6 = fadd double %5, %0
%7 = fmul double %6, 0x3FD78B56362CEF38
%8 = tail call double @pow(double %7, double %0)
%9 = fdiv double 0x401921FB54442D18, %0
%10 = tail call double @sqrt(double %9)
%11 = fmul double %8, %10
ret double %11
}