// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::bessely1(double, alglib_impl::ae_state*)
double bessely1(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_besselasympt1(x, &pzero, &qzero, _state);
        nn = x-3*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 = -2108847.540133123652824139923;
    p4 = 3639488548.124002058278999428+xsq*p4;
    p4 = -2580681702194.450950541426399+xsq*p4;
    p4 = 956993023992168.3481121552788+xsq*p4;
    p4 = -196588746272214065.8820322248+xsq*p4;
    p4 = 21931073399177975921.11427556+xsq*p4;
    p4 = -1212297555414509577913.561535+xsq*p4;
    p4 = 26554738314348543268942.48968+xsq*p4;
    p4 = -99637534243069222259967.44354+xsq*p4;
    q4 = 1.0;
    q4 = 1612.361029677000859332072312+xsq*q4;
    q4 = 1563282.754899580604737366452+xsq*q4;
    q4 = 1128686837.169442121732366891+xsq*q4;
    q4 = 646534088126.5275571961681500+xsq*q4;
    q4 = 297663212564727.6729292742282+xsq*q4;
    q4 = 108225825940881955.2553850180+xsq*q4;
    q4 = 29549879358971486742.90758119+xsq*q4;
    q4 = 5435310377188854170800.653097+xsq*q4;
    q4 = 508206736694124324531442.4152+xsq*q4;
    result = x*p4/q4+2/ae_pi*(besselj1(x, _state)*ae_log(x, _state)-1/x);
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movsd 0x28cc5(%rip), %xmm1    # 0x30678
movsd %xmm0, 0x8(%rsp)
callq 0x24279
testb %al, %al
je 0x7a6c
leaq 0x38(%rsp), %r14
leaq 0x30(%rsp), %r15
movsd 0x8(%rsp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
callq 0x1232a
movsd 0x291ef(%rip), %xmm0    # 0x30bd8
movsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x29147(%rip), %xmm0    # 0x30b48
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x24424
movsd %xmm0, 0x8(%rsp)
movsd (%r14), %xmm0
movsd %xmm0, 0x18(%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 0x18(%rsp), %xmm1
addsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
jmp 0x7ba8
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x2441f
movsd 0x29176(%rip), %xmm1    # 0x30bf8
mulsd %xmm0, %xmm1
addsd 0x29172(%rip), %xmm1    # 0x30c00
mulsd %xmm0, %xmm1
addsd 0x2916e(%rip), %xmm1    # 0x30c08
mulsd %xmm0, %xmm1
addsd 0x2916a(%rip), %xmm1    # 0x30c10
mulsd %xmm0, %xmm1
addsd 0x29166(%rip), %xmm1    # 0x30c18
mulsd %xmm0, %xmm1
addsd 0x29162(%rip), %xmm1    # 0x30c20
mulsd %xmm0, %xmm1
addsd 0x2915e(%rip), %xmm1    # 0x30c28
mulsd %xmm0, %xmm1
addsd 0x2915a(%rip), %xmm1    # 0x30c30
mulsd %xmm0, %xmm1
addsd 0x29156(%rip), %xmm1    # 0x30c38
movapd %xmm1, %xmm2
movsd 0x29152(%rip), %xmm1    # 0x30c40
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd 0x2914a(%rip), %xmm1    # 0x30c48
mulsd %xmm0, %xmm1
addsd 0x29146(%rip), %xmm1    # 0x30c50
mulsd %xmm0, %xmm1
addsd 0x29142(%rip), %xmm1    # 0x30c58
mulsd %xmm0, %xmm1
addsd 0x2913e(%rip), %xmm1    # 0x30c60
mulsd %xmm0, %xmm1
addsd 0x2913a(%rip), %xmm1    # 0x30c68
mulsd %xmm0, %xmm1
addsd 0x29136(%rip), %xmm1    # 0x30c70
mulsd %xmm0, %xmm1
addsd 0x29132(%rip), %xmm1    # 0x30c78
mulsd %xmm0, %xmm1
addsd 0x2912e(%rip), %xmm1    # 0x30c80
movsd 0x8(%rsp), %xmm0
mulsd %xmm0, %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rsp)
movq %rbx, %rdi
callq 0x7181
movsd %xmm0, 0x18(%rsp)
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x2455f
movsd 0x28676(%rip), %xmm1    # 0x30200
divsd 0x8(%rsp), %xmm1
mulsd 0x18(%rsp), %xmm0
addsd %xmm1, %xmm0
mulsd 0x28fa6(%rip), %xmm0    # 0x30b48
addsd 0x10(%rsp), %xmm0
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq