#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 airBesselI0(double);
double airBesselI1(double);
scalar_t__ sqrt(double);
double airBesselIn(int nn, double xx) {
  double tax, bb, bi, bim, bip;
  int ii, an, top;
  an = ((nn) > 0.0f ? (nn) : -(nn));
  if (0 == an) {
    return airBesselI0(xx);
  } else if (1 == an) {
    return airBesselI1(xx);
  }
  if (0.0 == xx) {
    return 0.0;
  }
  tax = 2.0 / ((xx) > 0.0f ? (xx) : -(xx));
  bip = bb = 0.0;
  bi = 1.0;
  top = 2 * (an + ((int)(sqrt(40.0 * an))));
  for (ii = top; ii > 0; ii--) {
    bim = bip + ii * tax * bi;
    bip = bi;
    bi = bim;
    if (((bi) > 0.0f ? (bi) : -(bi)) > 1.0e10) {
      bb *= 1.0e-10;
      bi *= 1.0e-10;
      bip *= 1.0e-10;
    }
    if (ii == an) {
      bb = bip;
    }
  }
  bb *= airBesselI0(xx) / bi;
  return (xx < 0.0 ? -bb : bb);
}


x86 assembly (clang, -O0):
<airBesselIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    115c <airBesselIn+0x2c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x50(%rbp)
jmp    1164 <airBesselIn+0x34>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x48(%rbp)
xor    %eax,%eax
cmp    -0x48(%rbp),%eax
jne    1189 <airBesselIn+0x59>
movsd  -0x18(%rbp),%xmm0
call   1030 <airBesselI0@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    13ce <airBesselIn+0x29e>
mov    $0x1,%eax
cmp    -0x48(%rbp),%eax
jne    11ab <airBesselIn+0x7b>
movsd  -0x18(%rbp),%xmm0
call   1050 <airBesselI1@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    13ce <airBesselIn+0x29e>
jmp    11b0 <airBesselIn+0x80>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    11d1 <airBesselIn+0xa1>
jp     11d1 <airBesselIn+0xa1>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13ce <airBesselIn+0x29e>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11f2 <airBesselIn+0xc2>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1213 <airBesselIn+0xe3>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  0xdf0(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdc7(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x5c(%rbp)
cvtsi2sdl -0x48(%rbp),%xmm1
movsd  0xda7(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
mov    %rax,%rcx
mov    -0x5c(%rbp),%eax
add    %ecx,%eax
shl    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jle    136d <airBesselIn+0x23d>
movsd  -0x40(%rbp),%xmm1
cvtsi2sdl -0x44(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12d6 <airBesselIn+0x1a6>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    12f7 <airBesselIn+0x1c7>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  0xd14(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1344 <airBesselIn+0x214>
movsd  0xd0a(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xcf8(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xce6(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jne    135a <airBesselIn+0x22a>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    135f <airBesselIn+0x22f>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    1276 <airBesselIn+0x146>
movsd  -0x18(%rbp),%xmm0
call   1030 <airBesselI0@plt>
divsd  -0x30(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    13ba <airBesselIn+0x28a>
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    13c4 <airBesselIn+0x294>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<airBesselIn>:
push   %rbx
sub    $0x30,%rsp
movapd %xmm0,%xmm1
mov    %edi,%ebx
neg    %ebx
cmovs  %edi,%ebx
jae    1155 <airBesselIn+0x25>
cmp    $0x1,%ebx
jne    1163 <airBesselIn+0x33>
movapd %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
jmp    1050 <airBesselI1@plt>
movapd %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
jmp    1030 <airBesselI0@plt>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1173 <airBesselIn+0x43>
jnp    12ee <airBesselIn+0x1be>
movapd %xmm1,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xe91(%rip),%xmm0
call   1040 <sqrt@plt>
mov    %ebx,%ecx
add    %eax,%ecx
jle    1292 <airBesselIn+0x162>
movapd 0xe62(%rip),%xmm3
movapd (%rsp),%xmm0
xorpd  %xmm0,%xmm3
xorpd  %xmm1,%xmm1
cmpltsd %xmm0,%xmm1
movapd %xmm1,%xmm2
andpd  %xmm0,%xmm2
andnpd %xmm3,%xmm1
orpd   %xmm2,%xmm1
movsd  0xe47(%rip),%xmm9
divsd  %xmm1,%xmm9
add    %ecx,%ecx
lea    (%rbx,%rax,2),%eax
movsd  0xe45(%rip),%xmm3
xorpd  %xmm4,%xmm4
movapd 0xe18(%rip),%xmm8
movsd  0xe38(%rip),%xmm2
movsd  0xe37(%rip),%xmm10
xorpd  %xmm6,%xmm6
jmp    1216 <airBesselIn+0xe6>
nop
lea    -0x1(%rcx),%edx
movapd %xmm1,%xmm4
movapd %xmm5,%xmm3
cmp    $0x1,%ecx
mov    %edx,%ecx
jle    12a3 <airBesselIn+0x173>
xorps  %xmm5,%xmm5
cvtsi2sd %ecx,%xmm5
mulsd  %xmm9,%xmm5
mulsd  %xmm3,%xmm5
addsd  %xmm6,%xmm5
movapd %xmm5,%xmm6
xorpd  %xmm8,%xmm6
xorpd  %xmm7,%xmm7
cmpltsd %xmm5,%xmm7
movapd %xmm7,%xmm1
andpd  %xmm5,%xmm1
andnpd %xmm6,%xmm7
orpd   %xmm1,%xmm7
ucomisd %xmm2,%xmm7
jbe    1257 <airBesselIn+0x127>
mulsd  %xmm10,%xmm5
jbe    125e <airBesselIn+0x12e>
mulsd  %xmm10,%xmm4
movapd %xmm3,%xmm1
mulsd  %xmm10,%xmm1
movapd %xmm2,%xmm6
cmpltsd %xmm7,%xmm6
andpd  %xmm6,%xmm1
andnpd %xmm3,%xmm6
orpd   %xmm1,%xmm6
movapd %xmm6,%xmm1
sub    $0x1,%eax
jb     1200 <airBesselIn+0xd0>
movapd %xmm4,%xmm1
jmp    1200 <airBesselIn+0xd0>
movsd  0xd86(%rip),%xmm5
xorpd  %xmm1,%xmm1
movapd (%rsp),%xmm0
movapd %xmm5,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1030 <airBesselI0@plt>
divsd  0x20(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
movapd 0xd38(%rip),%xmm1
xorpd  %xmm0,%xmm1
movapd (%rsp),%xmm3
cmpltsd 0xd5e(%rip),%xmm3
movapd %xmm3,%xmm2
andnpd %xmm0,%xmm2
andpd  %xmm1,%xmm3
orpd   %xmm2,%xmm3
movapd %xmm3,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @airBesselIn(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %4
store double %1, double* %5
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = fcmp ogt float %15, 0.000000e+00
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = load i32, i32* %4
br label %22
19: ; preds = %2
%20 = load i32, i32* %4
%21 = sub nsw i32 0, %20
br label %22
22: ; preds = %19, %17
%23 = phi i32 [ %18, %17 ], [ %21, %19 ]
store i32 %23, i32* %12
%24 = load i32, i32* %12
%25 = icmp eq i32 0, %24
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load double, double* %5
%28 = call double @airBesselI0(double %27)
store double %28, double* %3
br label %116
29: ; preds = %22
%30 = load i32, i32* %12
%31 = icmp eq i32 1, %30
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load double, double* %5
%34 = call double @airBesselI1(double %33)
store double %34, double* %3
br label %116
35: ; preds = %29
br label %36
36: ; preds = %35
%37 = load double, double* %5
%38 = fcmp oeq double 0.000000e+00, %37
br i1 %38, label %39, label %40
39: ; preds = %36
store double 0.000000e+00, double* %3
br label %116
40: ; preds = %36
%41 = load double, double* %5
%42 = fcmp ogt double %41, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = load double, double* %5
br label %48
45: ; preds = %40
%46 = load double, double* %5
%47 = fneg double %46
br label %48
48: ; preds = %45, %43
%49 = phi double [ %44, %43 ], [ %47, %45 ]
%50 = fdiv double 2.000000e+00, %49
store double %50, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %10
store double 1.000000e+00, double* %8
%51 = load i32, i32* %12
%52 = load i32, i32* %12
%53 = sitofp i32 %52 to double
%54 = fmul double 4.000000e+01, %53
%55 = call i64 @sqrt(double %54)
%56 = trunc i64 %55 to i32
%57 = add nsw i32 %51, %56
%58 = mul nsw i32 2, %57
store i32 %58, i32* %13
%59 = load i32, i32* %13
store i32 %59, i32* %11
br label %60
60: ; preds = %97, %48
%61 = load i32, i32* %11
%62 = icmp sgt i32 %61, 0
br i1 %62, label %63, label %100
63: ; preds = %60
%64 = load double, double* %10
%65 = load i32, i32* %11
%66 = sitofp i32 %65 to double
%67 = load double, double* %6
%68 = fmul double %66, %67
%69 = load double, double* %8
%70 = call double @llvm.fmuladd.f64(double %68, double %69, double %64)
store double %70, double* %9
%71 = load double, double* %8
store double %71, double* %10
%72 = load double, double* %9
store double %72, double* %8
%73 = load double, double* %8
%74 = fcmp ogt double %73, 0.000000e+00
br i1 %74, label %75, label %77
75: ; preds = %63
%76 = load double, double* %8
br label %80
77: ; preds = %63
%78 = load double, double* %8
%79 = fneg double %78
br label %80
80: ; preds = %77, %75
%81 = phi double [ %76, %75 ], [ %79, %77 ]
%82 = fcmp ogt double %81, 1.000000e+10
br i1 %82, label %83, label %90
83: ; preds = %80
%84 = load double, double* %7
%85 = fmul double %84, 1.000000e-10
store double %85, double* %7
%86 = load double, double* %8
%87 = fmul double %86, 1.000000e-10
store double %87, double* %8
%88 = load double, double* %10
%89 = fmul double %88, 1.000000e-10
store double %89, double* %10
br label %90
90: ; preds = %83, %80
%91 = load i32, i32* %11
%92 = load i32, i32* %12
%93 = icmp eq i32 %91, %92
br i1 %93, label %94, label %96
94: ; preds = %90
%95 = load double, double* %10
store double %95, double* %7
br label %96
96: ; preds = %94, %90
br label %97
97: ; preds = %96
%98 = load i32, i32* %11
%99 = add nsw i32 %98, -1
store i32 %99, i32* %11
br label %60
100: ; preds = %60
%101 = load double, double* %5
%102 = call double @airBesselI0(double %101)
%103 = load double, double* %8
%104 = fdiv double %102, %103
%105 = load double, double* %7
%106 = fmul double %105, %104
store double %106, double* %7
%107 = load double, double* %5
%108 = fcmp olt double %107, 0.000000e+00
br i1 %108, label %109, label %112
109: ; preds = %100
%110 = load double, double* %7
%111 = fneg double %110
br label %114
112: ; preds = %100
%113 = load double, double* %7
br label %114
114: ; preds = %112, %109
%115 = phi double [ %111, %109 ], [ %113, %112 ]
store double %115, double* %3
br label %116
116: ; preds = %114, %39, %32, %26
%117 = load double, double* %3
ret double %117
}

LLVM IR (-O2):
define double @airBesselIn(i32 %0, double %1) {
%3 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call double @airBesselI0(double %1)
br label %57
7: ; preds = %2
%8 = icmp eq i32 %3, 1
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call double @airBesselI1(double %1)
br label %57
11: ; preds = %7
%12 = fcmp oeq double %1, 0.000000e+00
br i1 %12, label %57, label %13
13: ; preds = %11
%14 = fcmp ogt double %1, 0.000000e+00
%15 = fneg double %1
%16 = select i1 %14, double %1, double %15
%17 = fdiv double 2.000000e+00, %16
%18 = sitofp i32 %3 to double
%19 = fmul double %18, 4.000000e+01
%20 = tail call i64 @sqrt(double %19)
%21 = trunc i64 %20 to i32
%22 = add nsw i32 %3, %21
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %48
24: ; preds = %13
%25 = shl nuw nsw i32 %22, 1
br label %26
26: ; preds = %24, %26
%27 = phi double [ %45, %26 ], [ 0.000000e+00, %24 ]
%28 = phi i32 [ %46, %26 ], [ %25, %24 ]
%29 = phi double [ %42, %26 ], [ 0.000000e+00, %24 ]
%30 = phi double [ %41, %26 ], [ 1.000000e+00, %24 ]
%31 = sitofp i32 %28 to double
%32 = fmul double %17, %31
%33 = tail call double @llvm.fmuladd.f64(double %32, double %30, double %29)
%34 = fcmp ogt double %33, 0.000000e+00
%35 = fneg double %33
%36 = select i1 %34, double %33, double %35
%37 = fcmp ogt double %36, 1.000000e+10
%38 = fmul double %27, 1.000000e-10
%39 = fmul double %33, 1.000000e-10
%40 = fmul double %30, 1.000000e-10
%41 = select i1 %37, double %39, double %33
%42 = select i1 %37, double %40, double %30
%43 = select i1 %37, double %38, double %27
%44 = icmp eq i32 %28, %3
%45 = select i1 %44, double %42, double %43
%46 = add nsw i32 %28, -1
%47 = icmp sgt i32 %28, 1
br i1 %47, label %26, label %48
48: ; preds = %26, %13
%49 = phi double [ 1.000000e+00, %13 ], [ %41, %26 ]
%50 = phi double [ 0.000000e+00, %13 ], [ %45, %26 ]
%51 = tail call double @airBesselI0(double %1)
%52 = fdiv double %51, %49
%53 = fmul double %50, %52
%54 = fcmp olt double %1, 0.000000e+00
%55 = fneg double %53
%56 = select i1 %54, double %55, double %53
br label %57
57: ; preds = %11, %48, %9, %5
%58 = phi double [ %6, %5 ], [ %10, %9 ], [ %56, %48 ], [ 0.000000e+00, %11 ]
ret double %58
}