#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_1F1_2d(int, double, double, int);
double compute_1F1_3d_canon(double, double, double, double, double, int);
double exp(double);
int fabs(double);
double sqrt(int /*<<< orphan*/);
double surface_area_sphere(int);
double compute_1F1_3d(int dim, double z1, double z2, double z3, int iter) {
  if (fabs(z1) < 1e-8)
    return surface_area_sphere(dim);
  if (fabs(z3) < 1e-8)
    return sqrt(M_PI) * compute_1F1_2d(dim, z1, z2, iter);
  if (z1 < 0)
    return exp(z1) * compute_1F1_3d(dim, -z1, z3 - z1, z2 - z1, iter);
  return compute_1F1_3d_canon(.5, .5 * (dim + 1), z1, z2, z3, iter);
}


x86 assembly (clang, -O0):
<compute_1F1_3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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  0xe5d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bf <compute_1F1_3d+0x4f>
mov    -0xc(%rbp),%edi
call   1080 <surface_area_sphere@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    12c5 <compute_1F1_3d+0x155>
movsd  -0x28(%rbp),%xmm0
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe2b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    121d <compute_1F1_3d+0xad>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
call   1090 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x2c(%rbp),%esi
call   1060 <compute_1F1_2d@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c5 <compute_1F1_3d+0x155>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    128b <compute_1F1_3d+0x11b>
movsd  -0x18(%rbp),%xmm0
call   1070 <exp@plt>
movsd  %xmm0,-0x40(%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   1040 <compute_1F1_3d@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c5 <compute_1F1_3d+0x155>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd6b(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
mov    -0x2c(%rbp),%edi
movsd  0xd4d(%rip),%xmm0
call   1030 <compute_1F1_3d_canon@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_1F1_3d>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebx
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x8(%rsp)
mov    %edi,%ebp
movaps %xmm0,0x10(%rsp)
call   1050 <fabs@plt>
test   %eax,%eax
jle    11fe <compute_1F1_3d+0x8e>
movsd  (%rsp),%xmm0
call   1050 <fabs@plt>
test   %eax,%eax
jle    120b <compute_1F1_3d+0x9b>
xorpd  %xmm0,%xmm0
movapd 0x10(%rsp),%xmm2
ucomisd %xmm2,%xmm0
jbe    123f <compute_1F1_3d+0xcf>
movapd %xmm2,%xmm0
call   1070 <exp@plt>
movsd  %xmm0,0x20(%rsp)
movapd 0xe44(%rip),%xmm0
movapd 0x10(%rsp),%xmm2
xorpd  %xmm2,%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm2,%xmm1
movapd %xmm2,%xmm3
movsd  0x8(%rsp),%xmm2
subsd  %xmm3,%xmm2
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <compute_1F1_3d@plt>
mulsd  0x20(%rsp),%xmm0
jmp    1238 <compute_1F1_3d+0xc8>
mov    %ebp,%edi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1080 <surface_area_sphere@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
call   1090 <sqrt@plt>
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
movapd 0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %ebx,%esi
call   1060 <compute_1F1_2d@plt>
mulsd  (%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret
add    $0x1,%ebp
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  0xdaf(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm3
movsd  (%rsp),%xmm4
mov    %ebx,%edi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <compute_1F1_3d_canon@plt>

LLVM IR (-O0):
@M_PI = global i32 0
define double @compute_1F1_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
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
%12 = load double, double* %8
%13 = call i32 @fabs(double %12)
%14 = sitofp i32 %13 to double
%15 = fcmp olt double %14, 1.000000e-08
br i1 %15, label %16, label %19
16: ; preds = %5
%17 = load i32, i32* %7
%18 = call double @surface_area_sphere(i32 %17)
store double %18, double* %6
br label %61
19: ; preds = %5
%20 = load double, double* %10
%21 = call i32 @fabs(double %20)
%22 = sitofp i32 %21 to double
%23 = fcmp olt double %22, 1.000000e-08
br i1 %23, label %24, label %33
24: ; preds = %19
%25 = load i32, i32* @M_PI
%26 = call double @sqrt(i32 %25)
%27 = load i32, i32* %7
%28 = load double, double* %8
%29 = load double, double* %9
%30 = load i32, i32* %11
%31 = call double @compute_1F1_2d(i32 %27, double %28, double %29, i32 %30)
%32 = fmul double %26, %31
store double %32, double* %6
br label %61
33: ; preds = %19
%34 = load double, double* %8
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load double, double* %8
%38 = call double @exp(double %37)
%39 = load i32, i32* %7
%40 = load double, double* %8
%41 = fneg double %40
%42 = load double, double* %10
%43 = load double, double* %8
%44 = fsub double %42, %43
%45 = load double, double* %9
%46 = load double, double* %8
%47 = fsub double %45, %46
%48 = load i32, i32* %11
%49 = call double @compute_1F1_3d(i32 %39, double %41, double %44, double %47, i32 %48)
%50 = fmul double %38, %49
store double %50, double* %6
br label %61
51: ; preds = %33
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
%54 = sitofp i32 %53 to double
%55 = fmul double 5.000000e-01, %54
%56 = load double, double* %8
%57 = load double, double* %9
%58 = load double, double* %10
%59 = load i32, i32* %11
%60 = call double @compute_1F1_3d_canon(double 5.000000e-01, double %55, double %56, double %57, double %58, i32 %59)
store double %60, double* %6
br label %61
61: ; preds = %51, %36, %24, %16
%62 = load double, double* %6
ret double %62
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @compute_1F1_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 %10
8: ; preds = %5
%9 = tail call double @surface_area_sphere(i32 %0)
br label %20
10: ; preds = %5
%11 = tail call i32 @fabs(double %3)
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* @M_PI
%15 = tail call double @sqrt(i32 %14)
%16 = tail call double @compute_1F1_2d(i32 %0, double %1, double %2, i32 %4)
%17 = fmul double %15, %16
br label %20
18: ; preds = %10
%19 = fcmp olt double %1, 0.000000e+00
br i1 %19, label %22, label %29
20: ; preds = %8, %13, %29, %22
%21 = phi double [ %28, %22 ], [ %9, %8 ], [ %17, %13 ], [ %33, %29 ]
ret double %21
22: ; preds = %18
%23 = tail call double @exp(double %1)
%24 = fneg double %1
%25 = fsub double %3, %1
%26 = fsub double %2, %1
%27 = tail call double @compute_1F1_3d(i32 %0, double %24, double %25, double %26, i32 %4)
%28 = fmul double %23, %27
br label %20
29: ; preds = %18
%30 = add nsw i32 %0, 1
%31 = sitofp i32 %30 to double
%32 = fmul double %31, 5.000000e-01
%33 = tail call double @compute_1F1_3d_canon(double 5.000000e-01, double %32, double %1, double %2, double %3, i32 %4)
br label %20
}