// File: mouda[P]LTE_random_access-simulate/specialfunctions.cpp
// Function: alglib_impl::ibetaf_incompletebetafe(double, double, double, double, double, alglib_impl::ae_state*)
static double ibetaf_incompletebetafe(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 thresh;
    ae_int_t n;
    double result;


    k1 = a;
    k2 = a+b;
    k3 = a;
    k4 = a+1.0;
    k5 = 1.0;
    k6 = b-1.0;
    k7 = k4;
    k8 = a+2.0;
    pkm2 = 0.0;
    qkm2 = 1.0;
    pkm1 = 1.0;
    qkm1 = 1.0;
    ans = 1.0;
    r = 1.0;
    n = 0;
    thresh = 3.0*ae_machineepsilon;
    do
    {
        xk = -x*k1*k2/(k3*k4);
        pk = pkm1+pkm2*xk;
        qk = qkm1+qkm2*xk;
        pkm2 = pkm1;
        pkm1 = pk;
        qkm2 = qkm1;
        qkm1 = qk;
        xk = x*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 $0xe0, %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 -0x8(%rbp), %xmm0
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd 0x38285(%rip), %xmm0    # 0x55008
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0x38270(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x90(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x3825b(%rip), %xmm1    # 0x55008
subsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd 0x385f7(%rip), %xmm0    # 0x553c8
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x3821a(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x68(%rbp)
movsd 0x3820d(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x48(%rbp)
movsd 0x38200(%rip), %xmm0    # 0x55008
movsd %xmm0, -0x60(%rbp)
movsd 0x381f3(%rip), %xmm0    # 0x55008
movsd %xmm0, -0xc0(%rbp)
movsd 0x381e3(%rip), %xmm0    # 0x55008
movsd %xmm0, -0xb0(%rbp)
movq $0x0, -0xd0(%rbp)
movsd 0x3a678(%rip), %xmm0    # 0x574b8
movsd %xmm0, -0xc8(%rbp)
movsd -0x18(%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 -0x18(%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 0x1cf85
jmp 0x1cf97
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 0x1cfad
jmp 0x1cfe8
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 0x1cff8
movsd 0x38018(%rip), %xmm0    # 0x55008
movsd %xmm0, -0xb8(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd -0xc8(%rbp), %xmm1
callq 0x3c440
testb $0x1, %al
jne 0x1d013
jmp 0x1d018
jmp 0x1d1e2
movsd 0x37fe8(%rip), %xmm0    # 0x55008
addsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd 0x37fd6(%rip), %xmm0    # 0x55008
addsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd 0x38384(%rip), %xmm0    # 0x553c8
addsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd 0x38372(%rip), %xmm0    # 0x553c8
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0x37f9a(%rip), %xmm0    # 0x55008
addsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x98(%rbp), %xmm0
movsd 0x37f7a(%rip), %xmm1    # 0x55008
subsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x38326(%rip), %xmm0    # 0x553c8
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd 0x3830e(%rip), %xmm0    # 0x553c8
addsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x58(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd %xmm0, -0xe0(%rbp)
movsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movaps %xmm0, %xmm1
movsd -0xe0(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd -0x20(%rbp), %xmm1
callq 0x3c4c0
testb $0x1, %al
jne 0x1d10d
jmp 0x1d149
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 0x1d183
movsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd -0x28(%rbp), %xmm1
callq 0x3c440
testb $0x1, %al
jne 0x1d183
jmp 0x1d1bf
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 -0xd0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd0(%rbp)
cmpq $0x12c, -0xd0(%rbp) # imm = 0x12C
jne 0x1ce48
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xd8(%rbp), %xmm0
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)