// File: /workspace/github_cpp_makefile_star2_O2/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 0x2440c
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm0
movsd 0x2279c(%rip), %xmm1    # 0x31698
movsd %xmm0, 0x18(%rsp)
callq 0x24239
testb %al, %al
je 0xf0b3
movsd 0x18(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd 0x228cf(%rip), %xmm1    # 0x317f0
mulsd %xmm0, %xmm1
addsd 0x228cb(%rip), %xmm1    # 0x317f8
mulsd %xmm0, %xmm1
addsd 0x228c7(%rip), %xmm1    # 0x31800
mulsd %xmm0, %xmm1
addsd 0x228c3(%rip), %xmm1    # 0x31808
mulsd %xmm0, %xmm1
addsd 0x228bf(%rip), %xmm1    # 0x31810
mulsd %xmm0, %xmm1
addsd 0x228bb(%rip), %xmm1    # 0x31818
movsd %xmm1, 0x30(%rsp)
movsd 0x228b5(%rip), %xmm1    # 0x31820
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd 0x228ad(%rip), %xmm1    # 0x31828
mulsd %xmm0, %xmm1
addsd 0x228a9(%rip), %xmm1    # 0x31830
mulsd %xmm0, %xmm1
addsd 0x228a5(%rip), %xmm1    # 0x31838
mulsd %xmm0, %xmm1
addsd 0x228a1(%rip), %xmm1    # 0x31840
mulsd %xmm0, %xmm1
addsd 0x2289d(%rip), %xmm1    # 0x31848
movsd %xmm1, 0x28(%rsp)
movsd 0x22897(%rip), %xmm1    # 0x31850
mulsd %xmm0, %xmm1
addsd 0x22893(%rip), %xmm1    # 0x31858
mulsd %xmm0, %xmm1
addsd 0x2288f(%rip), %xmm1    # 0x31860
mulsd %xmm0, %xmm1
addsd 0x2288b(%rip), %xmm1    # 0x31868
mulsd %xmm0, %xmm1
addsd 0x22887(%rip), %xmm1    # 0x31870
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm2
movsd 0x2287f(%rip), %xmm3    # 0x31878
mulsd %xmm0, %xmm3
addsd 0x2287b(%rip), %xmm3    # 0x31880
movsd 0x211eb(%rip), %xmm1    # 0x301f8
mulsd %xmm0, %xmm3
addsd 0x2286f(%rip), %xmm3    # 0x31888
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rsp)
mulsd %xmm0, %xmm3
addsd 0x22861(%rip), %xmm3    # 0x31890
mulsd %xmm0, %xmm3
addsd 0x2285d(%rip), %xmm3    # 0x31898
mulsd %xmm0, %xmm3
addsd 0x22859(%rip), %xmm3    # 0x318a0
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, 0x38(%rsp)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x24437
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 0x24437
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x20(%rsp), %xmm0
divsd 0x38(%rsp), %xmm0
movsd %xmm0, (%r14)
jmp 0xf43d
movsd 0x225e5(%rip), %xmm1    # 0x316a0
movsd 0x8(%rsp), %xmm0
callq 0x24279
testb %al, %al
je 0xf10a
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x24437
cvtsi2sd %rax, %xmm0
mulsd 0x213a3(%rip), %xmm0    # 0x30488
movsd %xmm0, (%r14)
movsd 0x10(%rsp), %xmm0
movq %r15, %rdi
callq 0x24437
cvtsi2sd %rax, %xmm0
mulsd 0x21383(%rip), %xmm0    # 0x30488
jmp 0xf439
movsd 0x18(%rsp), %xmm7
movapd %xmm7, %xmm2
mulsd 0x21374(%rip), %xmm2    # 0x30490
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
movsd 0x210cc(%rip), %xmm3    # 0x301f8
movapd %xmm3, %xmm0
movapd %xmm3, %xmm5
divsd %xmm1, %xmm0
movsd 0x22568(%rip), %xmm1    # 0x316a8
mulsd %xmm0, %xmm1
addsd 0x22564(%rip), %xmm1    # 0x316b0
mulsd %xmm0, %xmm1
addsd 0x22560(%rip), %xmm1    # 0x316b8
mulsd %xmm0, %xmm1
addsd 0x2255c(%rip), %xmm1    # 0x316c0
mulsd %xmm0, %xmm1
addsd 0x22558(%rip), %xmm1    # 0x316c8
mulsd %xmm0, %xmm1
addsd 0x22554(%rip), %xmm1    # 0x316d0
mulsd %xmm0, %xmm1
addsd 0x22550(%rip), %xmm1    # 0x316d8
mulsd %xmm0, %xmm1
addsd 0x2254c(%rip), %xmm1    # 0x316e0
mulsd %xmm0, %xmm1
addsd 0x22548(%rip), %xmm1    # 0x316e8
mulsd %xmm0, %xmm1
addsd 0x22544(%rip), %xmm1    # 0x316f0
movsd 0x22544(%rip), %xmm3    # 0x316f8
addsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
addsd 0x2253c(%rip), %xmm3    # 0x31700
mulsd %xmm0, %xmm3
addsd 0x22538(%rip), %xmm3    # 0x31708
mulsd %xmm0, %xmm3
addsd 0x22534(%rip), %xmm3    # 0x31710
mulsd %xmm0, %xmm3
addsd 0x22530(%rip), %xmm3    # 0x31718
mulsd %xmm0, %xmm3
addsd 0x2252c(%rip), %xmm3    # 0x31720
mulsd %xmm0, %xmm3
addsd 0x22528(%rip), %xmm3    # 0x31728
mulsd %xmm0, %xmm3
addsd 0x22524(%rip), %xmm3    # 0x31730
mulsd %xmm0, %xmm3
addsd 0x22520(%rip), %xmm3    # 0x31738
mulsd %xmm0, %xmm3
addsd 0x2251c(%rip), %xmm3    # 0x31740
movsd 0x2251c(%rip), %xmm4    # 0x31748
mulsd %xmm0, %xmm4
addsd 0x22518(%rip), %xmm4    # 0x31750
mulsd %xmm0, %xmm4
addsd 0x22514(%rip), %xmm4    # 0x31758
mulsd %xmm0, %xmm4
addsd 0x22510(%rip), %xmm4    # 0x31760
mulsd %xmm0, %xmm4
addsd 0x2250c(%rip), %xmm4    # 0x31768
mulsd %xmm0, %xmm4
addsd 0x22508(%rip), %xmm4    # 0x31770
mulsd %xmm0, %xmm4
addsd 0x22504(%rip), %xmm4    # 0x31778
mulsd %xmm0, %xmm4
addsd 0x22500(%rip), %xmm4    # 0x31780
mulsd %xmm0, %xmm4
addsd 0x224fc(%rip), %xmm4    # 0x31788
mulsd %xmm0, %xmm4
addsd 0x224f8(%rip), %xmm4    # 0x31790
movapd %xmm4, %xmm8
movsd 0x224fb(%rip), %xmm4    # 0x317a0
addsd %xmm0, %xmm4
mulsd %xmm0, %xmm4
addsd 0x224f3(%rip), %xmm4    # 0x317a8
mulsd %xmm0, %xmm4
addsd 0x224ef(%rip), %xmm4    # 0x317b0
mulsd %xmm0, %xmm4
addsd 0x224eb(%rip), %xmm4    # 0x317b8
movapd %xmm5, %xmm6
mulsd %xmm0, %xmm4
addsd 0x224e3(%rip), %xmm4    # 0x317c0
divsd %xmm2, %xmm5
mulsd %xmm0, %xmm4
addsd 0x224db(%rip), %xmm4    # 0x317c8
mulsd %xmm0, %xmm8
mulsd %xmm0, %xmm4
addsd 0x224d2(%rip), %xmm4    # 0x317d0
movsd 0x22492(%rip), %xmm2    # 0x31798
mulsd %xmm0, %xmm4
addsd 0x224c6(%rip), %xmm4    # 0x317d8
addsd %xmm2, %xmm8
mulsd %xmm0, %xmm4
addsd 0x224bd(%rip), %xmm4    # 0x317e0
mulsd %xmm5, %xmm8
mulsd %xmm0, %xmm4
addsd 0x224b4(%rip), %xmm4    # 0x317e8
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 0x221da(%rip), %xmm0    # 0x31540
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
callq 0x24532
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
movq %r15, %rdi
callq 0x2452d
movsd 0x8(%rsp), %xmm3
mulsd 0x210fa(%rip), %xmm3    # 0x30490
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 0x210c0(%rip), %xmm1    # 0x30488
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 0x24437
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 0x24437
cvtsi2sd %rax, %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rbx)
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq