// File: /workspace/github_c_makefile_star2_O0/dapogon[P]cellcoal/src/cellcoal.c
// Function: RandomGamma1
double RandomGamma1 (double s, long int *seed)
{
    /* Random standard gamma for s<1
     switching method
     */
    double			r, x=0.0, small=1e-37, w;
    static double   a, p, uf, ss=10.0, d;
	
    if (s!=ss)
    {
        a  = 1.0-s;
        p  = a/(a+s*exp(-a));
        uf = p*pow(small/a,s);
        d  = a*log(a);
        ss = s;
    }
    for (;;)
    {
        r = RandomUniform(seed);
        if (r > p)
			{
            x = a-log((1.0-r)/(1.0-p));
            w=a*log(x)-d;  /* this was with comma in line above before 270917*/
			}
        else if (r>uf)
            {
            x = a*pow(r/p,1/s);
			w=x; /* this was with comma in line above before 270917*/
			}
        else
            return (0.0);
        r = RandomUniform(seed);
        if (1.0-r <= w && r > 0.0)
            if (r*(w+1.0) >= 1.0 || -log(r) <= w)
                continue;
        break;
    }
    return (x);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movsd %xmm0, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x252e4(%rip), %xmm0    # 0x3f078
movsd %xmm0, -0x30(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd 0x343da(%rip), %xmm0    # 0x4e180
jne 0x19daf
jp 0x19daf
jmp 0x19ea5
movsd 0x25269(%rip), %xmm0    # 0x3f020
subsd -0x10(%rbp), %xmm0
movsd %xmm0, 0x35bcc(%rip)    # 0x4f990
movsd 0x35bc4(%rip), %xmm0    # 0x4f990
movsd %xmm0, -0x50(%rbp)
movsd 0x35bb7(%rip), %xmm0    # 0x4f990
movsd %xmm0, -0x58(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd 0x35ba0(%rip), %xmm0    # 0x4f990
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0x22b0
movsd -0x60(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x50(%rbp), %xmm0
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x35b66(%rip)    # 0x4f998
movsd 0x35b5e(%rip), %xmm0    # 0x4f998
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
divsd 0x35b44(%rip), %xmm0    # 0x4f990
movsd -0x10(%rbp), %xmm1
callq 0x20c0
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x35b36(%rip)    # 0x4f9a0
movsd 0x35b1e(%rip), %xmm0    # 0x4f990
movsd %xmm0, -0x40(%rbp)
movsd 0x35b11(%rip), %xmm0    # 0x4f990
callq 0x2150
movaps %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x35b10(%rip)    # 0x4f9a8
movsd -0x10(%rbp), %xmm0
movsd %xmm0, 0x342db(%rip)    # 0x4e180
jmp 0x19ea7
movq -0x18(%rbp), %rdi
callq 0xa500
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
ucomisd 0x35ad6(%rip), %xmm0    # 0x4f998
jbe 0x19f59
movsd 0x35ac0(%rip), %xmm0    # 0x4f990
movsd %xmm0, -0x70(%rbp)
movsd 0x25143(%rip), %xmm0    # 0x3f020
subsd -0x20(%rbp), %xmm0
movsd 0x25136(%rip), %xmm1    # 0x3f020
subsd 0x35aa6(%rip), %xmm1    # 0x4f998
divsd %xmm1, %xmm0
callq 0x2150
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x35a7c(%rip), %xmm0    # 0x4f990
movsd %xmm0, -0x68(%rbp)
movsd -0x28(%rbp), %xmm0
callq 0x2150
movaps %xmm0, %xmm2
movsd -0x68(%rbp), %xmm0
movsd 0x35a75(%rip), %xmm1    # 0x4f9a8
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x19fc0
movsd -0x20(%rbp), %xmm0
ucomisd 0x35a3a(%rip), %xmm0    # 0x4f9a0
jbe 0x19fb1
movsd 0x35a20(%rip), %xmm0    # 0x4f990
movsd %xmm0, -0x78(%rbp)
movsd -0x20(%rbp), %xmm0
divsd 0x35a16(%rip), %xmm0    # 0x4f998
movsd 0x25096(%rip), %xmm1    # 0x3f020
divsd -0x10(%rbp), %xmm1
callq 0x20c0
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x19fbe
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x1a057
jmp 0x19fc0
movq -0x18(%rbp), %rdi
callq 0xa500
movsd %xmm0, -0x20(%rbp)
movsd 0x2504a(%rip), %xmm1    # 0x3f020
subsd -0x20(%rbp), %xmm1
movsd -0x38(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x1a04b
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1a04b
movsd -0x20(%rbp), %xmm0
movsd 0x2501f(%rip), %xmm1    # 0x3f020
addsd -0x38(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x2500e(%rip), %xmm1    # 0x3f020
ucomisd %xmm1, %xmm0
jae 0x1a044
movsd -0x20(%rbp), %xmm0
callq 0x2150
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
movsd -0x38(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x1a049
jmp 0x19ea7
jmp 0x1a04b
jmp 0x1a04d
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)