// File: /workspace/github_cpp_makefile_star2_O3/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 0x2b7ee(%rip), %xmm1    # 0x33678
movsd %xmm0, (%rsp)
callq 0x25bf9
testb %al, %al
je 0x7f3e
leaq 0x38(%rsp), %r14
leaq 0x30(%rsp), %r15
movsd (%rsp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
callq 0x12d9b
movsd 0x2bc82(%rip), %xmm0    # 0x33b40
movsd (%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x2bc73(%rip), %xmm0    # 0x33b48
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x25e48
movsd %xmm0, (%rsp)
movsd (%r14), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x25f5f
movsd %xmm0, 0x28(%rsp)
movsd (%r15), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x25f64
mulsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm0
mulsd (%rsp), %xmm0
jmp 0x8011
movsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x25e43
movsd 0x2bc8d(%rip), %xmm2    # 0x33be0
mulsd %xmm0, %xmm2
addsd 0x2bc89(%rip), %xmm2    # 0x33be8
movsd 0x2bc89(%rip), %xmm1    # 0x33bf0
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 0x2cebd(%rip), %xmm2    # 0x34e40
mulpd %xmm1, %xmm2
addpd 0x2cec1(%rip), %xmm2    # 0x34e50
mulpd %xmm1, %xmm2
addpd 0x2cec5(%rip), %xmm2    # 0x34e60
mulpd %xmm1, %xmm2
addpd 0x2cec9(%rip), %xmm2    # 0x34e70
mulpd %xmm1, %xmm2
addpd 0x2cecd(%rip), %xmm2    # 0x34e80
mulpd %xmm1, %xmm2
addpd 0x2ced1(%rip), %xmm2    # 0x34e90
mulpd %xmm2, %xmm1
addpd 0x2ced5(%rip), %xmm1    # 0x34ea0
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 0x7653
mulsd 0x2bb56(%rip), %xmm0    # 0x33b48
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x25f91
mulsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq