#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 */
int log(int);
double lngamm(int z) {
  double x = 0;
  x += 0.1659470187408462e-06 / (z + 7);
  x += 0.9934937113930748e-05 / (z + 6);
  x -= 0.1385710331296526 / (z + 5);
  x += 12.50734324009056 / (z + 4);
  x -= 176.6150291498386 / (z + 3);
  x += 771.3234287757674 / (z + 2);
  x -= 1259.139216722289 / (z + 1);
  x += 676.5203681218835 / (z);
  x += 0.9999999999995183;
  return (log(x) - 5.58106146679532777 - z + (z - 0.5) * log(z + 6.5));
}


x86 assembly (clang, -O0):
<lngamm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7,%eax
cvtsi2sd %eax,%xmm1
movsd  0xf23(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x6,%eax
cvtsi2sd %eax,%xmm1
movsd  0xefb(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
cvtsi2sd %eax,%xmm0
movsd  0xed3(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cvtsi2sd %eax,%xmm1
movsd  0xea7(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe7f(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe53(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe04(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xde6(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%edi
call   1030 <log@plt>
cvtsi2sd %eax,%xmm0
movsd  0xdbe(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xd97(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xd79(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lngamm>:
sub    $0x28,%rsp
lea    0x7(%rdi),%eax
cvtsi2sd %eax,%xmm0
movsd  0xedd(%rip),%xmm1
divsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
lea    0x6(%rdi),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xec7(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
movd   %edi,%xmm1
pshufd $0x50,%xmm1,%xmm2
movdqa 0xed6(%rip),%xmm3
paddd  %xmm2,%xmm3
cvtdq2pd %xmm3,%xmm3
movapd 0xed6(%rip),%xmm4
divpd  %xmm3,%xmm4
movapd %xmm4,%xmm3
unpckhpd %xmm4,%xmm3
subsd  %xmm3,%xmm0
paddd  0xece(%rip),%xmm2
cvtdq2pd %xmm2,%xmm2
addsd  %xmm4,%xmm0
movapd 0xece(%rip),%xmm3
divpd  %xmm2,%xmm3
movapd %xmm3,%xmm2
unpckhpd %xmm3,%xmm2
subsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
add    $0x1,%edi
movd   %edi,%xmm2
punpckldq %xmm2,%xmm1
cvtdq2pd %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
movapd 0xead(%rip),%xmm1
divpd  %xmm2,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
subsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  0xe31(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  0xe21(%rip),%xmm1
movapd 0x10(%rsp),%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xe11(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
addsd  0xe08(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @lngamm(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
store double 0.000000e+00, double* %3
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 7
%6 = sitofp i32 %5 to double
%7 = fdiv double 0x3E8645E569E1DBC8, %6
%8 = load double, double* %3
%9 = fadd double %8, %7
store double %9, double* %3
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 6
%12 = sitofp i32 %11 to double
%13 = fdiv double 0x3EE4D5C75C187EE3, %12
%14 = load double, double* %3
%15 = fadd double %14, %13
store double %15, double* %3
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 5
%18 = sitofp i32 %17 to double
%19 = fdiv double 0x3FC1BCB213BB7E41, %18
%20 = load double, double* %3
%21 = fsub double %20, %19
store double %21, double* %3
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 4
%24 = sitofp i32 %23 to double
%25 = fdiv double 0x402903C27E40123E, %24
%26 = load double, double* %3
%27 = fadd double %26, %25
store double %27, double* %3
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 3
%30 = sitofp i32 %29 to double
%31 = fdiv double 0x406613AE519C9497, %30
%32 = load double, double* %3
%33 = fsub double %32, %31
store double %33, double* %3
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 2
%36 = sitofp i32 %35 to double
%37 = fdiv double 0x40881A9661D3740D, %36
%38 = load double, double* %3
%39 = fadd double %38, %37
store double %39, double* %3
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
%42 = sitofp i32 %41 to double
%43 = fdiv double 0x4093AC8E8ED41526, %42
%44 = load double, double* %3
%45 = fsub double %44, %43
store double %45, double* %3
%46 = load i32, i32* %2
%47 = sitofp i32 %46 to double
%48 = fdiv double 0x40852429B6C30AF7, %47
%49 = load double, double* %3
%50 = fadd double %49, %48
store double %50, double* %3
%51 = load double, double* %3
%52 = fadd double %51, 0x3FEFFFFFFFFFEF0D
store double %52, double* %3
%53 = load double, double* %3
%54 = fptosi double %53 to i32
%55 = call i32 @log(i32 %54)
%56 = sitofp i32 %55 to double
%57 = fsub double %56, 0x40165301C6F3682A
%58 = load i32, i32* %2
%59 = sitofp i32 %58 to double
%60 = fsub double %57, %59
%61 = load i32, i32* %2
%62 = sitofp i32 %61 to double
%63 = fsub double %62, 5.000000e-01
%64 = load i32, i32* %2
%65 = sitofp i32 %64 to double
%66 = fadd double %65, 6.500000e+00
%67 = fptosi double %66 to i32
%68 = call i32 @log(i32 %67)
%69 = sitofp i32 %68 to double
%70 = call double @llvm.fmuladd.f64(double %63, double %69, double %60)
ret double %70
}

LLVM IR (-O2):
define double @lngamm(i32 %0) {
%2 = add nsw i32 %0, 7
%3 = sitofp i32 %2 to double
%4 = fdiv double 0x3E8645E569E1DBC8, %3
%5 = fadd double %4, 0.000000e+00
%6 = add nsw i32 %0, 6
%7 = sitofp i32 %6 to double
%8 = fdiv double 0x3EE4D5C75C187EE3, %7
%9 = fadd double %8, %5
%10 = insertelement <2 x i32> poison, i32 %0, i64 0
%11 = shufflevector <2 x i32> %10, <2 x i32> poison, <2 x i32> zeroinitializer
%12 = add nsw <2 x i32> %11, <i32 4, i32 5>
%13 = sitofp <2 x i32> %12 to <2 x double>
%14 = fdiv <2 x double> <double 0x402903C27E40123E, double 0x3FC1BCB213BB7E41>, %13
%15 = extractelement <2 x double> %14, i64 1
%16 = fsub double %9, %15
%17 = extractelement <2 x double> %14, i64 0
%18 = fadd double %17, %16
%19 = add nsw <2 x i32> %11, <i32 2, i32 3>
%20 = sitofp <2 x i32> %19 to <2 x double>
%21 = fdiv <2 x double> <double 0x40881A9661D3740D, double 0x406613AE519C9497>, %20
%22 = extractelement <2 x double> %21, i64 1
%23 = fsub double %18, %22
%24 = extractelement <2 x double> %21, i64 0
%25 = fadd double %24, %23
%26 = add nsw i32 %0, 1
%27 = insertelement <2 x i32> %10, i32 %26, i64 1
%28 = sitofp <2 x i32> %27 to <2 x double>
%29 = fdiv <2 x double> <double 0x40852429B6C30AF7, double 0x4093AC8E8ED41526>, %28
%30 = extractelement <2 x double> %29, i64 1
%31 = fsub double %25, %30
%32 = extractelement <2 x double> %29, i64 0
%33 = fadd double %32, %31
%34 = fadd double %33, 0x3FEFFFFFFFFFEF0D
%35 = fptosi double %34 to i32
%36 = tail call i32 @log(i32 %35)
%37 = sitofp i32 %36 to double
%38 = fadd double %37, 0xC0165301C6F3682A
%39 = extractelement <2 x double> %28, i64 0
%40 = fsub double %38, %39
%41 = fadd double %39, -5.000000e-01
%42 = fadd double %39, 6.500000e+00
%43 = fptosi double %42 to i32
%44 = tail call i32 @log(i32 %43)
%45 = sitofp i32 %44 to double
%46 = tail call double @llvm.fmuladd.f64(double %41, double %45, double %40)
ret double %46
}