// File: /workspace/github_cpp_makefile_star2_O3/mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::besselk1(double, alglib_impl::ae_state*)
double besselk1(double x, ae_state *_state)
{
    double y;
    double z;
    double v;
    double b0;
    double b1;
    double b2;
    double result;


    z = 0.5*x;
    ae_assert(ae_fp_greater(z,0), "Domain error in K1", _state);
    if( ae_fp_less_eq(x,2) )
    {
        y = x*x-2.0;
        bessel_besselm1firstcheb(-7.02386347938628759343E-18, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -2.42744985051936593393E-15, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -6.66690169419932900609E-13, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -1.41148839263352776110E-10, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -2.21338763073472585583E-8, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -2.43340614156596823496E-6, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -1.73028895751305206302E-4, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -6.97572385963986435018E-3, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -1.22611180822657148235E-1, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -3.53155960776544875667E-1, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 1.52530022733894777053E0, &b0, &b1, &b2, _state);
        v = 0.5*(b0-b2);
        result = ae_log(z, _state)*besseli1(x, _state)+v/x;
    }
    else
    {
        y = 8.0/x-2.0;
        bessel_besselm1firstcheb(-5.75674448366501715755E-18, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 1.79405087314755922667E-17, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -5.68946255844285935196E-17, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 1.83809354436663880070E-16, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -6.05704724837331885336E-16, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 2.03870316562433424052E-15, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -7.01983709041831346144E-15, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 2.47715442448130437068E-14, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -8.97670518232499435011E-14, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 3.34841966607842919884E-13, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -1.28917396095102890680E-12, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 5.13963967348173025100E-12, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -2.12996783842756842877E-11, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 9.21831518760500529508E-11, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -4.19035475934189648750E-10, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 2.01504975519703286596E-9, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -1.03457624656780970260E-8, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 5.74108412545004946722E-8, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -3.50196060308781257119E-7, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 2.40648494783721712015E-6, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -1.93619797416608296024E-5, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 1.95215518471351631108E-4, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, -2.85781685962277938680E-3, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 1.03923736576817238437E-1, &b0, &b1, &b2, _state);
        bessel_besselm1nextcheb(y, 2.72062619048444266945E0, &b0, &b1, &b2, _state);
        v = 0.5*(b0-b2);
        result = ae_exp(-x, _state)*v/ae_sqrt(x, _state);
    }
    return result;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movapd %xmm0, %xmm1
movapd %xmm0, 0x10(%rsp)
movsd 0x29f47(%rip), %xmm0    # 0x33488
mulsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
movsd %xmm0, 0x8(%rsp)
callq 0x25bf9
movzbl %al, %edi
leaq 0x2c1d3(%rip), %rsi     # 0x35731
movq %rbx, %rdx
callq 0x2510e
movsd 0x29e92(%rip), %xmm1    # 0x33400
movaps 0x10(%rsp), %xmm0
callq 0x25bd9
testb %al, %al
je 0x96ad
movapd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd 0x29e7e(%rip), %xmm0    # 0x33410
movsd 0x2ac5e(%rip), %xmm1    # 0x341f8
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd 0x2ac56(%rip), %xmm3    # 0x34200
subsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd 0x2ac46(%rip), %xmm2    # 0x34208
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2ac3a(%rip), %xmm1    # 0x34210
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2ac2e(%rip), %xmm3    # 0x34218
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2ac22(%rip), %xmm2    # 0x34220
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2ac16(%rip), %xmm1    # 0x34228
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2ac0a(%rip), %xmm3    # 0x34230
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2abfe(%rip), %xmm2    # 0x34238
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2abf2(%rip), %xmm1    # 0x34240
mulsd %xmm0, %xmm1
subsd %xmm2, %xmm1
addsd 0x2abea(%rip), %xmm1    # 0x34248
subsd %xmm2, %xmm1
mulsd 0x29e1e(%rip), %xmm1    # 0x33488
movapd %xmm1, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x25f91
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x8b06
movapd 0x20(%rsp), %xmm1
divsd 0x10(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
jmp 0x98fd
movsd 0x29fc3(%rip), %xmm0    # 0x33678
movapd 0x10(%rsp), %xmm1
divsd %xmm1, %xmm0
movapd %xmm1, %xmm4
addsd 0x29d45(%rip), %xmm0    # 0x33410
movsd 0x2aa5d(%rip), %xmm1    # 0x34130
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd 0x2aa55(%rip), %xmm3    # 0x34138
subsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd 0x2aa45(%rip), %xmm2    # 0x34140
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2aa39(%rip), %xmm1    # 0x34148
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2aa2d(%rip), %xmm3    # 0x34150
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2aa21(%rip), %xmm2    # 0x34158
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2aa15(%rip), %xmm1    # 0x34160
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2aa09(%rip), %xmm3    # 0x34168
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2a9fd(%rip), %xmm2    # 0x34170
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2a9f1(%rip), %xmm1    # 0x34178
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2a9e5(%rip), %xmm3    # 0x34180
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2a9d9(%rip), %xmm2    # 0x34188
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2a9cd(%rip), %xmm1    # 0x34190
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2a9c1(%rip), %xmm3    # 0x34198
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2a9b5(%rip), %xmm2    # 0x341a0
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2a9a9(%rip), %xmm1    # 0x341a8
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2a99d(%rip), %xmm3    # 0x341b0
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2a991(%rip), %xmm2    # 0x341b8
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2a985(%rip), %xmm1    # 0x341c0
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2a979(%rip), %xmm3    # 0x341c8
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2a96d(%rip), %xmm2    # 0x341d0
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2a961(%rip), %xmm1    # 0x341d8
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2a955(%rip), %xmm3    # 0x341e0
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2a949(%rip), %xmm2    # 0x341e8
mulsd %xmm0, %xmm2
subsd %xmm3, %xmm2
addsd 0x2a941(%rip), %xmm2    # 0x341f0
subsd %xmm3, %xmm2
mulsd 0x29bcd(%rip), %xmm2    # 0x33488
movsd %xmm2, 0x8(%rsp)
movapd 0x298e7(%rip), %xmm0    # 0x331b0
xorpd %xmm4, %xmm0
movq %rbx, %rdi
callq 0x25f9b
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x25e48
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x30, %rsp
popq %rbx
retq