#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 */
long double exp(long double);
long double pow(long double, long double);
long double sqrt(int);
long double tgammal(long double z) {
  static unsigned int c = 9;
  static long double lanczos_coefficients[] = {
      1.000000000000000174663,      5716.400188274341379136,
      -14815.30426768413909044,     14291.49277657478554025,
      -6348.160217641458813289,     1301.608286058321874105,
      -108.1767053514369634679,     2.605696505611755827729,
      -0.7423452510201416151527e-2, 0.5384136432509564062961e-7,
      -0.4023533141268236372067e-8};
  long double return_val = 0.0;
  z -= 1.0;
  long double temp = z + c + 0.5;
  long double A = lanczos_coefficients[0];
  int i = 0;
  for (i = 1; i < c + 2; ++i) {
    A += lanczos_coefficients[i] / (z + i);
  }
  return_val =
      sqrt(2 * 3.14159265358979323846) * pow(temp, z + 0.5) * exp(-temp) * A;
  return return_val;
}


x86 assembly (clang, -O0):
<tgammal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldz
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fld1
fchs
faddp  %st,%st(1)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    0x2ee5(%rip),%eax
mov    %rax,-0x50(%rbp)
fildll -0x50(%rbp)
faddp  %st,%st(1)
flds   0xe96(%rip)
faddp  %st,%st(1)
fstpt  -0x30(%rbp)
fldt   0x2edb(%rip)
fstpt  -0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    0x2eb1(%rip),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jae    11d1 <tgammal+0xa1>
movslq -0x44(%rbp),%rcx
mov    %ecx,%eax
shl    $0x4,%rcx
lea    0x2ea5(%rip),%rdx
fldt   (%rcx,%rdx,1)
fldt   -0x10(%rbp)
mov    %eax,-0x54(%rbp)
fildl  -0x54(%rbp)
faddp  %st,%st(1)
fdivrp %st,%st(1)
fldt   -0x40(%rbp)
faddp  %st,%st(1)
fstpt  -0x40(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1186 <tgammal+0x56>
mov    $0x6,%edi
call   1050 <sqrt@plt>
fstpt  -0x6c(%rbp)
fldt   -0x30(%rbp)
fldt   -0x10(%rbp)
flds   0xe16(%rip)
faddp  %st,%st(1)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1040 <pow@plt>
fldt   -0x6c(%rbp)
fmulp  %st,%st(1)
fstpt  -0x60(%rbp)
fldt   -0x30(%rbp)
fchs
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <exp@plt>
fldt   -0x60(%rbp)
fmulp  %st,%st(1)
fldt   -0x40(%rbp)
fmulp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tgammal>:
sub    $0x68,%rsp
fldt   0x70(%rsp)
fld1
fld    %st(0)
fchs
faddp  %st,%st(2)
fld    %st(1)
fstpt  0x2c(%rsp)
fld    %st(1)
fadds  0xeb2(%rip)
fxch   %st(1)
fadd   %st(2),%st
fdivrl 0xed0(%rip)
faddl  0xed2(%rip)
fld    %st(2)
fadds  0xe9e(%rip)
fdivrl 0xecc(%rip)
faddp  %st,%st(1)
fld    %st(2)
fadds  0xe92(%rip)
fdivrl 0xec4(%rip)
fld    %st(3)
fadds  0xe88(%rip)
fdivrl 0xebe(%rip)
fxch   %st(2)
faddp  %st,%st(1)
faddp  %st,%st(1)
fld    %st(2)
fadds  0xe78(%rip)
fdivrl 0xeb2(%rip)
fld    %st(3)
fadds  0xe6e(%rip)
fxch   %st(2)
faddp  %st,%st(1)
fxch   %st(1)
fdivrl 0xea6(%rip)
faddp  %st,%st(1)
fld    %st(2)
fadds  0xe5c(%rip)
fdivrl 0xe9e(%rip)
fld    %st(3)
fadds  0xe52(%rip)
fdivrl 0xe98(%rip)
fxch   %st(2)
faddp  %st,%st(1)
faddp  %st,%st(1)
fld    %st(1)
fdivrl 0xe92(%rip)
fxch   %st(3)
fadds  0xe3a(%rip)
fdivrl 0xe8c(%rip)
fxch   %st(1)
faddp  %st,%st(3)
faddp  %st,%st(2)
fxch   %st(1)
fstpt  0x5c(%rsp)
flds   0xe26(%rip)
fld    %st(0)
fstpt  0x44(%rsp)
faddp  %st,%st(1)
fstpt  0x38(%rsp)
mov    $0x6,%edi
call   1050 <sqrt@plt>
fstpt  0x50(%rsp)
fldt   0x2c(%rsp)
fldt   0x44(%rsp)
faddp  %st,%st(1)
fstpt  0x10(%rsp)
fldt   0x38(%rsp)
fstpt  (%rsp)
call   1040 <pow@plt>
fldt   0x50(%rsp)
fmulp  %st,%st(1)
fstpt  0x2c(%rsp)
fldt   0x38(%rsp)
fchs
fstpt  (%rsp)
call   1030 <exp@plt>
fldt   0x2c(%rsp)
fmulp  %st,%st(1)
fldt   0x5c(%rsp)
fmulp  %st,%st(1)
add    $0x68,%rsp
ret

LLVM IR (-O0):
@tgammal.c = internal global i32 9
@tgammal.lanczos_coefficients = internal global [11 x x86_fp80] [x86_fp80 0xK3FFF8000000000000800, x86_fp80 0xK400BB2A33395E8F45000, x86_fp80 0xKC00CE77D3791F2A27000, x86_fp80 0xK400CDF4DF89A6C23C000, x86_fp80 0xKC00BC66148202FD27800, x86_fp80 0xK4009A2B3771452E36000, x86_fp80 0xKC005D85A791FB2E66000, x86_fp80 0xK4000A6C3BB46B9DAB000, x86_fp80 0xKBFF7F3406EE09ACD6000, x86_fp80 0xK3FE6E73F34C4FC651800, x86_fp80 0xKBFE38A3F5F2D8882B000]
define x86_fp80 @tgammal(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca i32
store x86_fp80 %0, x86_fp80* %2
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
%7 = load x86_fp80, x86_fp80* %2
%8 = fsub x86_fp80 %7, 0xK3FFF8000000000000000
store x86_fp80 %8, x86_fp80* %2
%9 = load x86_fp80, x86_fp80* %2
%10 = load i32, i32* @tgammal.c
%11 = uitofp i32 %10 to x86_fp80
%12 = fadd x86_fp80 %9, %11
%13 = fadd x86_fp80 %12, 0xK3FFE8000000000000000
store x86_fp80 %13, x86_fp80* %4
%14 = load x86_fp80, x86_fp80* getelementptr inbounds ([11 x x86_fp80], [11 x x86_fp80]* @tgammal.lanczos_coefficients, i64 0, i64 0)
store x86_fp80 %14, x86_fp80* %5
store i32 0, i32* %6
store i32 1, i32* %6
br label %15
15: ; preds = %32, %1
%16 = load i32, i32* %6
%17 = load i32, i32* @tgammal.c
%18 = add i32 %17, 2
%19 = icmp ult i32 %16, %18
br i1 %19, label %20, label %35
20: ; preds = %15
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [11 x x86_fp80], [11 x x86_fp80]* @tgammal.lanczos_coefficients, i64 0, i64 %22
%24 = load x86_fp80, x86_fp80* %23
%25 = load x86_fp80, x86_fp80* %2
%26 = load i32, i32* %6
%27 = sitofp i32 %26 to x86_fp80
%28 = fadd x86_fp80 %25, %27
%29 = fdiv x86_fp80 %24, %28
%30 = load x86_fp80, x86_fp80* %5
%31 = fadd x86_fp80 %30, %29
store x86_fp80 %31, x86_fp80* %5
br label %32
32: ; preds = %20
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %15
35: ; preds = %15
%36 = call x86_fp80 @sqrt(i32 6)
%37 = load x86_fp80, x86_fp80* %4
%38 = load x86_fp80, x86_fp80* %2
%39 = fadd x86_fp80 %38, 0xK3FFE8000000000000000
%40 = call x86_fp80 @pow(x86_fp80 %37, x86_fp80 %39)
%41 = fmul x86_fp80 %36, %40
%42 = load x86_fp80, x86_fp80* %4
%43 = fneg x86_fp80 %42
%44 = call x86_fp80 @exp(x86_fp80 %43)
%45 = fmul x86_fp80 %41, %44
%46 = load x86_fp80, x86_fp80* %5
%47 = fmul x86_fp80 %45, %46
store x86_fp80 %47, x86_fp80* %3
%48 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %48
}

LLVM IR (-O2):
define x86_fp80 @tgammal(x86_fp80 %0) {
%2 = fadd x86_fp80 %0, 0xKBFFF8000000000000000
%3 = fadd x86_fp80 %2, 0xK40029000000000000000
%4 = fadd x86_fp80 %2, 0xK3FFF8000000000000000
%5 = fdiv x86_fp80 0xK400BB2A33395E8F45000, %4
%6 = fadd x86_fp80 %5, 0xK3FFF8000000000000800
%7 = fadd x86_fp80 %2, 0xK40008000000000000000
%8 = fdiv x86_fp80 0xKC00CE77D3791F2A27000, %7
%9 = fadd x86_fp80 %6, %8
%10 = fadd x86_fp80 %2, 0xK4000C000000000000000
%11 = fdiv x86_fp80 0xK400CDF4DF89A6C23C000, %10
%12 = fadd x86_fp80 %9, %11
%13 = fadd x86_fp80 %2, 0xK40018000000000000000
%14 = fdiv x86_fp80 0xKC00BC66148202FD27800, %13
%15 = fadd x86_fp80 %12, %14
%16 = fadd x86_fp80 %2, 0xK4001A000000000000000
%17 = fdiv x86_fp80 0xK4009A2B3771452E36000, %16
%18 = fadd x86_fp80 %15, %17
%19 = fadd x86_fp80 %2, 0xK4001C000000000000000
%20 = fdiv x86_fp80 0xKC005D85A791FB2E66000, %19
%21 = fadd x86_fp80 %18, %20
%22 = fadd x86_fp80 %2, 0xK4001E000000000000000
%23 = fdiv x86_fp80 0xK4000A6C3BB46B9DAB000, %22
%24 = fadd x86_fp80 %21, %23
%25 = fadd x86_fp80 %2, 0xK40028000000000000000
%26 = fdiv x86_fp80 0xKBFF7F3406EE09ACD6000, %25
%27 = fadd x86_fp80 %24, %26
%28 = fdiv x86_fp80 0xK3FE6E73F34C4FC651800, %3
%29 = fadd x86_fp80 %27, %28
%30 = fadd x86_fp80 %2, 0xK4002A000000000000000
%31 = fdiv x86_fp80 0xKBFE38A3F5F2D8882B000, %30
%32 = fadd x86_fp80 %29, %31
%33 = fadd x86_fp80 %3, 0xK3FFE8000000000000000
%34 = tail call x86_fp80 @sqrt(i32 6)
%35 = fadd x86_fp80 %2, 0xK3FFE8000000000000000
%36 = tail call x86_fp80 @pow(x86_fp80 %33, x86_fp80 %35)
%37 = fmul x86_fp80 %34, %36
%38 = fneg x86_fp80 %33
%39 = tail call x86_fp80 @exp(x86_fp80 %38)
%40 = fmul x86_fp80 %37, %39
%41 = fmul x86_fp80 %32, %40
ret x86_fp80 %41
}