// File: 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 %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movsd %xmm0, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x4a38f(%rip), %xmm1    # 0x55620
callq 0x3c4c0
testb $0x1, %al
jne 0xb29f
jmp 0xb356
movsd -0x10(%rbp), %xmm0
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1c4c0
movsd -0x10(%rbp), %xmm0
movsd 0x4aa86(%rip), %xmm1    # 0x55d48
subsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd 0x4a9e5(%rip), %xmm0    # 0x55cb8
divsd -0x10(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x3c890
movsd %xmm0, -0x58(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x3cb90
movsd %xmm0, -0x60(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x3cbc0
movsd -0x70(%rbp), %xmm2
movsd -0x68(%rbp), %xmm1
movsd -0x60(%rbp), %xmm3
movaps %xmm0, %xmm4
movsd -0x58(%rbp), %xmm0
mulsd %xmm4, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xb61f
movsd -0x10(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x3c870
movsd %xmm0, -0x28(%rbp)
movsd 0x4aaef(%rip), %xmm0    # 0x55e60
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4aacc(%rip), %xmm1    # 0x55e58
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4aaa5(%rip), %xmm1    # 0x55e50
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4aa7e(%rip), %xmm1    # 0x55e48
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4aa57(%rip), %xmm1    # 0x55e40
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4aa30(%rip), %xmm1    # 0x55e38
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4aa09(%rip), %xmm1    # 0x55e30
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a9e2(%rip), %xmm1    # 0x55e28
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a9bb(%rip), %xmm1    # 0x55e20
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x49b92(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a987(%rip), %xmm1    # 0x55e18
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a960(%rip), %xmm1    # 0x55e10
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a939(%rip), %xmm1    # 0x55e08
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a912(%rip), %xmm1    # 0x55e00
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a8eb(%rip), %xmm1    # 0x55df8
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a8c4(%rip), %xmm1    # 0x55df0
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a89d(%rip), %xmm1    # 0x55de8
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a876(%rip), %xmm1    # 0x55de0
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x4a84f(%rip), %xmm1    # 0x55dd8
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x10(%rbp), %xmm0
mulsd -0x40(%rbp), %xmm0
divsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x10(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0xa3e0
movsd %xmm0, -0x78(%rbp)
movsd -0x10(%rbp), %xmm0
movq -0x18(%rbp), %rdi
callq 0x3cd70
movsd -0x80(%rbp), %xmm1
movaps %xmm0, %xmm3
movsd -0x78(%rbp), %xmm0
movsd 0x49a2c(%rip), %xmm2    # 0x55008
divsd -0x10(%rbp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
movsd 0x4a6b0(%rip), %xmm2    # 0x55cb8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)