#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 /*<<< orphan*/ M_PI;
double compute_d1F1_dz2_2d(int, double, double, int);
double compute_d1F1_dz3_3d(int, double, double, double, int);
double exp(double);
int fabs(double);
double lfact(int);
double lgamma(int);
double log(double);
int sqrt(int /*<<< orphan*/);
double surface_area_sphere(int);
double compute_d1F1_dz2_3d(int dim, double z1, double z2, double z3, int iter) {
  if (fabs(z1) < 1e-8)
    return surface_area_sphere(dim) / (double)(dim + 1);
  if (fabs(z3) < 1e-8)
    return sqrt(M_PI) * compute_d1F1_dz2_2d(dim, z1, z2, iter);
  if (z1 < 0)
    return exp(z1) * compute_d1F1_dz3_3d(dim, -z1, z3 - z1, z2 - z1, iter);
  int i, j, k;
  double g, F = 0.0, logz1 = log(z1), logz2 = log(z2), logz3 = log(z3);
  double a = .5, b = .5 * (dim + 1);
  for (i = 0; i < iter; i++) {
    for (j = 1; j < iter; j++) {
      for (k = 0; k < iter; k++) {
        g = lgamma(i + a) + lgamma(j + a) + lgamma(k + a) -
            lgamma(i + j + k + b) + i * logz1 + (j - 1) * logz2 + k * logz3 -
            lfact(i) - lfact(j - 1) - lfact(k);
        if ((i > z1 || j > z2 || k > z3) && exp(g) < 1e-8 * F)
          break;
        F += exp(g);
      }
    }
  }
  return 2 * sqrt(M_PI) * F;
}


x86 assembly (clang, -O0):
<compute_d1F1_dz2_3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    %esi,-0x2c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe3a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f0 <compute_d1F1_dz2_3d+0x60>
mov    -0xc(%rbp),%edi
call   1070 <surface_area_sphere@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    154c <compute_d1F1_dz2_3d+0x3bc>
movsd  -0x28(%rbp),%xmm0
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdfa(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1252 <compute_d1F1_dz2_3d+0xc2>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
call   10b0 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x2c(%rbp),%esi
call   1040 <compute_d1F1_dz2_2d@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    154c <compute_d1F1_dz2_3d+0x3bc>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    12c0 <compute_d1F1_dz2_3d+0x130>
movsd  -0x18(%rbp),%xmm0
call   1060 <exp@plt>
movsd  %xmm0,-0x80(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
mov    -0x2c(%rbp),%esi
call   1090 <compute_d1F1_dz3_3d@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    154c <compute_d1F1_dz2_3d+0x3bc>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   10a0 <log@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   10a0 <log@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   10a0 <log@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  0xd0b(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xcf4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    152d <compute_d1F1_dz2_3d+0x39d>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    151a <compute_d1F1_dz2_3d+0x38a>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1507 <compute_d1F1_dz2_3d+0x377>
cvtsi2sdl -0x30(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <lgamma@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
cvtsi2sdl -0x34(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <lgamma@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
cvtsi2sdl -0x38(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <lgamma@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
cvtsi2sd %eax,%xmm0
addsd  -0x70(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <lgamma@plt>
movsd  -0xa0(%rbp),%xmm1
ff
subsd  %xmm0,%xmm1
cvtsi2sdl -0x30(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x38(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x30(%rbp),%edi
call   1030 <lfact@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x34(%rbp),%edi
sub    $0x1,%edi
call   1030 <lfact@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x38(%rbp),%edi
call   1030 <lfact@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x30(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     14bc <compute_d1F1_dz2_3d+0x32c>
cvtsi2sdl -0x34(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
ja     14bc <compute_d1F1_dz2_3d+0x32c>
cvtsi2sdl -0x38(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    14e5 <compute_d1F1_dz2_3d+0x355>
movsd  -0x40(%rbp),%xmm0
call   1060 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xb2f(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14e5 <compute_d1F1_dz2_3d+0x355>
jmp    1507 <compute_d1F1_dz2_3d+0x377>
movsd  -0x40(%rbp),%xmm0
call   1060 <exp@plt>
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    134a <compute_d1F1_dz2_3d+0x1ba>
jmp    150c <compute_d1F1_dz2_3d+0x37c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1337 <compute_d1F1_dz2_3d+0x1a7>
jmp    151f <compute_d1F1_dz2_3d+0x38f>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1324 <compute_d1F1_dz2_3d+0x194>
mov    0x2ab4(%rip),%rax
mov    (%rax),%edi
call   10b0 <sqrt@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_d1F1_dz2_3d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %esi,0x8(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,0x20(%rsp)
mov    %edi,%ebx
movapd %xmm0,0x40(%rsp)
call   1050 <fabs@plt>
test   %eax,%eax
jle    122e <compute_d1F1_dz2_3d+0x9e>
movsd  0x28(%rsp),%xmm0
call   1050 <fabs@plt>
test   %eax,%eax
jle    1248 <compute_d1F1_dz2_3d+0xb8>
xorpd  %xmm1,%xmm1
movapd 0x40(%rsp),%xmm0
ucomisd %xmm0,%xmm1
jbe    1283 <compute_d1F1_dz2_3d+0xf3>
call   1060 <exp@plt>
movsd  %xmm0,(%rsp)
movapd 0xe29(%rip),%xmm0
movapd 0x40(%rsp),%xmm2
xorpd  %xmm2,%xmm0
movsd  0x28(%rsp),%xmm1
subsd  %xmm2,%xmm1
movapd %xmm2,%xmm3
movsd  0x20(%rsp),%xmm2
subsd  %xmm3,%xmm2
mov    %ebx,%edi
mov    0x8(%rsp),%esi
call   1090 <compute_d1F1_dz3_3d@plt>
mulsd  (%rsp),%xmm0
jmp    1551 <compute_d1F1_dz2_3d+0x3c1>
mov    %ebx,%edi
call   1070 <surface_area_sphere@plt>
add    $0x1,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
jmp    1551 <compute_d1F1_dz2_3d+0x3c1>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
call   10b0 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
movapd 0x40(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mov    0x8(%rsp),%esi
call   1040 <compute_d1F1_dz2_2d@plt>
mulsd  (%rsp),%xmm0
jmp    1551 <compute_d1F1_dz2_3d+0x3c1>
call   10a0 <log@plt>
movsd  %xmm0,0x78(%rsp)
movsd  0x20(%rsp),%xmm0
call   10a0 <log@plt>
movsd  %xmm0,0x70(%rsp)
movsd  0x28(%rsp),%xmm0
call   10a0 <log@plt>
xorpd  %xmm1,%xmm1
movsd  %xmm0,0x68(%rsp)
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    152e <compute_d1F1_dz2_3d+0x39e>
add    $0x1,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xd2e(%rip),%xmm0
movsd  %xmm0,0x60(%rsp)
movl   $0x0,0xc(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%edx
xorpd  %xmm1,%xmm1
jmp    132e <compute_d1F1_dz2_3d+0x19e>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x10(%rsp),%xmm0
addsd  0xcfa(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
mov    0x34(%rsp),%edx
add    $0x1,%edx
mov    %ecx,0xc(%rsp)
cmp    %eax,%ecx
je     152e <compute_d1F1_dz2_3d+0x39e>
cmp    $0x1,%eax
mov    %edx,0x34(%rsp)
je     1300 <compute_d1F1_dz2_3d+0x170>
movsd  0x10(%rsp),%xmm0
addsd  0xcbb(%rip),%xmm0
cvttsd2si %xmm0,%r12d
mov    $0x1,%ecx
mov    %edx,%r14d
movsd  0xcae(%rip),%xmm2
jmp    137e <compute_d1F1_dz2_3d+0x1ee>
nopl   0x0(%rax)
movsd  0x50(%rsp),%xmm2
addsd  0xc9a(%rip),%xmm2
mov    0x58(%rsp),%rcx
add    $0x1,%ecx
add    $0x1,%r14d
cmp    %eax,%ecx
je     1300 <compute_d1F1_dz2_3d+0x170>
movsd  0x10(%rsp),%xmm0
ucomisd 0x40(%rsp),%xmm0
seta   %al
movapd %xmm2,%xmm0
addsd  0xc67(%rip),%xmm0
cvttsd2si %xmm0,%r13d
mov    %rcx,0x58(%rsp)
lea    -0x1(%rcx),%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x80(%rsp)
movsd  %xmm2,0x50(%rsp)
ucomisd 0x20(%rsp),%xmm2
seta   %r15b
or     %al,%r15b
xor    %ebp,%ebp
jmp    13f2 <compute_d1F1_dz2_3d+0x262>
nopl   (%rax)
movapd %xmm1,%xmm0
call   1060 <exp@plt>
movsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
add    $0x1,%ebp
mov    0x8(%rsp),%eax
cmp    %ebp,%eax
je     1360 <compute_d1F1_dz2_3d+0x1d0>
movsd  %xmm1,0x18(%rsp)
mov    %r12d,%edi
call   1080 <lgamma@plt>
movsd  %xmm0,(%rsp)
mov    %r13d,%edi
call   1080 <lgamma@plt>
movapd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x38(%rsp)
addsd  (%rsp),%xmm1
movsd  %xmm1,(%rsp)
addsd  0xbd0(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <lgamma@plt>
lea    (%r14,%rbp,1),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
addsd  0x60(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1080 <lgamma@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  0x78(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  0x80(%rsp),%xmm1
mulsd  0x70(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
mulsd  0x68(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
mov    0xc(%rsp),%edi
call   1030 <lfact@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <lfact@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %ebp,%edi
call   1030 <lfact@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
ucomisd 0x28(%rsp),%xmm0
seta   %al
or     %r15b,%al
cmp    $0x1,%al
jne    13d0 <compute_d1F1_dz2_3d+0x240>
movapd %xmm1,%xmm0
movsd  %xmm1,(%rsp)
call   1060 <exp@plt>
movsd  0x18(%rsp),%xmm1
mulsd  0xb00(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  (%rsp),%xmm1
jbe    13d0 <compute_d1F1_dz2_3d+0x240>
mov    0x8(%rsp),%eax
movsd  0x18(%rsp),%xmm1
jmp    1360 <compute_d1F1_dz2_3d+0x1d0>
movsd  %xmm1,0x18(%rsp)
mov    0x2aad(%rip),%rax
mov    (%rax),%edi
call   10b0 <sqrt@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x18(%rsp),%xmm0
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @compute_d1F1_dz2_3d(i32 %0, double %1, double %2, double %3, i32 %4) {
%6 = alloca double
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
store i32 %0, i32* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store i32 %4, i32* %11
%22 = load double, double* %8
%23 = call i32 @fabs(double %22)
%24 = sitofp i32 %23 to double
%25 = fcmp olt double %24, 1.000000e-08
br i1 %25, label %26, label %33
26: ; preds = %5
%27 = load i32, i32* %7
%28 = call double @surface_area_sphere(i32 %27)
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
%31 = sitofp i32 %30 to double
%32 = fdiv double %28, %31
store double %32, double* %6
br label %190
33: ; preds = %5
%34 = load double, double* %10
%35 = call i32 @fabs(double %34)
%36 = sitofp i32 %35 to double
%37 = fcmp olt double %36, 1.000000e-08
br i1 %37, label %38, label %48
38: ; preds = %33
%39 = load i32, i32* @M_PI
%40 = call i32 @sqrt(i32 %39)
%41 = sitofp i32 %40 to double
%42 = load i32, i32* %7
%43 = load double, double* %8
%44 = load double, double* %9
%45 = load i32, i32* %11
%46 = call double @compute_d1F1_dz2_2d(i32 %42, double %43, double %44, i32 %45)
%47 = fmul double %41, %46
store double %47, double* %6
br label %190
48: ; preds = %33
%49 = load double, double* %8
%50 = fcmp olt double %49, 0.000000e+00
br i1 %50, label %51, label %66
51: ; preds = %48
%52 = load double, double* %8
%53 = call double @exp(double %52)
%54 = load i32, i32* %7
%55 = load double, double* %8
%56 = fneg double %55
%57 = load double, double* %10
%58 = load double, double* %8
%59 = fsub double %57, %58
%60 = load double, double* %9
%61 = load double, double* %8
%62 = fsub double %60, %61
%63 = load i32, i32* %11
%64 = call double @compute_d1F1_dz3_3d(i32 %54, double %56, double %59, double %62, i32 %63)
%65 = fmul double %53, %64
store double %65, double* %6
br label %190
66: ; preds = %48
store double 0.000000e+00, double* %16
%67 = load double, double* %8
%68 = call double @log(double %67)
store double %68, double* %17
%69 = load double, double* %9
%70 = call double @log(double %69)
store double %70, double* %18
%71 = load double, double* %10
%72 = call double @log(double %71)
store double %72, double* %19
store double 5.000000e-01, double* %20
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
%75 = sitofp i32 %74 to double
%76 = fmul double 5.000000e-01, %75
store double %76, double* %21
store i32 0, i32* %12
br label %77
77: ; preds = %180, %66
%78 = load i32, i32* %12
%79 = load i32, i32* %11
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %183
81: ; preds = %77
store i32 1, i32* %13
br label %82
82: ; preds = %176, %81
%83 = load i32, i32* %13
%84 = load i32, i32* %11
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %179
86: ; preds = %82
store i32 0, i32* %14
br label %87
87: ; preds = %172, %86
%88 = load i32, i32* %14
%89 = load i32, i32* %11
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %175
91: ; preds = %87
%92 = load i32, i32* %12
%93 = sitofp i32 %92 to double
%94 = load double, double* %20
%95 = fadd double %93, %94
%96 = fptosi double %95 to i32
%97 = call double @lgamma(i32 %96)
%98 = load i32, i32* %13
%99 = sitofp i32 %98 to double
%100 = load double, double* %20
%101 = fadd double %99, %100
%102 = fptosi double %101 to i32
%103 = call double @lgamma(i32 %102)
%104 = fadd double %97, %103
%105 = load i32, i32* %14
%106 = sitofp i32 %105 to double
%107 = load double, double* %20
%108 = fadd double %106, %107
%109 = fptosi double %108 to i32
%110 = call double @lgamma(i32 %109)
%111 = fadd double %104, %110
%112 = load i32, i32* %12
%113 = load i32, i32* %13
%114 = add nsw i32 %112, %113
%115 = load i32, i32* %14
%116 = add nsw i32 %114, %115
%117 = sitofp i32 %116 to double
%118 = load double, double* %21
%119 = fadd double %117, %118
%120 = fptosi double %119 to i32
%121 = call double @lgamma(i32 %120)
%122 = fsub double %111, %121
%123 = load i32, i32* %12
%124 = sitofp i32 %123 to double
%125 = load double, double* %17
%126 = call double @llvm.fmuladd.f64(double %124, double %125, double %122)
%127 = load i32, i32* %13
%128 = sub nsw i32 %127, 1
%129 = sitofp i32 %128 to double
%130 = load double, double* %18
%131 = call double @llvm.fmuladd.f64(double %129, double %130, double %126)
%132 = load i32, i32* %14
%133 = sitofp i32 %132 to double
%134 = load double, double* %19
%135 = call double @llvm.fmuladd.f64(double %133, double %134, double %131)
%136 = load i32, i32* %12
%137 = call double @lfact(i32 %136)
%138 = fsub double %135, %137
%139 = load i32, i32* %13
%140 = sub nsw i32 %139, 1
%141 = call double @lfact(i32 %140)
%142 = fsub double %138, %141
%143 = load i32, i32* %14
%144 = call double @lfact(i32 %143)
%145 = fsub double %142, %144
store double %145, double* %15
%146 = load i32, i32* %12
%147 = sitofp i32 %146 to double
%148 = load double, double* %8
%149 = fcmp ogt double %147, %148
br i1 %149, label %160, label %150
150: ; preds = %91
%151 = load i32, i32* %13
%152 = sitofp i32 %151 to double
%153 = load double, double* %9
%154 = fcmp ogt double %152, %153
br i1 %154, label %160, label %155
155: ; preds = %150
%156 = load i32, i32* %14
%157 = sitofp i32 %156 to double
%158 = load double, double* %10
%159 = fcmp ogt double %157, %158
br i1 %159, label %160, label %167
160: ; preds = %155, %150, %91
%161 = load double, double* %15
%162 = call double @exp(double %161)
%163 = load double, double* %16
%164 = fmul double 1.000000e-08, %163
%165 = fcmp olt double %162, %164
br i1 %165, label %166, label %167
166: ; preds = %160
br label %175
167: ; preds = %160, %155
%168 = load double, double* %15
%169 = call double @exp(double %168)
%170 = load double, double* %16
%171 = fadd double %170, %169
store double %171, double* %16
br label %172
172: ; preds = %167
%173 = load i32, i32* %14
%174 = add nsw i32 %173, 1
store i32 %174, i32* %14
br label %87
175: ; preds = %166, %87
br label %176
176: ; preds = %175
%177 = load i32, i32* %13
%178 = add nsw i32 %177, 1
store i32 %178, i32* %13
br label %82
179: ; preds = %82
br label %180
180: ; preds = %179
%181 = load i32, i32* %12
%182 = add nsw i32 %181, 1
store i32 %182, i32* %12
br label %77
183: ; preds = %77
%184 = load i32, i32* @M_PI
%185 = call i32 @sqrt(i32 %184)
%186 = mul nsw i32 2, %185
%187 = sitofp i32 %186 to double
%188 = load double, double* %16
%189 = fmul double %187, %188
store double %189, double* %6
br label %190
190: ; preds = %183, %51, %38, %26
%191 = load double, double* %6
ret double %191
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @compute_d1F1_dz2_3d(i32 %0, double %1, double %2, double %3, i32 %4) {
%6 = tail call i32 @fabs(double %1)
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = tail call double @surface_area_sphere(i32 %0)
%10 = add nsw i32 %0, 1
%11 = sitofp i32 %10 to double
%12 = fdiv double %9, %11
br label %112
13: ; preds = %5
%14 = tail call i32 @fabs(double %3)
%15 = icmp slt i32 %14, 1
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* @M_PI
%18 = tail call i32 @sqrt(i32 %17)
%19 = sitofp i32 %18 to double
%20 = tail call double @compute_d1F1_dz2_2d(i32 %0, double %1, double %2, i32 %4)
%21 = fmul double %20, %19
br label %112
22: ; preds = %13
%23 = fcmp olt double %1, 0.000000e+00
br i1 %23, label %24, label %31
24: ; preds = %22
%25 = tail call double @exp(double %1)
%26 = fneg double %1
%27 = fsub double %3, %1
%28 = fsub double %2, %1
%29 = tail call double @compute_d1F1_dz3_3d(i32 %0, double %26, double %27, double %28, i32 %4)
%30 = fmul double %25, %29
br label %112
31: ; preds = %22
%32 = tail call double @log(double %1)
%33 = tail call double @log(double %2)
%34 = tail call double @log(double %3)
%35 = add nsw i32 %0, 1
%36 = sitofp i32 %35 to double
%37 = fmul double %36, 5.000000e-01
%38 = icmp sgt i32 %4, 0
br i1 %38, label %39, label %105
39: ; preds = %31
%40 = icmp eq i32 %4, 1
br label %41
41: ; preds = %39, %101
%42 = phi i32 [ 0, %39 ], [ %103, %101 ]
%43 = phi double [ 0.000000e+00, %39 ], [ %102, %101 ]
br i1 %40, label %101, label %44
44: ; preds = %41
%45 = sitofp i32 %42 to double
%46 = fadd double %45, 5.000000e-01
%47 = fptosi double %46 to i32
%48 = fcmp ogt double %45, %1
br label %49
49: ; preds = %97, %44
%50 = phi i32 [ 1, %44 ], [ %99, %97 ]
%51 = phi double [ %43, %44 ], [ %98, %97 ]
%52 = sitofp i32 %50 to double
%53 = fadd double %52, 5.000000e-01
%54 = fptosi double %53 to i32
%55 = add nuw nsw i32 %50, %42
%56 = add nsw i32 %50, -1
%57 = sitofp i32 %56 to double
%58 = fcmp ogt double %52, %2
%59 = select i1 %48, i1 true, i1 %58
br label %60
60: ; preds = %49, %92
%61 = phi i32 [ 0, %49 ], [ %95, %92 ]
%62 = phi double [ %51, %49 ], [ %94, %92 ]
%63 = tail call double @lgamma(i32 %47)
%64 = tail call double @lgamma(i32 %54)
%65 = fadd double %63, %64
%66 = sitofp i32 %61 to double
%67 = fadd double %66, 5.000000e-01
%68 = fptosi double %67 to i32
%69 = tail call double @lgamma(i32 %68)
%70 = fadd double %65, %69
%71 = add nuw nsw i32 %55, %61
%72 = sitofp i32 %71 to double
%73 = fadd double %37, %72
%74 = fptosi double %73 to i32
%75 = tail call double @lgamma(i32 %74)
%76 = fsub double %70, %75
%77 = tail call double @llvm.fmuladd.f64(double %45, double %32, double %76)
%78 = tail call double @llvm.fmuladd.f64(double %57, double %33, double %77)
%79 = tail call double @llvm.fmuladd.f64(double %66, double %34, double %78)
%80 = tail call double @lfact(i32 %42)
%81 = fsub double %79, %80
%82 = tail call double @lfact(i32 %56)
%83 = fsub double %81, %82
%84 = tail call double @lfact(i32 %61)
%85 = fsub double %83, %84
%86 = fcmp ogt double %66, %3
%87 = select i1 %59, i1 true, i1 %86
br i1 %87, label %88, label %92
88: ; preds = %60
%89 = tail call double @exp(double %85)
%90 = fmul double %62, 1.000000e-08
%91 = fcmp olt double %89, %90
br i1 %91, label %97, label %92
92: ; preds = %60, %88
%93 = tail call double @exp(double %85)
%94 = fadd double %62, %93
%95 = add nuw nsw i32 %61, 1
%96 = icmp eq i32 %95, %4
br i1 %96, label %97, label %60
97: ; preds = %88, %92
%98 = phi double [ %62, %88 ], [ %94, %92 ]
%99 = add nuw nsw i32 %50, 1
%100 = icmp eq i32 %99, %4
br i1 %100, label %101, label %49
101: ; preds = %97, %41
%102 = phi double [ %43, %41 ], [ %98, %97 ]
%103 = add nuw nsw i32 %42, 1
%104 = icmp eq i32 %103, %4
br i1 %104, label %105, label %41
105: ; preds = %101, %31
%106 = phi double [ 0.000000e+00, %31 ], [ %102, %101 ]
%107 = load i32, i32* @M_PI
%108 = tail call i32 @sqrt(i32 %107)
%109 = shl nsw i32 %108, 1
%110 = sitofp i32 %109 to double
%111 = fmul double %106, %110
br label %112
112: ; preds = %105, %24, %16, %8
%113 = phi double [ %12, %8 ], [ %21, %16 ], [ %30, %24 ], [ %111, %105 ]
ret double %113
}