#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);
double log(float);
double sqrt(float);
float bessk1(float x) {
  float bessi1(float x);
  double y, ans;
  if (x <= 2.0) {
    y = x * x / 4.0;
    ans = (log(x / 2.0) * bessi1(x)) +
          (1.0 / x) *
              (1.0 +
               y * (0.15443144 +
                    y * (-0.67278579 +
                         y * (-0.18156897 +
                              y * (-0.1919402e-1 +
                                   y * (-0.110404e-2 + y * (-0.4686e-4)))))));
  } else {
    y = 2.0 / x;
    ans = (exp(-x) / sqrt(x)) *
          (1.25331414 +
           y * (0.23498619 +
                y * (-0.3655620e-1 +
                     y * (0.1504268e-1 +
                          y * (-0.780353e-2 +
                               y * (0.325614e-2 + y * (-0.68245e-3)))))));
  }
  return ans;
}


x86 assembly (clang, -O0):
<bessk1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea2(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1279 <bessk1+0x139>
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xefa(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe68(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <bessi1@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
cvtss2sd %xmm1,%xmm2
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm3
movsd  0xe6f(%rip),%xmm1
divsd  %xmm3,%xmm1
movsd  -0x10(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm4
movsd  -0x10(%rbp),%xmm5
movsd  -0x10(%rbp),%xmm6
movsd  -0x10(%rbp),%xmm7
movsd  -0x10(%rbp),%xmm8
movsd  0xe6b(%rip),%xmm9
mulsd  %xmm9,%xmm8
movsd  0xe65(%rip),%xmm9
addsd  %xmm9,%xmm8
mulsd  %xmm8,%xmm7
movsd  0xe42(%rip),%xmm8
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm6
movsd  0xe29(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe11(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xdf9(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xde1(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1354 <bessk1+0x214>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd76(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm4
movsd  -0x10(%rbp),%xmm5
movsd  -0x10(%rbp),%xmm6
movsd  0xd45(%rip),%xmm7
mulsd  %xmm7,%xmm6
movsd  0xd41(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xd21(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd09(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xcf1(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xcd9(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xcc1(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bessk1>:
sub    $0x38,%rsp
movaps %xmm0,%xmm2
cvtss2sd %xmm0,%xmm1
movss  0xead(%rip),%xmm0
ucomiss %xmm2,%xmm0
movaps %xmm2,0x20(%rsp)
jae    11fc <bessk1+0xbc>
movsd  0xedf(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movaps 0xf16(%rip),%xmm0
xorps  %xmm2,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
call   1060 <sqrt@plt>
movsd  0xeb5(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  0xeab(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xea7(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xea3(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xe9f(%rip),%xmm1
movsd  0x10(%rsp),%xmm3
divsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm1
addsd  0xe91(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xe8d(%rip),%xmm1
mulsd  %xmm3,%xmm1
jmp    12b1 <bessk1+0x171>
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdf9(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0xde7(%rip),%xmm0
mulss  %xmm2,%xmm0
movsd  %xmm1,0x8(%rsp)
call   1050 <log@plt>
movsd  %xmm0,0x10(%rsp)
movaps 0x20(%rsp),%xmm0
call   1030 <bessi1@plt>
movsd  0xdd4(%rip),%xmm2
movsd  0x18(%rsp),%xmm3
mulsd  %xmm3,%xmm2
addsd  0xdca(%rip),%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mulsd  %xmm3,%xmm2
addsd  0xdbf(%rip),%xmm2
movsd  0xd9f(%rip),%xmm0
mulsd  %xmm3,%xmm2
addsd  0xdb3(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdaf(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdab(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
divsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm2
mulsd  0x10(%rsp),%xmm1
addsd  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define float @bessk1(float %0) {
%2 = alloca float
%3 = alloca double
%4 = alloca double
store float %0, float* %2
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fcmp ole double %6, 2.000000e+00
br i1 %7, label %8, label %39
8: ; preds = %1
%9 = load float, float* %2
%10 = load float, float* %2
%11 = fmul float %9, %10
%12 = fpext float %11 to double
%13 = fdiv double %12, 4.000000e+00
store double %13, double* %3
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = fdiv double %15, 2.000000e+00
%17 = fptrunc double %16 to float
%18 = call double @log(float %17)
%19 = load float, float* %2
%20 = call float @bessi1(float %19)
%21 = fpext float %20 to double
%22 = load float, float* %2
%23 = fpext float %22 to double
%24 = fdiv double 1.000000e+00, %23
%25 = load double, double* %3
%26 = load double, double* %3
%27 = load double, double* %3
%28 = load double, double* %3
%29 = load double, double* %3
%30 = load double, double* %3
%31 = call double @llvm.fmuladd.f64(double %30, double -4.686000e-05, double -1.104040e-03)
%32 = call double @llvm.fmuladd.f64(double %29, double %31, double 0xBF93A798E0B70F76)
%33 = call double @llvm.fmuladd.f64(double %28, double %32, double 0xBFC73DA6EA0F27E6)
%34 = call double @llvm.fmuladd.f64(double %27, double %33, double 0xBFE5877610A86ECA)
%35 = call double @llvm.fmuladd.f64(double %26, double %34, double 0x3FC3C468D0231889)
%36 = call double @llvm.fmuladd.f64(double %25, double %35, double 1.000000e+00)
%37 = fmul double %24, %36
%38 = call double @llvm.fmuladd.f64(double %18, double %21, double %37)
store double %38, double* %4
br label %62
39: ; preds = %1
%40 = load float, float* %2
%41 = fpext float %40 to double
%42 = fdiv double 2.000000e+00, %41
store double %42, double* %3
%43 = load float, float* %2
%44 = fneg float %43
%45 = call double @exp(float %44)
%46 = load float, float* %2
%47 = call double @sqrt(float %46)
%48 = fdiv double %45, %47
%49 = load double, double* %3
%50 = load double, double* %3
%51 = load double, double* %3
%52 = load double, double* %3
%53 = load double, double* %3
%54 = load double, double* %3
%55 = call double @llvm.fmuladd.f64(double %54, double -6.824500e-04, double 3.256140e-03)
%56 = call double @llvm.fmuladd.f64(double %53, double %55, double -7.803530e-03)
%57 = call double @llvm.fmuladd.f64(double %52, double %56, double 0x3F8ECEB255274ECE)
%58 = call double @llvm.fmuladd.f64(double %51, double %57, double -3.655620e-02)
%59 = call double @llvm.fmuladd.f64(double %50, double %58, double 0x3FCE14070887E3E5)
%60 = call double @llvm.fmuladd.f64(double %49, double %59, double 0x3FF40D9320AEA13E)
%61 = fmul double %48, %60
store double %61, double* %4
br label %62
62: ; preds = %39, %8
%63 = load double, double* %4
%64 = fptrunc double %63 to float
ret float %64
}

LLVM IR (-O2):
define float @bessk1(float %0) {
%2 = fpext float %0 to double
%3 = fcmp ugt float %0, 2.000000e+00
br i1 %3, label %21, label %4
4: ; preds = %1
%5 = fmul float %0, %0
%6 = fpext float %5 to double
%7 = fmul double %6, 2.500000e-01
%8 = fmul float %0, 5.000000e-01
%9 = tail call double @log(float %8)
%10 = tail call float @bessi1(float %0)
%11 = fpext float %10 to double
%12 = fdiv double 1.000000e+00, %2
%13 = tail call double @llvm.fmuladd.f64(double %7, double -4.686000e-05, double -1.104040e-03)
%14 = tail call double @llvm.fmuladd.f64(double %7, double %13, double 0xBF93A798E0B70F76)
%15 = tail call double @llvm.fmuladd.f64(double %7, double %14, double 0xBFC73DA6EA0F27E6)
%16 = tail call double @llvm.fmuladd.f64(double %7, double %15, double 0xBFE5877610A86ECA)
%17 = tail call double @llvm.fmuladd.f64(double %7, double %16, double 0x3FC3C468D0231889)
%18 = tail call double @llvm.fmuladd.f64(double %7, double %17, double 1.000000e+00)
%19 = fmul double %12, %18
%20 = tail call double @llvm.fmuladd.f64(double %9, double %11, double %19)
br label %34
21: ; preds = %1
%22 = fdiv double 2.000000e+00, %2
%23 = fneg float %0
%24 = tail call double @exp(float %23)
%25 = tail call double @sqrt(float %0)
%26 = fdiv double %24, %25
%27 = tail call double @llvm.fmuladd.f64(double %22, double -6.824500e-04, double 3.256140e-03)
%28 = tail call double @llvm.fmuladd.f64(double %22, double %27, double -7.803530e-03)
%29 = tail call double @llvm.fmuladd.f64(double %22, double %28, double 0x3F8ECEB255274ECE)
%30 = tail call double @llvm.fmuladd.f64(double %22, double %29, double -3.655620e-02)
%31 = tail call double @llvm.fmuladd.f64(double %22, double %30, double 0x3FCE14070887E3E5)
%32 = tail call double @llvm.fmuladd.f64(double %22, double %31, double 0x3FF40D9320AEA13E)
%33 = fmul double %32, %26
br label %34
34: ; preds = %21, %4
%35 = phi double [ %20, %4 ], [ %33, %21 ]
%36 = fptrunc double %35 to float
ret float %36
}