// File: mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::besselk0(double, alglib_impl::ae_state*)
double besselk0(double x, ae_state *_state)
{
    double y;
    double z;
    double v;
    double b0;
    double b1;
    double b2;
    double result;


    ae_assert(ae_fp_greater(x,0), "Domain error in BesselK0: x<=0", _state);
    if( ae_fp_less_eq(x,2) )
    {
        y = x*x-2.0;
        bessel_besselmfirstcheb(1.37446543561352307156E-16, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 4.25981614279661018399E-14, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 1.03496952576338420167E-11, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 1.90451637722020886025E-9, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 2.53479107902614945675E-7, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 2.28621210311945178607E-5, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 1.26461541144692592338E-3, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 3.59799365153615016266E-2, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, 3.44289899924628486886E-1, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(y, -5.35327393233902768720E-1, &b0, &b1, &b2, _state);
        v = 0.5*(b0-b2);
        v = v-ae_log(0.5*x, _state)*besseli0(x, _state);
    }
    else
    {
        z = 8.0/x-2.0;
        bessel_besselmfirstcheb(5.30043377268626276149E-18, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -1.64758043015242134646E-17, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 5.21039150503902756861E-17, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -1.67823109680541210385E-16, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 5.51205597852431940784E-16, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -1.84859337734377901440E-15, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 6.34007647740507060557E-15, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -2.22751332699166985548E-14, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 8.03289077536357521100E-14, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -2.98009692317273043925E-13, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 1.14034058820847496303E-12, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -4.51459788337394416547E-12, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 1.85594911495471785253E-11, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -7.95748924447710747776E-11, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 3.57739728140030116597E-10, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -1.69753450938905987466E-9, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 8.57403401741422608519E-9, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -4.66048989768794782956E-8, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 2.76681363944501510342E-7, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -1.83175552271911948767E-6, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 1.39498137188764993662E-5, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -1.28495495816278026384E-4, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 1.56988388573005337491E-3, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, -3.14481013119645005427E-2, &b0, &b1, &b2, _state);
        bessel_besselmnextcheb(z, 2.44030308206595545468E0, &b0, &b1, &b2, _state);
        v = 0.5*(b0-b2);
        v = v*ae_exp(-x, _state)/ae_sqrt(x, _state);
    }
    result = v;
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movsd %xmm0, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movsd -0x8(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0x3c4c0
movq -0x10(%rbp), %rdx
movzbl %al, %edi
andl $0x1, %edi
leaq 0x4a743(%rip), %rsi     # 0x574f2
callq 0x3b240
movsd -0x8(%rbp), %xmm0
movsd 0x48607(%rip), %xmm1    # 0x553c8
callq 0x3c480
testb $0x1, %al
jne 0xcdcf
jmp 0xcfc1
movsd -0x8(%rbp), %xmm0
movsd -0x8(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x48843(%rip), %xmm1    # 0x55628
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rcx
movsd 0x494ee(%rip), %xmm0    # 0x562e8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c820
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x494c4(%rip), %xmm1    # 0x562e0
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x4949a(%rip), %xmm1    # 0x562d8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49470(%rip), %xmm1    # 0x562d0
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49446(%rip), %xmm1    # 0x562c8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x4941c(%rip), %xmm1    # 0x562c0
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x493f2(%rip), %xmm1    # 0x562b8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x493c8(%rip), %xmm1    # 0x562b0
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x4939e(%rip), %xmm1    # 0x562a8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49374(%rip), %xmm1    # 0x562a0
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x30(%rbp), %xmm1
subsd -0x40(%rbp), %xmm1
movsd 0x48501(%rip), %xmm0    # 0x55450
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd 0x484e6(%rip), %xmm0    # 0x55450
mulsd -0x8(%rbp), %xmm0
movq -0x10(%rbp), %rdi
callq 0x3cd70
movsd %xmm0, -0x50(%rbp)
movsd -0x8(%rbp), %xmm0
movq -0x10(%rbp), %rdi
callq 0xba10
movsd -0x58(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x50(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0xd3a6
movsd 0x48657(%rip), %xmm0    # 0x55620
divsd -0x8(%rbp), %xmm0
movsd 0x483f2(%rip), %xmm1    # 0x553c8
subsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movq -0x10(%rbp), %rcx
movsd 0x492ad(%rip), %xmm0    # 0x56298
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c820
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49283(%rip), %xmm1    # 0x56290
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49259(%rip), %xmm1    # 0x56288
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x4922f(%rip), %xmm1    # 0x56280
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49205(%rip), %xmm1    # 0x56278
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x491db(%rip), %xmm1    # 0x56270
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x491b1(%rip), %xmm1    # 0x56268
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49187(%rip), %xmm1    # 0x56260
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x4915d(%rip), %xmm1    # 0x56258
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49133(%rip), %xmm1    # 0x56250
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49109(%rip), %xmm1    # 0x56248
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x490df(%rip), %xmm1    # 0x56240
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x490b5(%rip), %xmm1    # 0x56238
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x4908b(%rip), %xmm1    # 0x56230
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49061(%rip), %xmm1    # 0x56228
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x49037(%rip), %xmm1    # 0x56220
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x4900d(%rip), %xmm1    # 0x56218
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48fe3(%rip), %xmm1    # 0x56210
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48fb9(%rip), %xmm1    # 0x56208
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48f8f(%rip), %xmm1    # 0x56200
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48f65(%rip), %xmm1    # 0x561f8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48f3b(%rip), %xmm1    # 0x561f0
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48f11(%rip), %xmm1    # 0x561e8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48ee7(%rip), %xmm1    # 0x561e0
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movsd 0x48ebd(%rip), %xmm1    # 0x561d8
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1c860
movsd -0x30(%rbp), %xmm1
subsd -0x40(%rbp), %xmm1
movsd 0x48112(%rip), %xmm0    # 0x55450
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x10(%rbp), %rdi
callq 0x3cdd0
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x8(%rbp), %xmm0
movq -0x10(%rbp), %rdi
callq 0x3c890
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm0
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)