// File: /workspace/github_cpp_makefile_star2_O1/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 0x2adb3(%rip), %xmm0    # 0x34468
mulsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
movsd %xmm0, 0x8(%rsp)
callq 0x2633e
movzbl %al, %edi
leaq 0x2cebf(%rip), %rsi     # 0x36591
movq %rbx, %rdx
callq 0x2581c
movsd 0x2acfe(%rip), %xmm1    # 0x343e0
movaps 0x10(%rsp), %xmm0
callq 0x2631e
testb %al, %al
je 0x9821
movapd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd 0x2acea(%rip), %xmm0    # 0x343f0
movsd 0x2bcf2(%rip), %xmm1    # 0x35400
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd 0x2bcea(%rip), %xmm3    # 0x35408
subsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd 0x2bcda(%rip), %xmm2    # 0x35410
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2bcce(%rip), %xmm1    # 0x35418
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2bcc2(%rip), %xmm3    # 0x35420
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2bcb6(%rip), %xmm2    # 0x35428
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2bcaa(%rip), %xmm1    # 0x35430
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2bc9e(%rip), %xmm3    # 0x35438
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2bc92(%rip), %xmm2    # 0x35440
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2bc86(%rip), %xmm1    # 0x35448
mulsd %xmm0, %xmm1
subsd %xmm2, %xmm1
addsd 0x2bc7e(%rip), %xmm1    # 0x35450
subsd %xmm2, %xmm1
mulsd 0x2ac8a(%rip), %xmm1    # 0x34468
movapd %xmm1, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x266d6
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x8c7a
movapd 0x20(%rsp), %xmm1
divsd 0x10(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
jmp 0x9a71
movsd 0x2ae27(%rip), %xmm0    # 0x34650
movapd 0x10(%rsp), %xmm1
divsd %xmm1, %xmm0
movapd %xmm1, %xmm4
addsd 0x2abb1(%rip), %xmm0    # 0x343f0
movsd 0x2baf1(%rip), %xmm1    # 0x35338
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd 0x2bae9(%rip), %xmm3    # 0x35340
subsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd 0x2bad9(%rip), %xmm2    # 0x35348
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2bacd(%rip), %xmm1    # 0x35350
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2bac1(%rip), %xmm3    # 0x35358
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2bab5(%rip), %xmm2    # 0x35360
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2baa9(%rip), %xmm1    # 0x35368
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2ba9d(%rip), %xmm3    # 0x35370
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2ba91(%rip), %xmm2    # 0x35378
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2ba85(%rip), %xmm1    # 0x35380
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2ba79(%rip), %xmm3    # 0x35388
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2ba6d(%rip), %xmm2    # 0x35390
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2ba61(%rip), %xmm1    # 0x35398
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2ba55(%rip), %xmm3    # 0x353a0
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2ba49(%rip), %xmm2    # 0x353a8
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2ba3d(%rip), %xmm1    # 0x353b0
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2ba31(%rip), %xmm3    # 0x353b8
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2ba25(%rip), %xmm2    # 0x353c0
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2ba19(%rip), %xmm1    # 0x353c8
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2ba0d(%rip), %xmm3    # 0x353d0
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2ba01(%rip), %xmm2    # 0x353d8
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
addsd 0x2b9f5(%rip), %xmm1    # 0x353e0
movapd %xmm0, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
addsd 0x2b9e9(%rip), %xmm3    # 0x353e8
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm1, %xmm2
addsd 0x2b9dd(%rip), %xmm2    # 0x353f0
mulsd %xmm0, %xmm2
subsd %xmm3, %xmm2
addsd 0x2b9d5(%rip), %xmm2    # 0x353f8
subsd %xmm3, %xmm2
mulsd 0x2aa39(%rip), %xmm2    # 0x34468
movsd %xmm2, 0x8(%rsp)
movapd 0x2a7a3(%rip), %xmm0    # 0x341e0
xorpd %xmm4, %xmm0
movq %rbx, %rdi
callq 0x266e0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x2658d
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x30, %rsp
popq %rbx
retq