#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 exp(double);
double lfact(int);
double lgamma(int);
double log(double);
int sqrt(int /*<<< orphan*/);
double compute_1F1_3d_canon(double a, double b, double z1, double z2, double z3,
                            int iter) {
  int i, j, k;
  double g, F = 0.0, logz1 = log(z1), logz2 = log(z2), logz3 = log(z3);
  for (i = 0; i < iter; i++) {
    for (j = 0; 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 * logz2 + k * logz3 -
            lfact(i) - lfact(j) - 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_1F1_3d_canon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %edi,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    139c <compute_1F1_3d_canon+0x24c>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1389 <compute_1F1_3d_canon+0x239>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1376 <compute_1F1_3d_canon+0x226>
cvtsi2sdl -0x30(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <lgamma@plt>
movsd  %xmm0,-0x90(%rbp)
ff
cvtsi2sdl -0x34(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <lgamma@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
cvtsi2sdl -0x38(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <lgamma@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <lgamma@plt>
movsd  -0x80(%rbp),%xmm1
subsd  %xmm0,%xmm1
cvtsi2sdl -0x30(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x34(%rbp),%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,-0x78(%rbp)
mov    -0x30(%rbp),%edi
call   1030 <lfact@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x34(%rbp),%edi
call   1030 <lfact@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x38(%rbp),%edi
call   1030 <lfact@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x30(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     132b <compute_1F1_3d_canon+0x1db>
cvtsi2sdl -0x34(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
ja     132b <compute_1F1_3d_canon+0x1db>
cvtsi2sdl -0x38(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1354 <compute_1F1_3d_canon+0x204>
movsd  -0x40(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xcc0(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1354 <compute_1F1_3d_canon+0x204>
jmp    1376 <compute_1F1_3d_canon+0x226>
movsd  -0x40(%rbp),%xmm0
call   1040 <exp@plt>
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d9 <compute_1F1_3d_canon+0x89>
jmp    137b <compute_1F1_3d_canon+0x22b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c6 <compute_1F1_3d_canon+0x76>
jmp    138e <compute_1F1_3d_canon+0x23e>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b3 <compute_1F1_3d_canon+0x63>
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
call   1070 <sqrt@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x48(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_1F1_3d_canon>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %edi,%ebx
movsd  %xmm4,0x30(%rsp)
movsd  %xmm3,0x28(%rsp)
movsd  %xmm1,0x70(%rsp)
movsd  %xmm0,0x20(%rsp)
movsd  %xmm2,0x50(%rsp)
movapd %xmm2,%xmm0
call   1060 <log@plt>
movsd  %xmm0,0x68(%rsp)
movsd  0x28(%rsp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,0x60(%rsp)
movsd  0x30(%rsp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,0x58(%rsp)
mov    %ebx,0xc(%rsp)
test   %ebx,%ebx
jle    13a9 <compute_1F1_3d_canon+0x259>
xor    %eax,%eax
xorpd  %xmm1,%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
jmp    11e9 <compute_1F1_3d_canon+0x99>
nopl   (%rax)
addsd  0xe30(%rip),%xmm1
mov    0x1c(%rsp),%eax
add    $0x1,%eax
cmp    0xc(%rsp),%eax
je     13b3 <compute_1F1_3d_canon+0x263>
movapd %xmm1,%xmm0
addsd  0x20(%rsp),%xmm0
cvttsd2si %xmm0,%r12d
mov    %eax,0x1c(%rsp)
mov    %eax,%r14d
xorpd  %xmm2,%xmm2
xor    %ebp,%ebp
movsd  %xmm1,0x38(%rsp)
jmp    1231 <compute_1F1_3d_canon+0xe1>
nopl   (%rax)
movsd  0x40(%rsp),%xmm2
addsd  0xdea(%rip),%xmm2
add    $0x1,%ebp
add    $0x1,%r14d
cmp    0xc(%rsp),%ebp
movsd  0x38(%rsp),%xmm1
je     11d0 <compute_1F1_3d_canon+0x80>
ucomisd 0x50(%rsp),%xmm1
seta   %al
movapd %xmm2,%xmm0
addsd  0x20(%rsp),%xmm0
cvttsd2si %xmm0,%r13d
movsd  %xmm2,0x40(%rsp)
ucomisd 0x28(%rsp),%xmm2
seta   %r15b
or     %al,%r15b
xor    %ebx,%ebx
jmp    1282 <compute_1F1_3d_canon+0x132>
movapd %xmm1,%xmm0
call   1040 <exp@plt>
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
add    $0x1,%ebx
cmp    %ebx,0xc(%rsp)
je     1210 <compute_1F1_3d_canon+0xc0>
mov    %r12d,%edi
call   1050 <lgamma@plt>
movsd  %xmm0,(%rsp)
mov    %r13d,%edi
call   1050 <lgamma@plt>
movapd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x48(%rsp)
addsd  (%rsp),%xmm1
movsd  %xmm1,(%rsp)
addsd  0x20(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <lgamma@plt>
lea    (%r14,%rbx,1),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
addsd  0x70(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1050 <lgamma@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
mulsd  0x68(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  0x40(%rsp),%xmm1
mulsd  0x60(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x48(%rsp),%xmm0
mulsd  0x58(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
mov    0x1c(%rsp),%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  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <lfact@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x48(%rsp),%xmm0
ucomisd 0x30(%rsp),%xmm0
seta   %al
or     %r15b,%al
cmp    $0x1,%al
jne    1260 <compute_1F1_3d_canon+0x110>
movapd %xmm1,%xmm0
movsd  %xmm1,(%rsp)
call   1040 <exp@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0xc6b(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  (%rsp),%xmm1
jbe    1260 <compute_1F1_3d_canon+0x110>
jmp    1210 <compute_1F1_3d_canon+0xc0>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x2c2e(%rip),%rax
mov    (%rax),%edi
call   1070 <sqrt@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x78,%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_1F1_3d_canon(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store i32 %5, i32* %12
store double 0.000000e+00, double* %17
%21 = load double, double* %9
%22 = call double @log(double %21)
store double %22, double* %18
%23 = load double, double* %10
%24 = call double @log(double %23)
store double %24, double* %19
%25 = load double, double* %11
%26 = call double @log(double %25)
store double %26, double* %20
store i32 0, i32* %13
br label %27
27: ; preds = %128, %6
%28 = load i32, i32* %13
%29 = load i32, i32* %12
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %131
31: ; preds = %27
store i32 0, i32* %14
br label %32
32: ; preds = %124, %31
%33 = load i32, i32* %14
%34 = load i32, i32* %12
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %127
36: ; preds = %32
store i32 0, i32* %15
br label %37
37: ; preds = %120, %36
%38 = load i32, i32* %15
%39 = load i32, i32* %12
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %123
41: ; preds = %37
%42 = load i32, i32* %13
%43 = sitofp i32 %42 to double
%44 = load double, double* %7
%45 = fadd double %43, %44
%46 = fptosi double %45 to i32
%47 = call double @lgamma(i32 %46)
%48 = load i32, i32* %14
%49 = sitofp i32 %48 to double
%50 = load double, double* %7
%51 = fadd double %49, %50
%52 = fptosi double %51 to i32
%53 = call double @lgamma(i32 %52)
%54 = fadd double %47, %53
%55 = load i32, i32* %15
%56 = sitofp i32 %55 to double
%57 = load double, double* %7
%58 = fadd double %56, %57
%59 = fptosi double %58 to i32
%60 = call double @lgamma(i32 %59)
%61 = fadd double %54, %60
%62 = load i32, i32* %13
%63 = load i32, i32* %14
%64 = add nsw i32 %62, %63
%65 = load i32, i32* %15
%66 = add nsw i32 %64, %65
%67 = sitofp i32 %66 to double
%68 = load double, double* %8
%69 = fadd double %67, %68
%70 = fptosi double %69 to i32
%71 = call double @lgamma(i32 %70)
%72 = fsub double %61, %71
%73 = load i32, i32* %13
%74 = sitofp i32 %73 to double
%75 = load double, double* %18
%76 = call double @llvm.fmuladd.f64(double %74, double %75, double %72)
%77 = load i32, i32* %14
%78 = sitofp i32 %77 to double
%79 = load double, double* %19
%80 = call double @llvm.fmuladd.f64(double %78, double %79, double %76)
%81 = load i32, i32* %15
%82 = sitofp i32 %81 to double
%83 = load double, double* %20
%84 = call double @llvm.fmuladd.f64(double %82, double %83, double %80)
%85 = load i32, i32* %13
%86 = call double @lfact(i32 %85)
%87 = fsub double %84, %86
%88 = load i32, i32* %14
%89 = call double @lfact(i32 %88)
%90 = fsub double %87, %89
%91 = load i32, i32* %15
%92 = call double @lfact(i32 %91)
%93 = fsub double %90, %92
store double %93, double* %16
%94 = load i32, i32* %13
%95 = sitofp i32 %94 to double
%96 = load double, double* %9
%97 = fcmp ogt double %95, %96
br i1 %97, label %108, label %98
98: ; preds = %41
%99 = load i32, i32* %14
%100 = sitofp i32 %99 to double
%101 = load double, double* %10
%102 = fcmp ogt double %100, %101
br i1 %102, label %108, label %103
103: ; preds = %98
%104 = load i32, i32* %15
%105 = sitofp i32 %104 to double
%106 = load double, double* %11
%107 = fcmp ogt double %105, %106
br i1 %107, label %108, label %115
108: ; preds = %103, %98, %41
%109 = load double, double* %16
%110 = call double @exp(double %109)
%111 = load double, double* %17
%112 = fmul double 1.000000e-08, %111
%113 = fcmp olt double %110, %112
br i1 %113, label %114, label %115
114: ; preds = %108
br label %123
115: ; preds = %108, %103
%116 = load double, double* %16
%117 = call double @exp(double %116)
%118 = load double, double* %17
%119 = fadd double %118, %117
store double %119, double* %17
br label %120
120: ; preds = %115
%121 = load i32, i32* %15
%122 = add nsw i32 %121, 1
store i32 %122, i32* %15
br label %37
123: ; preds = %114, %37
br label %124
124: ; preds = %123
%125 = load i32, i32* %14
%126 = add nsw i32 %125, 1
store i32 %126, i32* %14
br label %32
127: ; preds = %32
br label %128
128: ; preds = %127
%129 = load i32, i32* %13
%130 = add nsw i32 %129, 1
store i32 %130, i32* %13
br label %27
131: ; preds = %27
%132 = load i32, i32* @M_PI
%133 = call i32 @sqrt(i32 %132)
%134 = mul nsw i32 2, %133
%135 = sitofp i32 %134 to double
%136 = load double, double* %17
%137 = fmul double %135, %136
ret double %137
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @compute_1F1_3d_canon(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = tail call double @log(double %2)
%8 = tail call double @log(double %3)
%9 = tail call double @log(double %4)
%10 = icmp sgt i32 %5, 0
br i1 %10, label %11, label %71
11: ; preds = %6, %68
%12 = phi i32 [ %69, %68 ], [ 0, %6 ]
%13 = phi double [ %65, %68 ], [ 0.000000e+00, %6 ]
%14 = sitofp i32 %12 to double
%15 = fadd double %14, %0
%16 = fptosi double %15 to i32
%17 = fcmp ogt double %14, %2
br label %18
18: ; preds = %64, %11
%19 = phi i32 [ 0, %11 ], [ %66, %64 ]
%20 = phi double [ %13, %11 ], [ %65, %64 ]
%21 = sitofp i32 %19 to double
%22 = fadd double %21, %0
%23 = fptosi double %22 to i32
%24 = add nuw nsw i32 %19, %12
%25 = fcmp ogt double %21, %3
%26 = select i1 %17, i1 true, i1 %25
br label %27
27: ; preds = %18, %59
%28 = phi i32 [ 0, %18 ], [ %62, %59 ]
%29 = phi double [ %20, %18 ], [ %61, %59 ]
%30 = tail call double @lgamma(i32 %16)
%31 = tail call double @lgamma(i32 %23)
%32 = fadd double %30, %31
%33 = sitofp i32 %28 to double
%34 = fadd double %33, %0
%35 = fptosi double %34 to i32
%36 = tail call double @lgamma(i32 %35)
%37 = fadd double %32, %36
%38 = add nuw nsw i32 %24, %28
%39 = sitofp i32 %38 to double
%40 = fadd double %39, %1
%41 = fptosi double %40 to i32
%42 = tail call double @lgamma(i32 %41)
%43 = fsub double %37, %42
%44 = tail call double @llvm.fmuladd.f64(double %14, double %7, double %43)
%45 = tail call double @llvm.fmuladd.f64(double %21, double %8, double %44)
%46 = tail call double @llvm.fmuladd.f64(double %33, double %9, double %45)
%47 = tail call double @lfact(i32 %12)
%48 = fsub double %46, %47
%49 = tail call double @lfact(i32 %19)
%50 = fsub double %48, %49
%51 = tail call double @lfact(i32 %28)
%52 = fsub double %50, %51
%53 = fcmp ogt double %33, %4
%54 = select i1 %26, i1 true, i1 %53
br i1 %54, label %55, label %59
55: ; preds = %27
%56 = tail call double @exp(double %52)
%57 = fmul double %29, 1.000000e-08
%58 = fcmp olt double %56, %57
br i1 %58, label %64, label %59
59: ; preds = %27, %55
%60 = tail call double @exp(double %52)
%61 = fadd double %29, %60
%62 = add nuw nsw i32 %28, 1
%63 = icmp eq i32 %62, %5
br i1 %63, label %64, label %27
64: ; preds = %55, %59
%65 = phi double [ %29, %55 ], [ %61, %59 ]
%66 = add nuw nsw i32 %19, 1
%67 = icmp eq i32 %66, %5
br i1 %67, label %68, label %18
68: ; preds = %64
%69 = add nuw nsw i32 %12, 1
%70 = icmp eq i32 %69, %5
br i1 %70, label %71, label %11
71: ; preds = %68, %6
%72 = phi double [ 0.000000e+00, %6 ], [ %65, %68 ]
%73 = load i32, i32* @M_PI
%74 = tail call i32 @sqrt(i32 %73)
%75 = shl nsw i32 %74, 1
%76 = sitofp i32 %75 to double
%77 = fmul double %72, %76
ret double %77
}