#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);
double fabs(double);
double sqrt(double);
double fgamma_lenz(int m, double x) {
  int i;
  double a, an, b, c, d, del, h;
  a = m + 0.5;
  b = x + 1.0 - a;
  c = 1.0 / 1.0E-30;
  d = 1.0 / b;
  h = d;
  for (i = 1; i <= 100; i++) {
    an = (a - i) * i;
    b += 2;
    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) < 1.0e-15)
      break;
  }
  d = 1.0;
  c = 1.0 / (x + x);
  for (i = 1; i <= (m + m - 1); i += 2)
    d *= i * c;
  d *= (double)0.8862269254528 / sqrt(x);
  return d - 0.5 * exp(-x) * h;
}


x86 assembly (clang, -O0):
<fgamma_lenz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xed3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb2(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe8e(%rip),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     12cd <fgamma_lenz+0x1ad>
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe65(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movaps 0xe53(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe1f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1210 <fgamma_lenz+0xf0>
movsd  0xe0d(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
divsd  -0x38(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0xe0c(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdd8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1257 <fgamma_lenz+0x137>
movsd  0xdc6(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xda1(%rip),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  0xd6c(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xda1(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd7d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12ba <fgamma_lenz+0x19a>
jmp    12cd <fgamma_lenz+0x1ad>
jmp    12bf <fgamma_lenz+0x19f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <fgamma_lenz+0x6d>
movsd  0xd2b(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xd14(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1332 <fgamma_lenz+0x212>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    12fc <fgamma_lenz+0x1dc>
movsd  -0x10(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xce9(%rip),%xmm0
divsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  0xc80(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgamma_lenz>:
sub    $0x28,%rsp
movapd %xmm0,%xmm14
cvtsi2sd %edi,%xmm15
addsd  0xec9(%rip),%xmm15
movsd  0xec8(%rip),%xmm13
movapd %xmm0,%xmm3
addsd  %xmm13,%xmm3
subsd  %xmm15,%xmm3
movapd %xmm13,%xmm5
divsd  %xmm3,%xmm5
movsd  0xeb0(%rip),%xmm8
mov    $0x1,%eax
movsd  0xeaa(%rip),%xmm12
movapd 0xeda(%rip),%xmm1
movsd  0xea2(%rip),%xmm6
movsd  0xea1(%rip),%xmm9
movapd 0xec0(%rip),%xmm10
movsd  0xe97(%rip),%xmm11
movapd %xmm5,%xmm7
movapd %xmm8,%xmm4
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm15,%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm12,%xmm3
mulsd  %xmm2,%xmm7
movapd %xmm7,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm0,%xmm7
andpd  %xmm1,%xmm7
ucomisd %xmm7,%xmm6
movapd %xmm8,%xmm7
ja     11f1 <fgamma_lenz+0xd1>
movapd %xmm13,%xmm7
divsd  %xmm0,%xmm7
divsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movapd %xmm2,%xmm4
andpd  %xmm1,%xmm4
cmpltsd %xmm6,%xmm4
movapd %xmm4,%xmm0
andnpd %xmm2,%xmm0
andpd  %xmm6,%xmm4
orpd   %xmm0,%xmm4
movapd %xmm7,%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm5
addsd  %xmm9,%xmm0
andpd  %xmm10,%xmm0
ucomisd %xmm0,%xmm11
ja     1241 <fgamma_lenz+0x121>
lea    0x1(%rax),%ecx
cmp    $0x64,%eax
mov    %ecx,%eax
jne    11b0 <fgamma_lenz+0x90>
test   %edi,%edi
jle    128b <fgamma_lenz+0x16b>
movapd %xmm14,%xmm0
addsd  %xmm14,%xmm0
divsd  %xmm0,%xmm13
add    %edi,%edi
mov    $0x1,%eax
movsd  0xda5(%rip),%xmm0
movapd %xmm0,%xmm2
nopw   0x0(%rax,%rax,1)
movapd %xmm13,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
addsd  %xmm12,%xmm0
add    $0x2,%eax
cmp    %edi,%eax
jl     1270 <fgamma_lenz+0x150>
jmp    1290 <fgamma_lenz+0x170>
movapd %xmm13,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm14
movsd  %xmm5,0x8(%rsp)
jb     12ab <fgamma_lenz+0x18b>
xorps  %xmm0,%xmm0
sqrtsd %xmm14,%xmm0
jmp    12cd <fgamma_lenz+0x1ad>
movapd %xmm14,%xmm0
movapd %xmm14,0x10(%rsp)
movsd  %xmm2,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm2
movapd 0x10(%rsp),%xmm14
movsd  0xd63(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
xorpd  0xd75(%rip),%xmm14
movapd %xmm14,%xmm0
call   1030 <exp@plt>
mulsd  0xd43(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @fgamma_lenz(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to double
%15 = fadd double %14, 5.000000e-01
store double %15, double* %6
%16 = load double, double* %4
%17 = fadd double %16, 1.000000e+00
%18 = load double, double* %6
%19 = fsub double %17, %18
store double %19, double* %8
store double 0x46293E5939A08CE9, double* %9
%20 = load double, double* %8
%21 = fdiv double 1.000000e+00, %20
store double %21, double* %10
%22 = load double, double* %10
store double %22, double* %12
store i32 1, i32* %5
br label %23
23: ; preds = %69, %2
%24 = load i32, i32* %5
%25 = icmp sle i32 %24, 100
br i1 %25, label %26, label %72
26: ; preds = %23
%27 = load double, double* %6
%28 = load i32, i32* %5
%29 = sitofp i32 %28 to double
%30 = fsub double %27, %29
%31 = load i32, i32* %5
%32 = sitofp i32 %31 to double
%33 = fmul double %30, %32
store double %33, double* %7
%34 = load double, double* %8
%35 = fadd double %34, 2.000000e+00
store double %35, double* %8
%36 = load double, double* %7
%37 = load double, double* %10
%38 = load double, double* %8
%39 = call double @llvm.fmuladd.f64(double %36, double %37, double %38)
store double %39, double* %10
%40 = load double, double* %10
%41 = call double @llvm.fabs.f64(double %40)
%42 = fcmp olt double %41, 1.000000e-30
br i1 %42, label %43, label %44
43: ; preds = %26
store double 1.000000e-30, double* %10
br label %44
44: ; preds = %43, %26
%45 = load double, double* %8
%46 = load double, double* %7
%47 = load double, double* %9
%48 = fdiv double %46, %47
%49 = fadd double %45, %48
store double %49, double* %9
%50 = load double, double* %9
%51 = call double @llvm.fabs.f64(double %50)
%52 = fcmp olt double %51, 1.000000e-30
br i1 %52, label %53, label %54
53: ; preds = %44
store double 1.000000e-30, double* %9
br label %54
54: ; preds = %53, %44
%55 = load double, double* %10
%56 = fdiv double 1.000000e+00, %55
store double %56, double* %10
%57 = load double, double* %10
%58 = load double, double* %9
%59 = fmul double %57, %58
store double %59, double* %11
%60 = load double, double* %11
%61 = load double, double* %12
%62 = fmul double %61, %60
store double %62, double* %12
%63 = load double, double* %11
%64 = fsub double %63, 1.000000e+00
%65 = call double @llvm.fabs.f64(double %64)
%66 = fcmp olt double %65, 1.000000e-15
br i1 %66, label %67, label %68
67: ; preds = %54
br label %72
68: ; preds = %54
br label %69
69: ; preds = %68
%70 = load i32, i32* %5
%71 = add nsw i32 %70, 1
store i32 %71, i32* %5
br label %23
72: ; preds = %67, %23
store double 1.000000e+00, double* %10
%73 = load double, double* %4
%74 = load double, double* %4
%75 = fadd double %73, %74
%76 = fdiv double 1.000000e+00, %75
store double %76, double* %9
store i32 1, i32* %5
br label %77
77: ; preds = %91, %72
%78 = load i32, i32* %5
%79 = load i32, i32* %3
%80 = load i32, i32* %3
%81 = add nsw i32 %79, %80
%82 = sub nsw i32 %81, 1
%83 = icmp sle i32 %78, %82
br i1 %83, label %84, label %94
84: ; preds = %77
%85 = load i32, i32* %5
%86 = sitofp i32 %85 to double
%87 = load double, double* %9
%88 = fmul double %86, %87
%89 = load double, double* %10
%90 = fmul double %89, %88
store double %90, double* %10
br label %91
91: ; preds = %84
%92 = load i32, i32* %5
%93 = add nsw i32 %92, 2
store i32 %93, i32* %5
br label %77
94: ; preds = %77
%95 = load double, double* %4
%96 = call double @sqrt(double %95)
%97 = fdiv double 0x3FEC5BF891B4F0E5, %96
%98 = load double, double* %10
%99 = fmul double %98, %97
store double %99, double* %10
%100 = load double, double* %10
%101 = load double, double* %4
%102 = fneg double %101
%103 = call double @exp(double %102)
%104 = fmul double 5.000000e-01, %103
%105 = load double, double* %12
%106 = fneg double %104
%107 = call double @llvm.fmuladd.f64(double %106, double %105, double %100)
ret double %107
}

LLVM IR (-O2):
define double @fgamma_lenz(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = fadd double %3, 5.000000e-01
%5 = fadd double %1, 1.000000e+00
%6 = fsub double %5, %4
%7 = fdiv double 1.000000e+00, %6
br label %8
8: ; preds = %8, %2
%9 = phi double [ %7, %2 ], [ %29, %8 ]
%10 = phi i32 [ 1, %2 ], [ %33, %8 ]
%11 = phi double [ %7, %2 ], [ %27, %8 ]
%12 = phi double [ 0x46293E5939A08CE9, %2 ], [ %25, %8 ]
%13 = phi double [ %6, %2 ], [ %17, %8 ]
%14 = sitofp i32 %10 to double
%15 = fsub double %4, %14
%16 = fmul double %15, %14
%17 = fadd double %13, 2.000000e+00
%18 = tail call double @llvm.fmuladd.f64(double %16, double %11, double %17)
%19 = tail call double @llvm.fabs.f64(double %18)
%20 = fcmp olt double %19, 1.000000e-30
%21 = fdiv double %16, %12
%22 = fadd double %17, %21
%23 = tail call double @llvm.fabs.f64(double %22)
%24 = fcmp olt double %23, 1.000000e-30
%25 = select i1 %24, double 1.000000e-30, double %22
%26 = fdiv double 1.000000e+00, %18
%27 = select i1 %20, double 0x46293E5939A08CE9, double %26
%28 = fmul double %27, %25
%29 = fmul double %9, %28
%30 = fadd double %28, -1.000000e+00
%31 = tail call double @llvm.fabs.f64(double %30)
%32 = fcmp olt double %31, 1.000000e-15
%33 = add nuw nsw i32 %10, 1
%34 = icmp eq i32 %33, 101
%35 = select i1 %32, i1 true, i1 %34
br i1 %35, label %36, label %8
36: ; preds = %8
%37 = fadd double %1, %1
%38 = fdiv double 1.000000e+00, %37
%39 = shl nsw i32 %0, 1
%40 = icmp sgt i32 %0, 0
br i1 %40, label %41, label %49
41: ; preds = %36, %41
%42 = phi i32 [ %47, %41 ], [ 1, %36 ]
%43 = phi double [ %46, %41 ], [ 1.000000e+00, %36 ]
%44 = sitofp i32 %42 to double
%45 = fmul double %38, %44
%46 = fmul double %43, %45
%47 = add nuw nsw i32 %42, 2
%48 = icmp slt i32 %47, %39
br i1 %48, label %41, label %49
49: ; preds = %41, %36
%50 = phi double [ 1.000000e+00, %36 ], [ %46, %41 ]
%51 = tail call double @sqrt(double %1)
%52 = fdiv double 0x3FEC5BF891B4F0E5, %51
%53 = fmul double %50, %52
%54 = fneg double %1
%55 = tail call double @exp(double %54)
%56 = fmul double %55, -5.000000e-01
%57 = tail call double @llvm.fmuladd.f64(double %56, double %29, double %53)
ret double %57
}