#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) {
  double y, ans;
  float bessi1();
  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     127f <bessk1+0x13f>
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
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <bessi1@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
cvtss2sd %xmm1,%xmm2
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm3
movsd  0xe69(%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  0xe65(%rip),%xmm9
mulsd  %xmm9,%xmm8
movsd  0xe5f(%rip),%xmm9
addsd  %xmm9,%xmm8
mulsd  %xmm8,%xmm7
movsd  0xe3c(%rip),%xmm8
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm6
movsd  0xe23(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe0b(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xdf3(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xddb(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    135a <bessk1+0x21a>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd70(%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  0xd3f(%rip),%xmm7
mulsd  %xmm7,%xmm6
movsd  0xd3b(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xd1b(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd03(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xceb(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xcd3(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xcbb(%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    $0x28,%rsp
movaps %xmm0,%xmm2
cvtss2sd %xmm0,%xmm1
movss  0xead(%rip),%xmm0
ucomiss %xmm2,%xmm0
jae    11fa <bessk1+0xba>
movsd  0xee4(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movaps 0xf1b(%rip),%xmm0
xorps  %xmm2,%xmm0
movaps %xmm2,0x10(%rsp)
call   1040 <exp@plt>
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
call   1060 <sqrt@plt>
movsd  0xeb6(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  0xeac(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xea8(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xea4(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xea0(%rip),%xmm1
movsd  (%rsp),%xmm3
divsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm1
addsd  0xe93(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xe8f(%rip),%xmm1
mulsd  %xmm3,%xmm1
jmp    12ae <bessk1+0x16e>
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdfb(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mulss  0xde9(%rip),%xmm2
movaps %xmm2,%xmm0
movsd  %xmm1,(%rsp)
call   1050 <log@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1030 <bessi1@plt>
movsd  0xdd6(%rip),%xmm2
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm2
addsd  0xdcc(%rip),%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mulsd  %xmm3,%xmm2
addsd  0xdc1(%rip),%xmm2
movsd  0xda1(%rip),%xmm0
mulsd  %xmm3,%xmm2
addsd  0xdb5(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdb1(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xdad(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
divsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm2
mulsd  0x8(%rsp),%xmm1
addsd  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x28,%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 %40
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 = fpext float %19 to double
%21 = call float (double, ...) bitcast (float (...)* @bessi1 to float (double, ...)*)(double %20)
%22 = fpext float %21 to double
%23 = load float, float* %2
%24 = fpext float %23 to double
%25 = fdiv double 1.000000e+00, %24
%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 = load double, double* %3
%32 = call double @llvm.fmuladd.f64(double %31, double -4.686000e-05, double -1.104040e-03)
%33 = call double @llvm.fmuladd.f64(double %30, double %32, double 0xBF93A798E0B70F76)
%34 = call double @llvm.fmuladd.f64(double %29, double %33, double 0xBFC73DA6EA0F27E6)
%35 = call double @llvm.fmuladd.f64(double %28, double %34, double 0xBFE5877610A86ECA)
%36 = call double @llvm.fmuladd.f64(double %27, double %35, double 0x3FC3C468D0231889)
%37 = call double @llvm.fmuladd.f64(double %26, double %36, double 1.000000e+00)
%38 = fmul double %25, %37
%39 = call double @llvm.fmuladd.f64(double %18, double %22, double %38)
store double %39, double* %4
br label %63
40: ; preds = %1
%41 = load float, float* %2
%42 = fpext float %41 to double
%43 = fdiv double 2.000000e+00, %42
store double %43, double* %3
%44 = load float, float* %2
%45 = fneg float %44
%46 = call double @exp(float %45)
%47 = load float, float* %2
%48 = call double @sqrt(float %47)
%49 = fdiv double %46, %48
%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 = load double, double* %3
%56 = call double @llvm.fmuladd.f64(double %55, double -6.824500e-04, double 3.256140e-03)
%57 = call double @llvm.fmuladd.f64(double %54, double %56, double -7.803530e-03)
%58 = call double @llvm.fmuladd.f64(double %53, double %57, double 0x3F8ECEB255274ECE)
%59 = call double @llvm.fmuladd.f64(double %52, double %58, double -3.655620e-02)
%60 = call double @llvm.fmuladd.f64(double %51, double %59, double 0x3FCE14070887E3E5)
%61 = call double @llvm.fmuladd.f64(double %50, double %60, double 0x3FF40D9320AEA13E)
%62 = fmul double %49, %61
store double %62, double* %4
br label %63
63: ; preds = %40, %8
%64 = load double, double* %4
%65 = fptrunc double %64 to float
ret float %65
}

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 (double, ...) bitcast (float (...)* @bessi1 to float (double, ...)*)(double %2)
%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
}