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


x86 assembly (clang, -O0):
<bessk1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeab(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1261 <bessk1+0x121>
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe9e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe78(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <bessi1@plt>
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
movsd  0xe58(%rip),%xmm1
divsd  -0x8(%rbp),%xmm1
movsd  0x2e93(%rip),%xmm4
movsd  -0x10(%rbp),%xmm3
movsd  0x2e8e(%rip),%xmm6
movsd  -0x10(%rbp),%xmm5
movsd  0x2e88(%rip),%xmm8
movsd  -0x10(%rbp),%xmm7
movsd  0x2e82(%rip),%xmm10
movsd  -0x10(%rbp),%xmm9
movsd  0x2e7b(%rip),%xmm12
movsd  -0x10(%rbp),%xmm11
movsd  0x2e74(%rip),%xmm14
movsd  -0x10(%rbp),%xmm13
movsd  0x2e6d(%rip),%xmm15
mulsd  %xmm15,%xmm13
addsd  %xmm14,%xmm13
mulsd  %xmm13,%xmm11
addsd  %xmm12,%xmm11
mulsd  %xmm11,%xmm9
addsd  %xmm10,%xmm9
mulsd  %xmm9,%xmm7
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm5
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    134a <bessk1+0x20a>
movsd  0xd97(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0x2dd9(%rip),%xmm2
movsd  -0x10(%rbp),%xmm1
movsd  0x2dd4(%rip),%xmm4
movsd  -0x10(%rbp),%xmm3
movsd  0x2dcf(%rip),%xmm6
movsd  -0x10(%rbp),%xmm5
movsd  0x2dc9(%rip),%xmm8
movsd  -0x10(%rbp),%xmm7
movsd  0x2dc3(%rip),%xmm10
movsd  -0x10(%rbp),%xmm9
movsd  0x2dbc(%rip),%xmm12
movsd  -0x10(%rbp),%xmm11
movsd  0x2db5(%rip),%xmm13
mulsd  %xmm13,%xmm11
addsd  %xmm12,%xmm11
mulsd  %xmm11,%xmm9
addsd  %xmm10,%xmm9
mulsd  %xmm9,%xmm7
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm5
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bessk1>:
sub    $0x38,%rsp
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm0,(%rsp)
jae    1198 <bessk1+0x58>
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movapd 0xf27(%rip),%xmm0
xorpd  (%rsp),%xmm0
call   1040 <exp@plt>
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
movapd (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd (%rsp),%xmm0
jb     1245 <bessk1+0x105>
sqrtsd %xmm0,%xmm0
jmp    1254 <bessk1+0x114>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xe60(%rip),%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm0,%xmm1
movsd  0xe56(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <log@plt>
movsd  %xmm0,0x18(%rsp)
movapd (%rsp),%xmm0
call   1030 <bessi1@plt>
movsd  0xe45(%rip),%xmm1
movapd 0x20(%rsp),%xmm3
mulsd  %xmm3,%xmm1
addsd  0xe3b(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xe37(%rip),%xmm1
movsd  0xe17(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  0xe2b(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xe27(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  0xe23(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  0x18(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x38,%rsp
ret
movsd  %xmm3,(%rsp)
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm3
movsd  0xdf4(%rip),%xmm1
movsd  0x18(%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  0xdea(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xde6(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xde2(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdde(%rip),%xmm1
divsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm1
addsd  0xdd6(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdd2(%rip),%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

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

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