// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::bessely0(double, alglib_impl::ae_state*)
double bessely0(double x, ae_state *_state)
{
    double nn;
    double xsq;
    double pzero;
    double qzero;
    double p4;
    double q4;
    double result;


    if( ae_fp_greater(x,8.0) )
    {
        bessel_besselasympt0(x, &pzero, &qzero, _state);
        nn = x-ae_pi/4;
        result = ae_sqrt(2/ae_pi/x, _state)*(pzero*ae_sin(nn, _state)+qzero*ae_cos(nn, _state));
        return result;
    }
    xsq = ae_sqr(x, _state);
    p4 = -41370.35497933148554125235152;
    p4 = 59152134.65686889654273830069+xsq*p4;
    p4 = -34363712229.79040378171030138+xsq*p4;
    p4 = 10255208596863.94284509167421+xsq*p4;
    p4 = -1648605817185729.473122082537+xsq*p4;
    p4 = 137562431639934407.8571335453+xsq*p4;
    p4 = -5247065581112764941.297350814+xsq*p4;
    p4 = 65874732757195549259.99402049+xsq*p4;
    p4 = -27502866786291095837.01933175+xsq*p4;
    q4 = 1.0;
    q4 = 1282.452772478993804176329391+xsq*q4;
    q4 = 1001702.641288906265666651753+xsq*q4;
    q4 = 579512264.0700729537480087915+xsq*q4;
    q4 = 261306575504.1081249568482092+xsq*q4;
    q4 = 91620380340751.85262489147968+xsq*q4;
    q4 = 23928830434997818.57439356652+xsq*q4;
    q4 = 4192417043410839973.904769661+xsq*q4;
    q4 = 372645883898616588198.9980+xsq*q4;
    result = p4/q4+2/ae_pi*besselj0(x, _state)*ae_log(x, _state);
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movsd 0x28f20(%rip), %xmm1    # 0x30678
movsd %xmm0, (%rsp)
callq 0x24279
testb %al, %al
je 0x780c
leaq 0x38(%rsp), %r14
leaq 0x30(%rsp), %r15
movsd (%rsp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
callq 0x121f5
movsd 0x293b4(%rip), %xmm0    # 0x30b40
movsd (%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x293a5(%rip), %xmm0    # 0x30b48
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x24424
movsd %xmm0, (%rsp)
movsd (%r14), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x2452d
movsd %xmm0, 0x28(%rsp)
movsd (%r15), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x24532
mulsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm0
mulsd (%rsp), %xmm0
jmp 0x78df
movsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x2441f
movsd 0x293bf(%rip), %xmm2    # 0x30be0
mulsd %xmm0, %xmm2
addsd 0x293bb(%rip), %xmm2    # 0x30be8
movsd 0x293bb(%rip), %xmm1    # 0x30bf0
addsd %xmm0, %xmm1
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
movapd %xmm0, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
mulpd %xmm1, %xmm2
addpd 0x2a5df(%rip), %xmm2    # 0x31e30
mulpd %xmm1, %xmm2
addpd 0x2a5e3(%rip), %xmm2    # 0x31e40
mulpd %xmm1, %xmm2
addpd 0x2a5e7(%rip), %xmm2    # 0x31e50
mulpd %xmm1, %xmm2
addpd 0x2a5eb(%rip), %xmm2    # 0x31e60
mulpd %xmm1, %xmm2
addpd 0x2a5ef(%rip), %xmm2    # 0x31e70
mulpd %xmm1, %xmm2
addpd 0x2a5f3(%rip), %xmm2    # 0x31e80
mulpd %xmm2, %xmm1
addpd 0x2a5f7(%rip), %xmm1    # 0x31e90
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
divsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x6f42
mulsd 0x29288(%rip), %xmm0    # 0x30b48
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x2455f
mulsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq