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


x86 assembly (clang, -O0):
<compute_1F1_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe62(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ba <compute_1F1_2d+0x4a>
mov    -0xc(%rbp),%edi
call   1060 <surface_area_sphere@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    12ac <compute_1F1_2d+0x13c>
movsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe30(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1213 <compute_1F1_2d+0xa3>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1080 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
mov    -0x24(%rbp),%esi
call   1090 <compute_1F1_1d@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12ac <compute_1F1_2d+0x13c>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1277 <compute_1F1_2d+0x107>
movsd  -0x18(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mov    -0x24(%rbp),%esi
call   1040 <compute_1F1_2d@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12ac <compute_1F1_2d+0x13c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd7f(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
mov    -0x24(%rbp),%edi
movsd  0xd66(%rip),%xmm0
call   1070 <compute_1F1_2d_canon@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_1F1_2d>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebx
movsd  %xmm1,0x8(%rsp)
mov    %edi,%ebp
movaps %xmm0,0x10(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    11e5 <compute_1F1_2d+0x75>
movsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jle    11f2 <compute_1F1_2d+0x82>
xorpd  %xmm0,%xmm0
movapd 0x10(%rsp),%xmm2
ucomisd %xmm2,%xmm0
jbe    1222 <compute_1F1_2d+0xb2>
movapd %xmm2,%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm1
movapd 0x10(%rsp),%xmm0
subsd  %xmm0,%xmm1
xorpd  0xe3c(%rip),%xmm0
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <compute_1F1_2d@plt>
mulsd  0x20(%rsp),%xmm0
jmp    121b <compute_1F1_2d+0xab>
mov    %ebp,%edi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <surface_area_sphere@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
call   1080 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebp,%edi
movapd 0x10(%rsp),%xmm0
mov    %ebx,%esi
call   1090 <compute_1F1_1d@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret
add    $0x1,%ebp
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  0xdcc(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm3
mov    %ebx,%edi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <compute_1F1_2d_canon@plt>

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

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