// File: /workspace/github_cpp_makefile_star2_O3/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 0x25e30
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm0
movsd 0x24dfa(%rip), %xmm1    # 0x34698
movsd %xmm0, 0x18(%rsp)
callq 0x25bb9
testb %al, %al
je 0xfa5b
movsd 0x18(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd 0x24f2d(%rip), %xmm1    # 0x347f0
mulsd %xmm0, %xmm1
addsd 0x24f29(%rip), %xmm1    # 0x347f8
mulsd %xmm0, %xmm1
addsd 0x24f25(%rip), %xmm1    # 0x34800
mulsd %xmm0, %xmm1
addsd 0x24f21(%rip), %xmm1    # 0x34808
mulsd %xmm0, %xmm1
addsd 0x24f1d(%rip), %xmm1    # 0x34810
mulsd %xmm0, %xmm1
addsd 0x24f19(%rip), %xmm1    # 0x34818
movsd %xmm1, 0x30(%rsp)
movsd 0x24f13(%rip), %xmm1    # 0x34820
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd 0x24f0b(%rip), %xmm1    # 0x34828
mulsd %xmm0, %xmm1
addsd 0x24f07(%rip), %xmm1    # 0x34830
mulsd %xmm0, %xmm1
addsd 0x24f03(%rip), %xmm1    # 0x34838
mulsd %xmm0, %xmm1
addsd 0x24eff(%rip), %xmm1    # 0x34840
mulsd %xmm0, %xmm1
addsd 0x24efb(%rip), %xmm1    # 0x34848
movsd %xmm1, 0x28(%rsp)
movsd 0x24ef5(%rip), %xmm1    # 0x34850
mulsd %xmm0, %xmm1
addsd 0x24ef1(%rip), %xmm1    # 0x34858
mulsd %xmm0, %xmm1
addsd 0x24eed(%rip), %xmm1    # 0x34860
mulsd %xmm0, %xmm1
addsd 0x24ee9(%rip), %xmm1    # 0x34868
mulsd %xmm0, %xmm1
addsd 0x24ee5(%rip), %xmm1    # 0x34870
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm2
movsd 0x24edd(%rip), %xmm3    # 0x34878
mulsd %xmm0, %xmm3
addsd 0x24ed9(%rip), %xmm3    # 0x34880
movsd 0x23831(%rip), %xmm1    # 0x331e0
mulsd %xmm0, %xmm3
addsd 0x24ecd(%rip), %xmm3    # 0x34888
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rsp)
mulsd %xmm0, %xmm3
addsd 0x24ebf(%rip), %xmm3    # 0x34890
mulsd %xmm0, %xmm3
addsd 0x24ebb(%rip), %xmm3    # 0x34898
mulsd %xmm0, %xmm3
addsd 0x24eb7(%rip), %xmm3    # 0x348a0
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, 0x38(%rsp)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x25e5b
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 0x25e5b
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x20(%rsp), %xmm0
divsd 0x38(%rsp), %xmm0
movsd %xmm0, (%r14)
jmp 0xfdf1
movsd 0x24c3d(%rip), %xmm1    # 0x346a0
movsd 0x8(%rsp), %xmm0
callq 0x25bf9
testb %al, %al
je 0xfab8
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x25e5b
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x239f8(%rip), %xmm0    # 0x33488
movsd %xmm0, (%r14)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x25e5b
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x239d5(%rip), %xmm0    # 0x33488
jmp 0xfded
movsd 0x18(%rsp), %xmm7
movapd %xmm7, %xmm2
mulsd 0x239c6(%rip), %xmm2    # 0x33490
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
movsd 0x23706(%rip), %xmm3    # 0x331e0
movapd %xmm3, %xmm0
movapd %xmm3, %xmm5
divsd %xmm1, %xmm0
movsd 0x24bba(%rip), %xmm1    # 0x346a8
mulsd %xmm0, %xmm1
addsd 0x24bb6(%rip), %xmm1    # 0x346b0
mulsd %xmm0, %xmm1
addsd 0x24bb2(%rip), %xmm1    # 0x346b8
mulsd %xmm0, %xmm1
addsd 0x24bae(%rip), %xmm1    # 0x346c0
mulsd %xmm0, %xmm1
addsd 0x24baa(%rip), %xmm1    # 0x346c8
mulsd %xmm0, %xmm1
addsd 0x24ba6(%rip), %xmm1    # 0x346d0
mulsd %xmm0, %xmm1
addsd 0x24ba2(%rip), %xmm1    # 0x346d8
mulsd %xmm0, %xmm1
addsd 0x24b9e(%rip), %xmm1    # 0x346e0
mulsd %xmm0, %xmm1
addsd 0x24b9a(%rip), %xmm1    # 0x346e8
mulsd %xmm0, %xmm1
addsd 0x24b96(%rip), %xmm1    # 0x346f0
movsd 0x24b96(%rip), %xmm3    # 0x346f8
addsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
addsd 0x24b8e(%rip), %xmm3    # 0x34700
mulsd %xmm0, %xmm3
addsd 0x24b8a(%rip), %xmm3    # 0x34708
mulsd %xmm0, %xmm3
addsd 0x24b86(%rip), %xmm3    # 0x34710
mulsd %xmm0, %xmm3
addsd 0x24b82(%rip), %xmm3    # 0x34718
mulsd %xmm0, %xmm3
addsd 0x24b7e(%rip), %xmm3    # 0x34720
mulsd %xmm0, %xmm3
addsd 0x24b7a(%rip), %xmm3    # 0x34728
mulsd %xmm0, %xmm3
addsd 0x24b76(%rip), %xmm3    # 0x34730
mulsd %xmm0, %xmm3
addsd 0x24b72(%rip), %xmm3    # 0x34738
mulsd %xmm0, %xmm3
addsd 0x24b6e(%rip), %xmm3    # 0x34740
movsd 0x24b6e(%rip), %xmm4    # 0x34748
mulsd %xmm0, %xmm4
addsd 0x24b6a(%rip), %xmm4    # 0x34750
mulsd %xmm0, %xmm4
addsd 0x24b66(%rip), %xmm4    # 0x34758
mulsd %xmm0, %xmm4
addsd 0x24b62(%rip), %xmm4    # 0x34760
mulsd %xmm0, %xmm4
addsd 0x24b5e(%rip), %xmm4    # 0x34768
mulsd %xmm0, %xmm4
addsd 0x24b5a(%rip), %xmm4    # 0x34770
mulsd %xmm0, %xmm4
addsd 0x24b56(%rip), %xmm4    # 0x34778
mulsd %xmm0, %xmm4
addsd 0x24b52(%rip), %xmm4    # 0x34780
mulsd %xmm0, %xmm4
addsd 0x24b4e(%rip), %xmm4    # 0x34788
mulsd %xmm0, %xmm4
addsd 0x24b4a(%rip), %xmm4    # 0x34790
movapd %xmm4, %xmm8
movsd 0x24b4d(%rip), %xmm4    # 0x347a0
addsd %xmm0, %xmm4
mulsd %xmm0, %xmm4
addsd 0x24b45(%rip), %xmm4    # 0x347a8
mulsd %xmm0, %xmm4
addsd 0x24b41(%rip), %xmm4    # 0x347b0
mulsd %xmm0, %xmm4
addsd 0x24b3d(%rip), %xmm4    # 0x347b8
movapd %xmm5, %xmm6
mulsd %xmm0, %xmm4
addsd 0x24b35(%rip), %xmm4    # 0x347c0
divsd %xmm2, %xmm5
mulsd %xmm0, %xmm4
addsd 0x24b2d(%rip), %xmm4    # 0x347c8
mulsd %xmm0, %xmm8
mulsd %xmm0, %xmm4
addsd 0x24b24(%rip), %xmm4    # 0x347d0
movsd 0x24ae4(%rip), %xmm2    # 0x34798
mulsd %xmm0, %xmm4
addsd 0x24b18(%rip), %xmm4    # 0x347d8
addsd %xmm2, %xmm8
mulsd %xmm0, %xmm4
addsd 0x24b0f(%rip), %xmm4    # 0x347e0
mulsd %xmm5, %xmm8
mulsd %xmm0, %xmm4
addsd 0x24b06(%rip), %xmm4    # 0x347e8
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 0x2482c(%rip), %xmm0    # 0x34540
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
callq 0x25f64
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
movq %r15, %rdi
callq 0x25f5f
movsd 0x8(%rsp), %xmm3
mulsd 0x2374c(%rip), %xmm3    # 0x33490
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 0x23712(%rip), %xmm1    # 0x33488
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 0x25e5b
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 0x25e5b
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rbx)
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq