// File: /workspace/github_cpp_makefile_star2_O3/mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::invnormaldistribution(double, alglib_impl::ae_state*)
double invnormaldistribution(double y0, ae_state *_state)
{
    double expm2;
    double s2pi;
    double x;
    double y;
    double z;
    double y2;
    double x0;
    double x1;
    ae_int_t code;
    double p0;
    double q0;
    double p1;
    double q1;
    double p2;
    double q2;
    double result;


    expm2 = 0.13533528323661269189;
    s2pi = 2.50662827463100050242;
    if( ae_fp_less_eq(y0,0) )
    {
        result = -ae_maxrealnumber;
        return result;
    }
    if( ae_fp_greater_eq(y0,1) )
    {
        result = ae_maxrealnumber;
        return result;
    }
    code = 1;
    y = y0;
    if( ae_fp_greater(y,1.0-expm2) )
    {
        y = 1.0-y;
        code = 0;
    }
    if( ae_fp_greater(y,expm2) )
    {
        y = y-0.5;
        y2 = y*y;
        p0 = -59.9633501014107895267;
        p0 = 98.0010754185999661536+y2*p0;
        p0 = -56.6762857469070293439+y2*p0;
        p0 = 13.9312609387279679503+y2*p0;
        p0 = -1.23916583867381258016+y2*p0;
        q0 = 1;
        q0 = 1.95448858338141759834+y2*q0;
        q0 = 4.67627912898881538453+y2*q0;
        q0 = 86.3602421390890590575+y2*q0;
        q0 = -225.462687854119370527+y2*q0;
        q0 = 200.260212380060660359+y2*q0;
        q0 = -82.0372256168333339912+y2*q0;
        q0 = 15.9056225126211695515+y2*q0;
        q0 = -1.18331621121330003142+y2*q0;
        x = y+y*y2*p0/q0;
        x = x*s2pi;
        result = x;
        return result;
    }
    x = ae_sqrt(-2.0*ae_log(y, _state), _state);
    x0 = x-ae_log(x, _state)/x;
    z = 1.0/x;
    if( ae_fp_less(x,8.0) )
    {
        p1 = 4.05544892305962419923;
        p1 = 31.5251094599893866154+z*p1;
        p1 = 57.1628192246421288162+z*p1;
        p1 = 44.0805073893200834700+z*p1;
        p1 = 14.6849561928858024014+z*p1;
        p1 = 2.18663306850790267539+z*p1;
        p1 = -1.40256079171354495875*0.1+z*p1;
        p1 = -3.50424626827848203418*0.01+z*p1;
        p1 = -8.57456785154685413611*0.0001+z*p1;
        q1 = 1;
        q1 = 15.7799883256466749731+z*q1;
        q1 = 45.3907635128879210584+z*q1;
        q1 = 41.3172038254672030440+z*q1;
        q1 = 15.0425385692907503408+z*q1;
        q1 = 2.50464946208309415979+z*q1;
        q1 = -1.42182922854787788574*0.1+z*q1;
        q1 = -3.80806407691578277194*0.01+z*q1;
        q1 = -9.33259480895457427372*0.0001+z*q1;
        x1 = z*p1/q1;
    }
    else
    {
        p2 = 3.23774891776946035970;
        p2 = 6.91522889068984211695+z*p2;
        p2 = 3.93881025292474443415+z*p2;
        p2 = 1.33303460815807542389+z*p2;
        p2 = 2.01485389549179081538*0.1+z*p2;
        p2 = 1.23716634817820021358*0.01+z*p2;
        p2 = 3.01581553508235416007*0.0001+z*p2;
        p2 = 2.65806974686737550832*0.000001+z*p2;
        p2 = 6.23974539184983293730*0.000000001+z*p2;
        q2 = 1;
        q2 = 6.02427039364742014255+z*q2;
        q2 = 3.67983563856160859403+z*q2;
        q2 = 1.37702099489081330271+z*q2;
        q2 = 2.16236993594496635890*0.1+z*q2;
        q2 = 1.34204006088543189037*0.01+z*q2;
        q2 = 3.28014464682127739104*0.0001+z*q2;
        q2 = 2.89247864745380683936*0.000001+z*q2;
        q2 = 6.79019408009981274425*0.000000001+z*q2;
        x1 = z*p2/q2;
    }
    x = x0-x1;
    if( code!=0 )
    {
        x = -x;
    }
    result = x;
    return result;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
xorpd %xmm1, %xmm1
movsd %xmm0, (%rsp)
callq 0x25bd9
testb %al, %al
je 0x5a67
movsd 0x2dbf6(%rip), %xmm0    # 0x33658
jmp 0x5d3d
movsd 0x2d771(%rip), %xmm1    # 0x331e0
movsd (%rsp), %xmm0
callq 0x25c15
testb %al, %al
je 0x5a8a
movsd 0x2dbdb(%rip), %xmm0    # 0x33660
jmp 0x5d3d
movsd 0x2dbd6(%rip), %xmm1    # 0x33668
movsd (%rsp), %xmm0
callq 0x25bf9
movl %eax, %ebx
testb %al, %al
jne 0x5aa9
movsd (%rsp), %xmm0
jmp 0x5ab6
movsd 0x2d72f(%rip), %xmm0    # 0x331e0
subsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x2dbad(%rip), %xmm1    # 0x33670
callq 0x25bf9
testb %al, %al
je 0x5b9a
movsd (%rsp), %xmm3
addsd 0x2d9cb(%rip), %xmm3    # 0x334a8
movapd %xmm3, %xmm0
mulsd %xmm3, %xmm0
movsd 0x2dbc3(%rip), %xmm2    # 0x336b0
mulsd %xmm0, %xmm2
addsd 0x2dbbf(%rip), %xmm2    # 0x336b8
mulsd %xmm0, %xmm2
addsd 0x2dbbb(%rip), %xmm2    # 0x336c0
mulsd %xmm0, %xmm2
addsd 0x2dbb7(%rip), %xmm2    # 0x336c8
mulsd %xmm0, %xmm2
addsd 0x2dbb3(%rip), %xmm2    # 0x336d0
movsd 0x2dbb3(%rip), %xmm1    # 0x336d8
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd 0x2dbab(%rip), %xmm1    # 0x336e0
mulsd %xmm0, %xmm1
addsd 0x2dba7(%rip), %xmm1    # 0x336e8
mulsd %xmm0, %xmm1
addsd 0x2dba3(%rip), %xmm1    # 0x336f0
mulsd %xmm0, %xmm1
addsd 0x2db9f(%rip), %xmm1    # 0x336f8
mulsd %xmm0, %xmm1
addsd 0x2db9b(%rip), %xmm1    # 0x33700
mulsd %xmm0, %xmm1
addsd 0x2db97(%rip), %xmm1    # 0x33708
mulsd %xmm0, %xmm1
addsd 0x2db93(%rip), %xmm1    # 0x33710
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
divsd %xmm1, %xmm0
addsd %xmm3, %xmm0
mulsd 0x2db83(%rip), %xmm0    # 0x33718
jmp 0x5d3d
movsd (%rsp), %xmm0
movq %r14, %rdi
callq 0x25f91
mulsd 0x2d861(%rip), %xmm0    # 0x33410
movq %r14, %rdi
callq 0x25e48
movsd %xmm0, 0x18(%rsp)
movq %r14, %rdi
callq 0x25f91
movsd 0x18(%rsp), %xmm2
divsd %xmm2, %xmm0
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, (%rsp)
movsd 0x2d5fc(%rip), %xmm0    # 0x331e0
divsd %xmm2, %xmm0
movapd %xmm0, 0x20(%rsp)
movsd 0x2da82(%rip), %xmm1    # 0x33678
movapd %xmm2, %xmm0
callq 0x25bb9
testb %al, %al
je 0x5c92
movsd 0x2da89(%rip), %xmm0    # 0x33698
movapd 0x20(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd 0x2da7f(%rip), %xmm0    # 0x336a0
movsd 0x2da7f(%rip), %xmm1    # 0x336a8
addsd %xmm2, %xmm1
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd %xmm2, %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
mulpd %xmm1, %xmm0
addpd 0x2f05b(%rip), %xmm0    # 0x34ca0
mulpd %xmm1, %xmm0
addpd 0x2f05f(%rip), %xmm0    # 0x34cb0
mulpd %xmm1, %xmm0
addpd 0x2f063(%rip), %xmm0    # 0x34cc0
mulpd %xmm1, %xmm0
addpd 0x2f067(%rip), %xmm0    # 0x34cd0
mulpd %xmm1, %xmm0
addpd 0x2f06b(%rip), %xmm0    # 0x34ce0
mulpd %xmm1, %xmm0
addpd 0x2f06f(%rip), %xmm0    # 0x34cf0
mulpd %xmm1, %xmm0
addpd 0x2f073(%rip), %xmm0    # 0x34d00
jmp 0x5d18
movsd 0x2d9e6(%rip), %xmm0    # 0x33680
movapd 0x20(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd 0x2d9dc(%rip), %xmm0    # 0x33688
movsd 0x2d9dc(%rip), %xmm1    # 0x33690
addsd %xmm2, %xmm1
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd %xmm2, %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
mulpd %xmm1, %xmm0
addpd 0x2ef60(%rip), %xmm0    # 0x34c30
mulpd %xmm1, %xmm0
addpd 0x2ef64(%rip), %xmm0    # 0x34c40
mulpd %xmm1, %xmm0
addpd 0x2ef68(%rip), %xmm0    # 0x34c50
mulpd %xmm1, %xmm0
addpd 0x2ef6c(%rip), %xmm0    # 0x34c60
mulpd %xmm1, %xmm0
addpd 0x2ef70(%rip), %xmm0    # 0x34c70
mulpd %xmm1, %xmm0
addpd 0x2ef74(%rip), %xmm0    # 0x34c80
mulpd %xmm1, %xmm0
addpd 0x2ef78(%rip), %xmm0    # 0x34c90
movapd %xmm2, %xmm1
mulsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
divsd %xmm0, %xmm1
movapd (%rsp), %xmm0
subsd %xmm1, %xmm0
testb %bl, %bl
jne 0x5d3d
xorpd 0x2d473(%rip), %xmm0    # 0x331b0
addq $0x38, %rsp
popq %rbx
popq %r14
retq