// File: mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::ibetaf_incompletebetafe2(double, double, double, double, double, alglib_impl::ae_state*)
static double ibetaf_incompletebetafe2(double a,
     double b,
     double x,
     double big,
     double biginv,
     ae_state *_state)
{
    double xk;
    double pk;
    double pkm1;
    double pkm2;
    double qk;
    double qkm1;
    double qkm2;
    double k1;
    double k2;
    double k3;
    double k4;
    double k5;
    double k6;
    double k7;
    double k8;
    double r;
    double t;
    double ans;
    double z;
    double thresh;
    ae_int_t n;
    double result;


    k1 = a;
    k2 = b-1.0;
    k3 = a;
    k4 = a+1.0;
    k5 = 1.0;
    k6 = a+b;
    k7 = a+1.0;
    k8 = a+2.0;
    pkm2 = 0.0;
    qkm2 = 1.0;
    pkm1 = 1.0;
    qkm1 = 1.0;
    z = x/(1.0-x);
    ans = 1.0;
    r = 1.0;
    n = 0;
    thresh = 3.0*ae_machineepsilon;
    do
    {
        xk = -z*k1*k2/(k3*k4);
        pk = pkm1+pkm2*xk;
        qk = qkm1+qkm2*xk;
        pkm2 = pkm1;
        pkm1 = pk;
        qkm2 = qkm1;
        qkm1 = qk;
        xk = z*k5*k6/(k7*k8);
        pk = pkm1+pkm2*xk;
        qk = qkm1+qkm2*xk;
        pkm2 = pkm1;
        pkm1 = pk;
        qkm2 = qkm1;
        qkm1 = qk;
        if( ae_fp_neq(qk,0) )
        {
            r = pk/qk;
        }
        if( ae_fp_neq(r,0) )
        {
            t = ae_fabs((ans-r)/r, _state);
            ans = r;
        }
        else
        {
            t = 1.0;
        }
        if( ae_fp_less(t,thresh) )
        {
            break;
        }
        k1 = k1+1.0;
        k2 = k2-1.0;
        k3 = k3+2.0;
        k4 = k4+2.0;
        k5 = k5+1.0;
        k6 = k6+1.0;
        k7 = k7+2.0;
        k8 = k8+2.0;
        if( ae_fp_greater(ae_fabs(qk, _state)+ae_fabs(pk, _state),big) )
        {
            pkm2 = pkm2*biginv;
            pkm1 = pkm1*biginv;
            qkm2 = qkm2*biginv;
            qkm1 = qkm1*biginv;
        }
        if( ae_fp_less(ae_fabs(qk, _state),biginv)||ae_fp_less(ae_fabs(pk, _state),biginv) )
        {
            pkm2 = pkm2*big;
            pkm1 = pkm1*big;
            qkm2 = qkm2*big;
            qkm1 = qkm1*big;
        }
        n = n+1;
    }
    while(n!=300);
    result = ans;
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movsd %xmm0, -0x8(%rbp)
movsd %xmm1, -0x10(%rbp)
movsd %xmm2, -0x18(%rbp)
movsd %xmm3, -0x20(%rbp)
movsd %xmm4, -0x28(%rbp)
movq %rdi, -0x30(%rbp)
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x37db9(%rip), %xmm1    # 0x55008
subsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd 0x37d9e(%rip), %xmm0    # 0x55008
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0x37d89(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x90(%rbp)
movsd -0x8(%rbp), %xmm0
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x37d67(%rip), %xmm0    # 0x55008
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd 0x38112(%rip), %xmm0    # 0x553c8
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x37d35(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x68(%rbp)
movsd 0x37d28(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x48(%rbp)
movsd 0x37d1b(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x60(%rbp)
movsd -0x18(%rbp), %xmm0
movsd 0x37d09(%rip), %xmm1    # 0x55008
subsd -0x18(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd 0x37cf0(%rip), %xmm0    # 0x55008
movsd %xmm0, -0xc0(%rbp)
movsd 0x37ce0(%rip), %xmm0    # 0x55008
movsd %xmm0, -0xb0(%rbp)
movq $0x0, -0xd8(%rbp)
movsd 0x3a175(%rip), %xmm0    # 0x574b8
movsd %xmm0, -0xd0(%rbp)
movsd -0xc8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd -0x70(%rbp), %xmm0
mulsd -0x78(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
mulsd -0x88(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x48(%rbp), %xmm1
movsd -0x50(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x60(%rbp), %xmm1
movsd -0x68(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0xc8(%rbp), %xmm0
mulsd -0x90(%rbp), %xmm0
mulsd -0x98(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm1
mulsd -0xa8(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x48(%rbp), %xmm1
movsd -0x50(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x60(%rbp), %xmm1
movsd -0x68(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x58(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0x3c410
testb $0x1, %al
jne 0x1d48e
jmp 0x1d4a0
movsd -0x40(%rbp), %xmm0
divsd -0x58(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xb0(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0x3c410
testb $0x1, %al
jne 0x1d4b6
jmp 0x1d4f1
movsd -0xc0(%rbp), %xmm0
subsd -0xb0(%rbp), %xmm0
divsd -0xb0(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd %xmm0, -0xb8(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
jmp 0x1d501
movsd 0x37b0f(%rip), %xmm0    # 0x55008
movsd %xmm0, -0xb8(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
callq 0x3c440
testb $0x1, %al
jne 0x1d51c
jmp 0x1d521
jmp 0x1d6eb
movsd 0x37adf(%rip), %xmm0    # 0x55008
addsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x78(%rbp), %xmm0
movsd 0x37ac8(%rip), %xmm1    # 0x55008
subsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd 0x37e77(%rip), %xmm0    # 0x553c8
addsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd 0x37e65(%rip), %xmm0    # 0x553c8
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0x37a8d(%rip), %xmm0    # 0x55008
addsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd 0x37a75(%rip), %xmm0    # 0x55008
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x37e1d(%rip), %xmm0    # 0x553c8
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd 0x37e05(%rip), %xmm0    # 0x553c8
addsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x58(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd %xmm0, -0xe8(%rbp)
movsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movaps %xmm0, %xmm1
movsd -0xe8(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd -0x20(%rbp), %xmm1
callq 0x3c4c0
testb $0x1, %al
jne 0x1d616
jmp 0x1d652
movsd -0x50(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x48(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x68(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x60(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x58(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd -0x28(%rbp), %xmm1
callq 0x3c440
testb $0x1, %al
jne 0x1d68c
movsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd -0x28(%rbp), %xmm1
callq 0x3c440
testb $0x1, %al
jne 0x1d68c
jmp 0x1d6c8
movsd -0x50(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x48(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x68(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x60(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0xd8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd8(%rbp)
cmpq $0x12c, -0xd8(%rbp) # imm = 0x12C
jne 0x1d34b
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xe0(%rbp), %xmm0
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax)