// File: /workspace/github_cpp_makefile_star2_O2/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 0x24259
testb %al, %al
je 0x53fa
movsd 0x2b263(%rip), %xmm0    # 0x30658
jmp 0x56d0
movsd 0x2adf6(%rip), %xmm1    # 0x301f8
movsd (%rsp), %xmm0
callq 0x24295
testb %al, %al
je 0x541d
movsd 0x2b248(%rip), %xmm0    # 0x30660
jmp 0x56d0
movsd 0x2b243(%rip), %xmm1    # 0x30668
movsd (%rsp), %xmm0
callq 0x24279
movl %eax, %ebx
testb %al, %al
jne 0x543c
movsd (%rsp), %xmm0
jmp 0x5449
movsd 0x2adb4(%rip), %xmm0    # 0x301f8
subsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x2b21a(%rip), %xmm1    # 0x30670
callq 0x24279
testb %al, %al
je 0x552d
movsd (%rsp), %xmm3
addsd 0x2b038(%rip), %xmm3    # 0x304a8
movapd %xmm3, %xmm0
mulsd %xmm3, %xmm0
movsd 0x2b230(%rip), %xmm2    # 0x306b0
mulsd %xmm0, %xmm2
addsd 0x2b22c(%rip), %xmm2    # 0x306b8
mulsd %xmm0, %xmm2
addsd 0x2b228(%rip), %xmm2    # 0x306c0
mulsd %xmm0, %xmm2
addsd 0x2b224(%rip), %xmm2    # 0x306c8
mulsd %xmm0, %xmm2
addsd 0x2b220(%rip), %xmm2    # 0x306d0
movsd 0x2b220(%rip), %xmm1    # 0x306d8
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd 0x2b218(%rip), %xmm1    # 0x306e0
mulsd %xmm0, %xmm1
addsd 0x2b214(%rip), %xmm1    # 0x306e8
mulsd %xmm0, %xmm1
addsd 0x2b210(%rip), %xmm1    # 0x306f0
mulsd %xmm0, %xmm1
addsd 0x2b20c(%rip), %xmm1    # 0x306f8
mulsd %xmm0, %xmm1
addsd 0x2b208(%rip), %xmm1    # 0x30700
mulsd %xmm0, %xmm1
addsd 0x2b204(%rip), %xmm1    # 0x30708
mulsd %xmm0, %xmm1
addsd 0x2b200(%rip), %xmm1    # 0x30710
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
divsd %xmm1, %xmm0
addsd %xmm3, %xmm0
mulsd 0x2b1f0(%rip), %xmm0    # 0x30718
jmp 0x56d0
movsd (%rsp), %xmm0
movq %r14, %rdi
callq 0x2455f
mulsd 0x2aebe(%rip), %xmm0    # 0x30400
movq %r14, %rdi
callq 0x24424
movsd %xmm0, 0x18(%rsp)
movq %r14, %rdi
callq 0x2455f
movsd 0x18(%rsp), %xmm2
divsd %xmm2, %xmm0
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, (%rsp)
movsd 0x2ac81(%rip), %xmm0    # 0x301f8
divsd %xmm2, %xmm0
movapd %xmm0, 0x20(%rsp)
movsd 0x2b0ef(%rip), %xmm1    # 0x30678
movapd %xmm2, %xmm0
callq 0x24239
testb %al, %al
je 0x5625
movsd 0x2b0f6(%rip), %xmm0    # 0x30698
movapd 0x20(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd 0x2b0ec(%rip), %xmm0    # 0x306a0
movsd 0x2b0ec(%rip), %xmm1    # 0x306a8
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 0x2c6c8(%rip), %xmm0    # 0x31ca0
mulpd %xmm1, %xmm0
addpd 0x2c6cc(%rip), %xmm0    # 0x31cb0
mulpd %xmm1, %xmm0
addpd 0x2c6d0(%rip), %xmm0    # 0x31cc0
mulpd %xmm1, %xmm0
addpd 0x2c6d4(%rip), %xmm0    # 0x31cd0
mulpd %xmm1, %xmm0
addpd 0x2c6d8(%rip), %xmm0    # 0x31ce0
mulpd %xmm1, %xmm0
addpd 0x2c6dc(%rip), %xmm0    # 0x31cf0
mulpd %xmm1, %xmm0
addpd 0x2c6e0(%rip), %xmm0    # 0x31d00
jmp 0x56ab
movsd 0x2b053(%rip), %xmm0    # 0x30680
movapd 0x20(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd 0x2b049(%rip), %xmm0    # 0x30688
movsd 0x2b049(%rip), %xmm1    # 0x30690
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 0x2c5cd(%rip), %xmm0    # 0x31c30
mulpd %xmm1, %xmm0
addpd 0x2c5d1(%rip), %xmm0    # 0x31c40
mulpd %xmm1, %xmm0
addpd 0x2c5d5(%rip), %xmm0    # 0x31c50
mulpd %xmm1, %xmm0
addpd 0x2c5d9(%rip), %xmm0    # 0x31c60
mulpd %xmm1, %xmm0
addpd 0x2c5dd(%rip), %xmm0    # 0x31c70
mulpd %xmm1, %xmm0
addpd 0x2c5e1(%rip), %xmm0    # 0x31c80
mulpd %xmm1, %xmm0
addpd 0x2c5e5(%rip), %xmm0    # 0x31c90
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 0x56d0
xorpd 0x2aae0(%rip), %xmm0    # 0x301b0
addq $0x38, %rsp
popq %rbx
popq %r14
retq