#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 exp(float);
float fabs(float);
int /*<<< orphan*/ printf(char *);
double sqrt(float);
float besseli(int n, float x) {
  float ax;
  float ans = 0;
  double y;
  switch (n) {
  case 0:
    if (x == 0)
      ans = 1;
    else if ((ax = fabs(x)) < 3.75) {
      y = x / 3.75;
      y *= y;
      ans =
          1.0 +
          y * (3.5156229 +
               y * (3.0899424 +
                    y * (1.2067492 + y * (0.2659732 + y * (0.360768e-1 +
                                                           y * 0.45813e-2)))));
    } else {
      y = 3.75 / ax;
      ans = (exp(ax) / sqrt(ax)) *
            (0.39894228 +
             y * (0.1328592e-1 +
                  y * (0.225319e-2 +
                       y * (-0.157565e-2 +
                            y * (0.916281e-2 +
                                 y * (-0.2057706e-1 +
                                      y * (0.2635537e-1 +
                                           y * (-0.1647633e-1 +
                                                y * 0.392377e-2))))))));
    }
    break;
  default:
    printf("Invalid bessel order entered\n");
  }
  return ans;
}


x86 assembly (clang, -O0):
<besseli>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
test   %eax,%eax
jne    1380 <besseli+0x240>
jmp    1167 <besseli+0x27>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1190 <besseli+0x50>
jp     1190 <besseli+0x50>
movss  0xf02(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    137b <besseli+0x23b>
movss  -0x8(%rbp),%xmm0
call   1040 <fabs@plt>
movss  %xmm0,-0xc(%rbp)
cvtss2sd %xmm0,%xmm1
movsd  0xe55(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1272 <besseli+0x132>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
movsd  0xe74(%rip),%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe70(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe50(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe38(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe20(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe08(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1376 <besseli+0x236>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd7d(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
movsd  -0x18(%rbp),%xmm6
movsd  -0x18(%rbp),%xmm7
movsd  -0x18(%rbp),%xmm8
movsd  0xd5d(%rip),%xmm9
mulsd  %xmm9,%xmm8
movsd  0xd57(%rip),%xmm9
addsd  %xmm9,%xmm8
mulsd  %xmm8,%xmm7
movsd  0xd34(%rip),%xmm8
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm6
movsd  0xd1b(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xd03(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xceb(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xcd3(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xcbb(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xca3(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    137b <besseli+0x23b>
jmp    138c <besseli+0x24c>
lea    0xd05(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<besseli>:
sub    $0x28,%rsp
test   %edi,%edi
je     114c <besseli+0x1c>
lea    0xf69(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
add    $0x28,%rsp
ret
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1163 <besseli+0x33>
jp     1163 <besseli+0x33>
movss  0xea2(%rip),%xmm0
add    $0x28,%rsp
ret
movaps 0xea6(%rip),%xmm2
andps  %xmm0,%xmm2
movss  0xe8f(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    11df <besseli+0xaf>
cvtss2sd %xmm0,%xmm0
divsd  0xe9a(%rip),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xede(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeda(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xed6(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xed2(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xece(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeca(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xec6(%rip),%xmm1
jmp    1290 <besseli+0x160>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movsd  0xe32(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movaps %xmm2,%xmm0
movaps %xmm2,0x10(%rsp)
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   1050 <sqrt@plt>
movsd  0xe0b(%rip),%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  0xe02(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdfe(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdfa(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdf6(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdf2(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdee(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdea(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xde6(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Invalid bessel order entered\0A\00"
define float @besseli(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca double
store i32 %0, i32* %3
store float %1, float* %4
store float 0.000000e+00, float* %6
%8 = load i32, i32* %3
switch i32 %8, label %67 [
i32 0, label %9
]
9: ; preds = %2
%10 = load float, float* %4
%11 = fcmp oeq float %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %9
store float 1.000000e+00, float* %6
br label %66
13: ; preds = %9
%14 = load float, float* %4
%15 = call float @fabs(float %14)
store float %15, float* %5
%16 = fpext float %15 to double
%17 = fcmp olt double %16, 3.750000e+00
br i1 %17, label %18, label %38
18: ; preds = %13
%19 = load float, float* %4
%20 = fpext float %19 to double
%21 = fdiv double %20, 3.750000e+00
store double %21, double* %7
%22 = load double, double* %7
%23 = load double, double* %7
%24 = fmul double %23, %22
store double %24, double* %7
%25 = load double, double* %7
%26 = load double, double* %7
%27 = load double, double* %7
%28 = load double, double* %7
%29 = load double, double* %7
%30 = load double, double* %7
%31 = call double @llvm.fmuladd.f64(double %30, double 4.581300e-03, double 3.607680e-02)
%32 = call double @llvm.fmuladd.f64(double %29, double %31, double 0x3FD105B474E732AA)
%33 = call double @llvm.fmuladd.f64(double %28, double %32, double 0x3FF34ED83FC7962C)
%34 = call double @llvm.fmuladd.f64(double %27, double %33, double 0x4008B833B89430A4)
%35 = call double @llvm.fmuladd.f64(double %26, double %34, double 0x400C1FFEE6248CA7)
%36 = call double @llvm.fmuladd.f64(double %25, double %35, double 1.000000e+00)
%37 = fptrunc double %36 to float
store float %37, float* %6
br label %65
38: ; preds = %13
%39 = load float, float* %5
%40 = fpext float %39 to double
%41 = fdiv double 3.750000e+00, %40
store double %41, double* %7
%42 = load float, float* %5
%43 = call double @exp(float %42)
%44 = load float, float* %5
%45 = call double @sqrt(float %44)
%46 = fdiv double %43, %45
%47 = load double, double* %7
%48 = load double, double* %7
%49 = load double, double* %7
%50 = load double, double* %7
%51 = load double, double* %7
%52 = load double, double* %7
%53 = load double, double* %7
%54 = load double, double* %7
%55 = call double @llvm.fmuladd.f64(double %54, double 3.923770e-03, double 0xBF90DF2BCA084C55)
%56 = call double @llvm.fmuladd.f64(double %53, double %55, double 0x3F9AFCE6F0E55AE3)
%57 = call double @llvm.fmuladd.f64(double %52, double %56, double 0xBF9512271EFDC716)
%58 = call double @llvm.fmuladd.f64(double %51, double %57, double 9.162810e-03)
%59 = call double @llvm.fmuladd.f64(double %50, double %58, double -1.575650e-03)
%60 = call double @llvm.fmuladd.f64(double %49, double %59, double 2.253190e-03)
%61 = call double @llvm.fmuladd.f64(double %48, double %60, double 0x3F8B35A5FF2D9D1C)
%62 = call double @llvm.fmuladd.f64(double %47, double %61, double 0x3FD988453365DE00)
%63 = fmul double %46, %62
%64 = fptrunc double %63 to float
store float %64, float* %6
br label %65
65: ; preds = %38, %18
br label %66
66: ; preds = %65, %12
br label %69
67: ; preds = %2
%68 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %69
69: ; preds = %67, %66
%70 = load float, float* %6
ret float %70
}

LLVM IR (-O2):
@str = [29 x i8] c"Invalid bessel order entered\00"
define float @besseli(i32 %0, float %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %36
4: ; preds = %2
%5 = fcmp oeq float %1, 0.000000e+00
br i1 %5, label %38, label %6
6: ; preds = %4
%7 = tail call float @llvm.fabs.f32(float %1)
%8 = fcmp olt float %7, 3.750000e+00
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = fpext float %1 to double
%11 = fdiv double %10, 3.750000e+00
%12 = fmul double %11, %11
%13 = tail call double @llvm.fmuladd.f64(double %12, double 4.581300e-03, double 3.607680e-02)
%14 = tail call double @llvm.fmuladd.f64(double %12, double %13, double 0x3FD105B474E732AA)
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double 0x3FF34ED83FC7962C)
%16 = tail call double @llvm.fmuladd.f64(double %12, double %15, double 0x4008B833B89430A4)
%17 = tail call double @llvm.fmuladd.f64(double %12, double %16, double 0x400C1FFEE6248CA7)
%18 = tail call double @llvm.fmuladd.f64(double %12, double %17, double 1.000000e+00)
%19 = fptrunc double %18 to float
br label %38
20: ; preds = %6
%21 = fpext float %7 to double
%22 = fdiv double 3.750000e+00, %21
%23 = tail call double @exp(float %7)
%24 = tail call double @sqrt(float %7)
%25 = fdiv double %23, %24
%26 = tail call double @llvm.fmuladd.f64(double %22, double 3.923770e-03, double 0xBF90DF2BCA084C55)
%27 = tail call double @llvm.fmuladd.f64(double %22, double %26, double 0x3F9AFCE6F0E55AE3)
%28 = tail call double @llvm.fmuladd.f64(double %22, double %27, double 0xBF9512271EFDC716)
%29 = tail call double @llvm.fmuladd.f64(double %22, double %28, double 9.162810e-03)
%30 = tail call double @llvm.fmuladd.f64(double %22, double %29, double -1.575650e-03)
%31 = tail call double @llvm.fmuladd.f64(double %22, double %30, double 2.253190e-03)
%32 = tail call double @llvm.fmuladd.f64(double %22, double %31, double 0x3F8B35A5FF2D9D1C)
%33 = tail call double @llvm.fmuladd.f64(double %22, double %32, double 0x3FD988453365DE00)
%34 = fmul double %33, %25
%35 = fptrunc double %34 to float
br label %38
36: ; preds = %2
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %38
38: ; preds = %4, %20, %9, %36
%39 = phi float [ %19, %9 ], [ %35, %20 ], [ 0.000000e+00, %36 ], [ 1.000000e+00, %4 ]
ret float %39
}