// File: /workspace/github_cpp_makefile_star2_O1/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 0x2c3fb(%rip), %xmm1    # 0x34650
movsd %xmm0, 0x8(%rsp)
callq 0x2633e
testb %al, %al
je 0x830e
leaq 0x38(%rsp), %r14
leaq 0x30(%rsp), %r15
movsd 0x8(%rsp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
callq 0x13461
movsd 0x2cae5(%rip), %xmm0    # 0x34d70
movsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x2ca3d(%rip), %xmm0    # 0x34ce0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x2658d
movsd %xmm0, 0x8(%rsp)
movsd (%r14), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x266a4
movsd %xmm0, 0x28(%rsp)
movsd (%r15), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x266a9
mulsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
mulsd 0x18(%rsp), %xmm1
addsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
jmp 0x844a
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x26588
movsd 0x2cadc(%rip), %xmm1    # 0x34e00
mulsd %xmm0, %xmm1
addsd 0x2cad8(%rip), %xmm1    # 0x34e08
mulsd %xmm0, %xmm1
addsd 0x2cad4(%rip), %xmm1    # 0x34e10
mulsd %xmm0, %xmm1
addsd 0x2cad0(%rip), %xmm1    # 0x34e18
mulsd %xmm0, %xmm1
addsd 0x2cacc(%rip), %xmm1    # 0x34e20
mulsd %xmm0, %xmm1
addsd 0x2cac8(%rip), %xmm1    # 0x34e28
mulsd %xmm0, %xmm1
addsd 0x2cac4(%rip), %xmm1    # 0x34e30
mulsd %xmm0, %xmm1
addsd 0x2cac0(%rip), %xmm1    # 0x34e38
mulsd %xmm0, %xmm1
addsd 0x2cabc(%rip), %xmm1    # 0x34e40
movapd %xmm1, %xmm2
movsd 0x2cab8(%rip), %xmm1    # 0x34e48
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd 0x2cab0(%rip), %xmm1    # 0x34e50
mulsd %xmm0, %xmm1
addsd 0x2caac(%rip), %xmm1    # 0x34e58
mulsd %xmm0, %xmm1
addsd 0x2caa8(%rip), %xmm1    # 0x34e60
mulsd %xmm0, %xmm1
addsd 0x2caa4(%rip), %xmm1    # 0x34e68
mulsd %xmm0, %xmm1
addsd 0x2caa0(%rip), %xmm1    # 0x34e70
mulsd %xmm0, %xmm1
addsd 0x2ca9c(%rip), %xmm1    # 0x34e78
mulsd %xmm0, %xmm1
addsd 0x2ca98(%rip), %xmm1    # 0x34e80
mulsd %xmm0, %xmm1
addsd 0x2ca94(%rip), %xmm1    # 0x34e88
movsd 0x8(%rsp), %xmm0
mulsd %xmm0, %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rsp)
movq %rbx, %rdi
callq 0x79b6
movsd %xmm0, 0x18(%rsp)
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x266d6
movsd 0x2bda4(%rip), %xmm1    # 0x341d0
divsd 0x8(%rsp), %xmm1
mulsd 0x18(%rsp), %xmm0
addsd %xmm1, %xmm0
mulsd 0x2c89c(%rip), %xmm0    # 0x34ce0
addsd 0x10(%rsp), %xmm0
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq