// File: /workspace/github_cpp_makefile_star2_O1/mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::fresnelintegral(double, double*, double*, alglib_impl::ae_state*)
void fresnelintegral(double x, double* c, double* s, ae_state *_state)
{
    double xxa;
    double f;
    double g;
    double cc;
    double ss;
    double t;
    double u;
    double x2;
    double sn;
    double sd;
    double cn;
    double cd;
    double fn;
    double fd;
    double gn;
    double gd;
    double mpi;
    double mpio2;


    mpi = 3.14159265358979323846;
    mpio2 = 1.57079632679489661923;
    xxa = x;
    x = ae_fabs(xxa, _state);
    x2 = x*x;
    if( ae_fp_less(x2,2.5625) )
    {
        t = x2*x2;
        sn = -2.99181919401019853726E3;
        sn = sn*t+7.08840045257738576863E5;
        sn = sn*t-6.29741486205862506537E7;
        sn = sn*t+2.54890880573376359104E9;
        sn = sn*t-4.42979518059697779103E10;
        sn = sn*t+3.18016297876567817986E11;
        sd = 1.00000000000000000000E0;
        sd = sd*t+2.81376268889994315696E2;
        sd = sd*t+4.55847810806532581675E4;
        sd = sd*t+5.17343888770096400730E6;
        sd = sd*t+4.19320245898111231129E8;
        sd = sd*t+2.24411795645340920940E10;
        sd = sd*t+6.07366389490084639049E11;
        cn = -4.98843114573573548651E-8;
        cn = cn*t+9.50428062829859605134E-6;
        cn = cn*t-6.45191435683965050962E-4;
        cn = cn*t+1.88843319396703850064E-2;
        cn = cn*t-2.05525900955013891793E-1;
        cn = cn*t+9.99999999999999998822E-1;
        cd = 3.99982968972495980367E-12;
        cd = cd*t+9.15439215774657478799E-10;
        cd = cd*t+1.25001862479598821474E-7;
        cd = cd*t+1.22262789024179030997E-5;
        cd = cd*t+8.68029542941784300606E-4;
        cd = cd*t+4.12142090722199792936E-2;
        cd = cd*t+1.00000000000000000118E0;
        *s = ae_sign(xxa, _state)*x*x2*sn/sd;
        *c = ae_sign(xxa, _state)*x*cn/cd;
        return;
    }
    if( ae_fp_greater(x,36974.0) )
    {
        *c = ae_sign(xxa, _state)*0.5;
        *s = ae_sign(xxa, _state)*0.5;
        return;
    }
    x2 = x*x;
    t = mpi*x2;
    u = 1/(t*t);
    t = 1/t;
    fn = 4.21543555043677546506E-1;
    fn = fn*u+1.43407919780758885261E-1;
    fn = fn*u+1.15220955073585758835E-2;
    fn = fn*u+3.45017939782574027900E-4;
    fn = fn*u+4.63613749287867322088E-6;
    fn = fn*u+3.05568983790257605827E-8;
    fn = fn*u+1.02304514164907233465E-10;
    fn = fn*u+1.72010743268161828879E-13;
    fn = fn*u+1.34283276233062758925E-16;
    fn = fn*u+3.76329711269987889006E-20;
    fd = 1.00000000000000000000E0;
    fd = fd*u+7.51586398353378947175E-1;
    fd = fd*u+1.16888925859191382142E-1;
    fd = fd*u+6.44051526508858611005E-3;
    fd = fd*u+1.55934409164153020873E-4;
    fd = fd*u+1.84627567348930545870E-6;
    fd = fd*u+1.12699224763999035261E-8;
    fd = fd*u+3.60140029589371370404E-11;
    fd = fd*u+5.88754533621578410010E-14;
    fd = fd*u+4.52001434074129701496E-17;
    fd = fd*u+1.25443237090011264384E-20;
    gn = 5.04442073643383265887E-1;
    gn = gn*u+1.97102833525523411709E-1;
    gn = gn*u+1.87648584092575249293E-2;
    gn = gn*u+6.84079380915393090172E-4;
    gn = gn*u+1.15138826111884280931E-5;
    gn = gn*u+9.82852443688422223854E-8;
    gn = gn*u+4.45344415861750144738E-10;
    gn = gn*u+1.08268041139020870318E-12;
    gn = gn*u+1.37555460633261799868E-15;
    gn = gn*u+8.36354435630677421531E-19;
    gn = gn*u+1.86958710162783235106E-22;
    gd = 1.00000000000000000000E0;
    gd = gd*u+1.47495759925128324529E0;
    gd = gd*u+3.37748989120019970451E-1;
    gd = gd*u+2.53603741420338795122E-2;
    gd = gd*u+8.14679107184306179049E-4;
    gd = gd*u+1.27545075667729118702E-5;
    gd = gd*u+1.04314589657571990585E-7;
    gd = gd*u+4.60680728146520428211E-10;
    gd = gd*u+1.10273215066240270757E-12;
    gd = gd*u+1.38796531259578871258E-15;
    gd = gd*u+8.39158816283118707363E-19;
    gd = gd*u+1.86958710162783236342E-22;
    f = 1-u*fn/fd;
    g = t*gn/gd;
    t = mpio2*x2;
    cc = ae_cos(t, _state);
    ss = ae_sin(t, _state);
    t = mpi*x;
    *c = 0.5+(f*ss-g*cc)/t;
    *s = 0.5-(f*cc+g*ss)/t;
    *c = *c*ae_sign(xxa, _state);
    *s = *s*ae_sign(xxa, _state);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movsd %xmm0, 0x10(%rsp)
movq %rdx, %rdi
callq 0x26575
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm0
movsd 0x26069(%rip), %xmm1    # 0x35b80
movsd %xmm0, 0x18(%rsp)
callq 0x262fe
testb %al, %al
je 0xfcd4
movsd 0x18(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd 0x2619c(%rip), %xmm1    # 0x35cd8
mulsd %xmm0, %xmm1
addsd 0x26198(%rip), %xmm1    # 0x35ce0
mulsd %xmm0, %xmm1
addsd 0x26194(%rip), %xmm1    # 0x35ce8
mulsd %xmm0, %xmm1
addsd 0x26190(%rip), %xmm1    # 0x35cf0
mulsd %xmm0, %xmm1
addsd 0x2618c(%rip), %xmm1    # 0x35cf8
mulsd %xmm0, %xmm1
addsd 0x26188(%rip), %xmm1    # 0x35d00
movsd %xmm1, 0x30(%rsp)
movsd 0x26182(%rip), %xmm1    # 0x35d08
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd 0x2617a(%rip), %xmm1    # 0x35d10
mulsd %xmm0, %xmm1
addsd 0x26176(%rip), %xmm1    # 0x35d18
mulsd %xmm0, %xmm1
addsd 0x26172(%rip), %xmm1    # 0x35d20
mulsd %xmm0, %xmm1
addsd 0x2616e(%rip), %xmm1    # 0x35d28
mulsd %xmm0, %xmm1
addsd 0x2616a(%rip), %xmm1    # 0x35d30
movsd %xmm1, 0x28(%rsp)
movsd 0x26164(%rip), %xmm1    # 0x35d38
mulsd %xmm0, %xmm1
addsd 0x26160(%rip), %xmm1    # 0x35d40
mulsd %xmm0, %xmm1
addsd 0x2615c(%rip), %xmm1    # 0x35d48
mulsd %xmm0, %xmm1
addsd 0x26158(%rip), %xmm1    # 0x35d50
mulsd %xmm0, %xmm1
addsd 0x26154(%rip), %xmm1    # 0x35d58
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm2
movsd 0x2614c(%rip), %xmm3    # 0x35d60
mulsd %xmm0, %xmm3
addsd 0x26148(%rip), %xmm3    # 0x35d68
movsd 0x24578(%rip), %xmm1    # 0x341a0
mulsd %xmm0, %xmm3
addsd 0x2613c(%rip), %xmm3    # 0x35d70
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rsp)
mulsd %xmm0, %xmm3
addsd 0x2612e(%rip), %xmm3    # 0x35d78
mulsd %xmm0, %xmm3
addsd 0x2612a(%rip), %xmm3    # 0x35d80
mulsd %xmm0, %xmm3
addsd 0x26126(%rip), %xmm3    # 0x35d88
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, 0x38(%rsp)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x265a0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rbx)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x265a0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x20(%rsp), %xmm0
divsd 0x38(%rsp), %xmm0
movsd %xmm0, (%r14)
jmp 0x1006a
movsd 0x25eac(%rip), %xmm1    # 0x35b88
movsd 0x8(%rsp), %xmm0
callq 0x2633e
testb %al, %al
je 0xfd31
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x265a0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x2475f(%rip), %xmm0    # 0x34468
movsd %xmm0, (%r14)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x265a0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x2473c(%rip), %xmm0    # 0x34468
jmp 0x10066
movsd 0x18(%rsp), %xmm7
movapd %xmm7, %xmm2
mulsd 0x2472d(%rip), %xmm2    # 0x34470
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
movsd 0x2444d(%rip), %xmm3    # 0x341a0
movapd %xmm3, %xmm0
movapd %xmm3, %xmm5
divsd %xmm1, %xmm0
movsd 0x25e29(%rip), %xmm1    # 0x35b90
mulsd %xmm0, %xmm1
addsd 0x25e25(%rip), %xmm1    # 0x35b98
mulsd %xmm0, %xmm1
addsd 0x25e21(%rip), %xmm1    # 0x35ba0
mulsd %xmm0, %xmm1
addsd 0x25e1d(%rip), %xmm1    # 0x35ba8
mulsd %xmm0, %xmm1
addsd 0x25e19(%rip), %xmm1    # 0x35bb0
mulsd %xmm0, %xmm1
addsd 0x25e15(%rip), %xmm1    # 0x35bb8
mulsd %xmm0, %xmm1
addsd 0x25e11(%rip), %xmm1    # 0x35bc0
mulsd %xmm0, %xmm1
addsd 0x25e0d(%rip), %xmm1    # 0x35bc8
mulsd %xmm0, %xmm1
addsd 0x25e09(%rip), %xmm1    # 0x35bd0
mulsd %xmm0, %xmm1
addsd 0x25e05(%rip), %xmm1    # 0x35bd8
movsd 0x25e05(%rip), %xmm3    # 0x35be0
addsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
addsd 0x25dfd(%rip), %xmm3    # 0x35be8
mulsd %xmm0, %xmm3
addsd 0x25df9(%rip), %xmm3    # 0x35bf0
mulsd %xmm0, %xmm3
addsd 0x25df5(%rip), %xmm3    # 0x35bf8
mulsd %xmm0, %xmm3
addsd 0x25df1(%rip), %xmm3    # 0x35c00
mulsd %xmm0, %xmm3
addsd 0x25ded(%rip), %xmm3    # 0x35c08
mulsd %xmm0, %xmm3
addsd 0x25de9(%rip), %xmm3    # 0x35c10
mulsd %xmm0, %xmm3
addsd 0x25de5(%rip), %xmm3    # 0x35c18
mulsd %xmm0, %xmm3
addsd 0x25de1(%rip), %xmm3    # 0x35c20
mulsd %xmm0, %xmm3
addsd 0x25ddd(%rip), %xmm3    # 0x35c28
movsd 0x25ddd(%rip), %xmm4    # 0x35c30
mulsd %xmm0, %xmm4
addsd 0x25dd9(%rip), %xmm4    # 0x35c38
mulsd %xmm0, %xmm4
addsd 0x25dd5(%rip), %xmm4    # 0x35c40
mulsd %xmm0, %xmm4
addsd 0x25dd1(%rip), %xmm4    # 0x35c48
mulsd %xmm0, %xmm4
addsd 0x25dcd(%rip), %xmm4    # 0x35c50
mulsd %xmm0, %xmm4
addsd 0x25dc9(%rip), %xmm4    # 0x35c58
mulsd %xmm0, %xmm4
addsd 0x25dc5(%rip), %xmm4    # 0x35c60
mulsd %xmm0, %xmm4
addsd 0x25dc1(%rip), %xmm4    # 0x35c68
mulsd %xmm0, %xmm4
addsd 0x25dbd(%rip), %xmm4    # 0x35c70
mulsd %xmm0, %xmm4
addsd 0x25db9(%rip), %xmm4    # 0x35c78
movapd %xmm4, %xmm8
movsd 0x25dbc(%rip), %xmm4    # 0x35c88
addsd %xmm0, %xmm4
mulsd %xmm0, %xmm4
addsd 0x25db4(%rip), %xmm4    # 0x35c90
mulsd %xmm0, %xmm4
addsd 0x25db0(%rip), %xmm4    # 0x35c98
mulsd %xmm0, %xmm4
addsd 0x25dac(%rip), %xmm4    # 0x35ca0
movapd %xmm5, %xmm6
mulsd %xmm0, %xmm4
addsd 0x25da4(%rip), %xmm4    # 0x35ca8
divsd %xmm2, %xmm5
mulsd %xmm0, %xmm4
addsd 0x25d9c(%rip), %xmm4    # 0x35cb0
mulsd %xmm0, %xmm8
mulsd %xmm0, %xmm4
addsd 0x25d93(%rip), %xmm4    # 0x35cb8
movsd 0x25d53(%rip), %xmm2    # 0x35c80
mulsd %xmm0, %xmm4
addsd 0x25d87(%rip), %xmm4    # 0x35cc0
addsd %xmm2, %xmm8
mulsd %xmm0, %xmm4
addsd 0x25d7e(%rip), %xmm4    # 0x35cc8
mulsd %xmm5, %xmm8
mulsd %xmm0, %xmm4
addsd 0x25d75(%rip), %xmm4    # 0x35cd0
mulsd %xmm0, %xmm4
addsd %xmm2, %xmm4
divsd %xmm4, %xmm8
movsd %xmm8, 0x30(%rsp)
mulsd %xmm0, %xmm1
divsd %xmm3, %xmm1
subsd %xmm1, %xmm6
movsd %xmm6, 0x28(%rsp)
movapd %xmm7, %xmm0
mulsd 0x257bb(%rip), %xmm0    # 0x35748
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
callq 0x266a9
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
movq %r15, %rdi
callq 0x266a4
movsd 0x8(%rsp), %xmm3
mulsd 0x244b3(%rip), %xmm3    # 0x34470
movsd 0x20(%rsp), %xmm6
movapd %xmm6, %xmm1
movsd 0x30(%rsp), %xmm5
mulsd %xmm5, %xmm1
movsd 0x28(%rsp), %xmm4
movapd %xmm4, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
divsd %xmm3, %xmm2
movsd 0x24479(%rip), %xmm1    # 0x34468
addsd %xmm1, %xmm2
movsd %xmm2, (%r14)
mulsd %xmm0, %xmm5
movapd %xmm4, %xmm0
mulsd %xmm6, %xmm0
addsd %xmm5, %xmm0
divsd %xmm3, %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, (%rbx)
movsd (%r14), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x265a0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%r14)
movsd (%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x265a0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rbx)
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq