// File: /workspace/github_cpp_makefile_star2_O2/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 0x27685(%rip), %xmm0    # 0x30488
mulsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
movsd %xmm0, 0x8(%rsp)
callq 0x24279
movzbl %al, %edi
leaq 0x29901(%rip), %rsi     # 0x32721
movq %rbx, %rdx
callq 0x238ca
movsd 0x275c8(%rip), %xmm1    # 0x303f8
movaps 0x10(%rsp), %xmm0
callq 0x24259
testb %al, %al
je 0x8f6f
movapd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd 0x275ac(%rip), %xmm0    # 0x30400
movsd 0x2839c(%rip), %xmm1    # 0x311f8
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd 0x28394(%rip), %xmm3    # 0x31200
subsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd 0x28384(%rip), %xmm2    # 0x31208
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x28378(%rip), %xmm1    # 0x31210
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2836c(%rip), %xmm3    # 0x31218
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x28360(%rip), %xmm2    # 0x31220
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x28354(%rip), %xmm1    # 0x31228
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x28348(%rip), %xmm3    # 0x31230
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2833c(%rip), %xmm2    # 0x31238
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x28330(%rip), %xmm1    # 0x31240
mulsd %xmm0, %xmm1
subsd %xmm2, %xmm1
addsd 0x28328(%rip), %xmm1    # 0x31248
subsd %xmm2, %xmm1
mulsd 0x2755c(%rip), %xmm1    # 0x30488
movapd %xmm1, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x2455f
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x83cc
movapd 0x20(%rsp), %xmm1
divsd 0x10(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
jmp 0x91bf
movsd 0x27701(%rip), %xmm0    # 0x30678
movapd 0x10(%rsp), %xmm1
divsd %xmm1, %xmm0
movapd %xmm1, %xmm4
addsd 0x27473(%rip), %xmm0    # 0x30400
movsd 0x2819b(%rip), %xmm1    # 0x31130
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd 0x28193(%rip), %xmm3    # 0x31138
subsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd 0x28183(%rip), %xmm2    # 0x31140
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x28177(%rip), %xmm1    # 0x31148
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2816b(%rip), %xmm3    # 0x31150
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2815f(%rip), %xmm2    # 0x31158
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x28153(%rip), %xmm1    # 0x31160
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x28147(%rip), %xmm3    # 0x31168
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2813b(%rip), %xmm2    # 0x31170
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2812f(%rip), %xmm1    # 0x31178
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x28123(%rip), %xmm3    # 0x31180
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x28117(%rip), %xmm2    # 0x31188
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2810b(%rip), %xmm1    # 0x31190
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x280ff(%rip), %xmm3    # 0x31198
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x280f3(%rip), %xmm2    # 0x311a0
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x280e7(%rip), %xmm1    # 0x311a8
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x280db(%rip), %xmm3    # 0x311b0
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x280cf(%rip), %xmm2    # 0x311b8
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x280c3(%rip), %xmm1    # 0x311c0
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x280b7(%rip), %xmm3    # 0x311c8
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x280ab(%rip), %xmm2    # 0x311d0
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2809f(%rip), %xmm1    # 0x311d8
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x28093(%rip), %xmm3    # 0x311e0
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x28087(%rip), %xmm2    # 0x311e8
mulsd %xmm0, %xmm2
subsd %xmm3, %xmm2
addsd 0x2807f(%rip), %xmm2    # 0x311f0
subsd %xmm3, %xmm2
mulsd 0x2730b(%rip), %xmm2    # 0x30488
movsd %xmm2, 0x8(%rsp)
movapd 0x27025(%rip), %xmm0    # 0x301b0
xorpd %xmm4, %xmm0
movq %rbx, %rdi
callq 0x24569
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x24424
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x30, %rsp
popq %rbx
retq