#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 bessk0(float x) {
  float bessi0(float x);
  double y, ans;
  if (x <= 2.0) {
    y = x * x / 4.0;
    ans =
        (-log(x / 2.0) * bessi0(x)) +
        (-0.57721566 +
         y * (0.42278420 +
              y * (0.23069756 +
                   y * (0.3488590e-1 +
                        y * (0.262698e-2 + y * (0.10750e-3 + y * 0.74e-5))))));
  } else {
    y = 2.0 / x;
    ans = (exp(-x) / sqrt(x)) *
          (1.25331414 +
           y * (-0.7832358e-1 +
                y * (0.2189568e-1 +
                     y * (-0.1062446e-1 +
                          y * (0.587872e-2 +
                               y * (-0.251540e-2 + y * 0.53208e-3))))));
  }
  return ans;
}


x86 assembly (clang, -O0):
<bessk0>:
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     1273 <bessk0+0x133>
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>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <bessi0@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
cvtss2sd %xmm1,%xmm2
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm4
movsd  -0x10(%rbp),%xmm5
movsd  -0x10(%rbp),%xmm6
movsd  -0x10(%rbp),%xmm7
movsd  0xe6a(%rip),%xmm8
mulsd  %xmm8,%xmm7
movsd  0xe64(%rip),%xmm8
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm6
movsd  0xe43(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe2b(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe13(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xdfb(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
movsd  0xde3(%rip),%xmm3
addsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    134e <bessk0+0x20e>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd7c(%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  0xd4b(%rip),%xmm7
mulsd  %xmm7,%xmm6
movsd  0xd47(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xd27(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd0f(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xcf7(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xcdf(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xcc7(%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):
<bessk0>:
sub    $0x28,%rsp
movaps %xmm0,%xmm1
movss  0xeb1(%rip),%xmm0
ucomiss %xmm1,%xmm0
movaps %xmm1,0x10(%rsp)
jae    11fd <bessk0+0xbd>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  0xedc(%rip),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,(%rsp)
movaps 0xf14(%rip),%xmm0
xorps  %xmm1,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   1060 <sqrt@plt>
movsd  0xeb3(%rip),%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  0xeaa(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xea6(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xea2(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xe9e(%rip),%xmm1
movsd  0x8(%rsp),%xmm3
divsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm1
addsd  0xe90(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xe8c(%rip),%xmm1
mulsd  %xmm3,%xmm1
jmp    1299 <bessk0+0x159>
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdf8(%rip),%xmm0
movsd  %xmm0,(%rsp)
movss  0xde7(%rip),%xmm0
mulss  %xmm1,%xmm0
call   1050 <log@plt>
movsd  %xmm0,0x8(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <bessi0@plt>
movsd  0xdd2(%rip),%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  0xdc9(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdc5(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdc1(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm1
addsd  0xdb9(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdb5(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xdb1(%rip),%xmm1
mulsd  0x8(%rsp),%xmm0
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @bessk0(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 %36
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 = fneg double %18
%20 = load float, float* %2
%21 = call float @bessi0(float %20)
%22 = fpext float %21 to double
%23 = load double, double* %3
%24 = load double, double* %3
%25 = load double, double* %3
%26 = load double, double* %3
%27 = load double, double* %3
%28 = load double, double* %3
%29 = call double @llvm.fmuladd.f64(double %28, double 7.400000e-06, double 1.075000e-04)
%30 = call double @llvm.fmuladd.f64(double %27, double %29, double 2.626980e-03)
%31 = call double @llvm.fmuladd.f64(double %26, double %30, double 3.488590e-02)
%32 = call double @llvm.fmuladd.f64(double %25, double %31, double 0x3FCD877F65BBC695)
%33 = call double @llvm.fmuladd.f64(double %24, double %32, double 0x3FDB0EE57610FE55)
%34 = call double @llvm.fmuladd.f64(double %23, double %33, double 0xBFE2788CF9CE0CBE)
%35 = call double @llvm.fmuladd.f64(double %19, double %22, double %34)
store double %35, double* %4
br label %59
36: ; preds = %1
%37 = load float, float* %2
%38 = fpext float %37 to double
%39 = fdiv double 2.000000e+00, %38
store double %39, double* %3
%40 = load float, float* %2
%41 = fneg float %40
%42 = call double @exp(float %41)
%43 = load float, float* %2
%44 = call double @sqrt(float %43)
%45 = fdiv double %42, %44
%46 = load double, double* %3
%47 = load double, double* %3
%48 = load double, double* %3
%49 = load double, double* %3
%50 = load double, double* %3
%51 = load double, double* %3
%52 = call double @llvm.fmuladd.f64(double %51, double 5.320800e-04, double -2.515400e-03)
%53 = call double @llvm.fmuladd.f64(double %50, double %52, double 5.878720e-03)
%54 = call double @llvm.fmuladd.f64(double %49, double %53, double 0xBF85C246E1E6BA5F)
%55 = call double @llvm.fmuladd.f64(double %48, double %54, double 0x3F966BD236183FE8)
%56 = call double @llvm.fmuladd.f64(double %47, double %55, double 0xBFB40D039E9B0B34)
%57 = call double @llvm.fmuladd.f64(double %46, double %56, double 0x3FF40D9320AEA13E)
%58 = fmul double %45, %57
store double %58, double* %4
br label %59
59: ; preds = %36, %8
%60 = load double, double* %4
%61 = fptrunc double %60 to float
ret float %61
}

LLVM IR (-O2):
define float @bessk0(float %0) {
%2 = fcmp ugt float %0, 2.000000e+00
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = fmul float %0, %0
%5 = fpext float %4 to double
%6 = fmul double %5, 2.500000e-01
%7 = fmul float %0, 5.000000e-01
%8 = tail call double @log(float %7)
%9 = fneg double %8
%10 = tail call float @bessi0(float %0)
%11 = fpext float %10 to double
%12 = tail call double @llvm.fmuladd.f64(double %6, double 7.400000e-06, double 1.075000e-04)
%13 = tail call double @llvm.fmuladd.f64(double %6, double %12, double 2.626980e-03)
%14 = tail call double @llvm.fmuladd.f64(double %6, double %13, double 3.488590e-02)
%15 = tail call double @llvm.fmuladd.f64(double %6, double %14, double 0x3FCD877F65BBC695)
%16 = tail call double @llvm.fmuladd.f64(double %6, double %15, double 0x3FDB0EE57610FE55)
%17 = tail call double @llvm.fmuladd.f64(double %6, double %16, double 0xBFE2788CF9CE0CBE)
%18 = tail call double @llvm.fmuladd.f64(double %9, double %11, double %17)
br label %33
19: ; preds = %1
%20 = fpext float %0 to double
%21 = fdiv double 2.000000e+00, %20
%22 = fneg float %0
%23 = tail call double @exp(float %22)
%24 = tail call double @sqrt(float %0)
%25 = fdiv double %23, %24
%26 = tail call double @llvm.fmuladd.f64(double %21, double 5.320800e-04, double -2.515400e-03)
%27 = tail call double @llvm.fmuladd.f64(double %21, double %26, double 5.878720e-03)
%28 = tail call double @llvm.fmuladd.f64(double %21, double %27, double 0xBF85C246E1E6BA5F)
%29 = tail call double @llvm.fmuladd.f64(double %21, double %28, double 0x3F966BD236183FE8)
%30 = tail call double @llvm.fmuladd.f64(double %21, double %29, double 0xBFB40D039E9B0B34)
%31 = tail call double @llvm.fmuladd.f64(double %21, double %30, double 0x3FF40D9320AEA13E)
%32 = fmul double %31, %25
br label %33
33: ; preds = %19, %3
%34 = phi double [ %18, %3 ], [ %32, %19 ]
%35 = fptrunc double %34 to float
ret float %35
}