#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 compute_1F1_1d_canon(double, double, double, int);
double exp(double);
int fabs(double);
double surface_area_sphere(int);
double compute_1F1_1d(int dim, double z, int iter) {
  if (fabs(z) < 1e-8)
    return surface_area_sphere(dim);
  if (z < 0)
    return exp(z) * compute_1F1_1d(dim, -z, iter);
  return compute_1F1_1d_canon(.5, .5 * (dim + 1), z, iter);
}


x86 assembly (clang, -O0):
<compute_1F1_1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe87(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1195 <compute_1F1_1d+0x45>
mov    -0xc(%rbp),%edi
call   1050 <surface_area_sphere@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    121f <compute_1F1_1d+0xcf>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11ef <compute_1F1_1d+0x9f>
movsd  -0x18(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x1c(%rbp),%esi
call   1070 <compute_1F1_1d@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121f <compute_1F1_1d+0xcf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe07(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm2
mov    -0x1c(%rbp),%edi
movsd  0xdf3(%rip),%xmm0
call   1060 <compute_1F1_1d_canon@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_1F1_1d>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
movapd %xmm0,0x10(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    11ac <compute_1F1_1d+0x5c>
xorpd  %xmm0,%xmm0
movapd 0x10(%rsp),%xmm2
ucomisd %xmm2,%xmm0
jbe    11b9 <compute_1F1_1d+0x69>
movapd %xmm2,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xe7a(%rip),%xmm0
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <compute_1F1_1d@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebp,%edi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <surface_area_sphere@plt>
add    $0x1,%ebp
cvtsi2sd %ebp,%xmm1
movsd  0xe38(%rip),%xmm0
mulsd  %xmm0,%xmm1
mov    %ebx,%edi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <compute_1F1_1d_canon@plt>

LLVM IR (-O0):
define double @compute_1F1_1d(i32 %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
store i32 %0, i32* %5
store double %1, double* %6
store i32 %2, i32* %7
%8 = load double, double* %6
%9 = call i32 @fabs(double %8)
%10 = sitofp i32 %9 to double
%11 = fcmp olt double %10, 1.000000e-08
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32, i32* %5
%14 = call double @surface_area_sphere(i32 %13)
store double %14, double* %4
br label %35
15: ; preds = %3
%16 = load double, double* %6
%17 = fcmp olt double %16, 0.000000e+00
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load double, double* %6
%20 = call double @exp(double %19)
%21 = load i32, i32* %5
%22 = load double, double* %6
%23 = fneg double %22
%24 = load i32, i32* %7
%25 = call double @compute_1F1_1d(i32 %21, double %23, i32 %24)
%26 = fmul double %20, %25
store double %26, double* %4
br label %35
27: ; preds = %15
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
%30 = sitofp i32 %29 to double
%31 = fmul double 5.000000e-01, %30
%32 = load double, double* %6
%33 = load i32, i32* %7
%34 = call double @compute_1F1_1d_canon(double 5.000000e-01, double %31, double %32, i32 %33)
store double %34, double* %4
br label %35
35: ; preds = %27, %18, %12
%36 = load double, double* %4
ret double %36
}

LLVM IR (-O2):
define double @compute_1F1_1d(i32 %0, double %1, i32 %2) {
%4 = tail call i32 @fabs(double %1)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call double @surface_area_sphere(i32 %0)
br label %10
8: ; preds = %3
%9 = fcmp olt double %1, 0.000000e+00
br i1 %9, label %12, label %17
10: ; preds = %6, %17, %12
%11 = phi double [ %16, %12 ], [ %7, %6 ], [ %21, %17 ]
ret double %11
12: ; preds = %8
%13 = tail call double @exp(double %1)
%14 = fneg double %1
%15 = tail call double @compute_1F1_1d(i32 %0, double %14, i32 %2)
%16 = fmul double %13, %15
br label %10
17: ; preds = %8
%18 = add nsw i32 %0, 1
%19 = sitofp i32 %18 to double
%20 = fmul double %19, 5.000000e-01
%21 = tail call double @compute_1F1_1d_canon(double 5.000000e-01, double %20, double %1, i32 %2)
br label %10
}