// File: /workspace/github_c_makefile_star2_O0/ranbenbasat[P]RHHH/prng.c
// Function: ran1
float ran1(prng_type * prng) {

  // A Random Number Generator that picks a uniform [0,1] random number
  // From Numerical Recipes, page 280
  // Should be called with a NEGATIVE value of idum to initialize
  // subsequent calls should not alter idum

  int j;
  long k;
  float temp;

  if (prng->floatidum <= 0 || !prng->iy) {
    if (-(prng->floatidum) < 1) prng->floatidum=1;
    else prng->floatidum = -(prng->floatidum);
    for (j=NTAB+7;j>=0;j--) {
      k=(prng->floatidum)/IQ;
      prng->floatidum=IA*(prng->floatidum-k*IQ)-IR*k;
      if (prng->floatidum < 0) prng->floatidum+=IM;
      if (j<NTAB) prng->iv[j]=prng->floatidum;
    }
    prng->iy=prng->iv[0];
  }
  k = (prng->floatidum)/IQ;
  prng->floatidum=IA*(prng->floatidum-k*IQ)-IR*k;
  if (prng->floatidum<0) prng->floatidum += IM;
  j = prng->iy/NDIV;
  prng->iy=prng->iv[j];
  prng->iv[j]=prng->floatidum;
  if ((temp=AM*prng->iy) > RNMX) return RNMX;
  else return temp;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq -0x10(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jle 0x3891
movq -0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x3984
movq -0x10(%rsp), %rcx
xorl %eax, %eax
subq 0x8(%rcx), %rax
cmpq $0x1, %rax
jge 0x38b1
movq -0x10(%rsp), %rax
movq $0x1, 0x8(%rax)
jmp 0x38c5
movq -0x10(%rsp), %rax
xorl %ecx, %ecx
subq 0x8(%rax), %rcx
movq -0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movl $0x27, -0x14(%rsp)
cmpl $0x0, -0x14(%rsp)
jl 0x3972
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rax
movl $0x1f31d, %ecx          # imm = 0x1F31D
cqto
idivq %rcx
movq %rax, -0x20(%rsp)
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0x1f31d, -0x20(%rsp), %rcx # imm = 0x1F31D
subq %rcx, %rax
imulq $0x41a7, %rax, %rcx     # imm = 0x41A7
imulq $0xb14, -0x20(%rsp), %rax # imm = 0xB14
subq %rax, %rcx
movq -0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jge 0x3941
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rcx
addq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
movq %rcx, 0x8(%rax)
cmpl $0x20, -0x14(%rsp)
jge 0x3960
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movq %rdx, 0x20(%rax,%rcx,8)
jmp 0x3962
movl -0x14(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rsp)
jmp 0x38cd
movq -0x10(%rsp), %rax
movq 0x20(%rax), %rcx
movq -0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rax
movl $0x1f31d, %ecx          # imm = 0x1F31D
cqto
idivq %rcx
movq %rax, -0x20(%rsp)
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0x1f31d, -0x20(%rsp), %rcx # imm = 0x1F31D
subq %rcx, %rax
imulq $0x41a7, %rax, %rcx     # imm = 0x41A7
imulq $0xb14, -0x20(%rsp), %rax # imm = 0xB14
subq %rax, %rcx
movq -0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jge 0x39ed
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rcx
addq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
movq %rcx, 0x8(%rax)
movq -0x10(%rsp), %rax
movq 0x18(%rax), %rax
movl $0x4000000, %ecx        # imm = 0x4000000
cqto
idivq %rcx
movl %eax, -0x14(%rsp)
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movq 0x20(%rax,%rcx,8), %rcx
movq -0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movq %rdx, 0x20(%rax,%rcx,8)
movq -0x10(%rsp), %rax
cvtsi2sdq 0x18(%rax), %xmm1
movsd 0x1729(%rip), %xmm0     # 0x5170
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x24(%rsp)
cvtss2sd %xmm0, %xmm0
movsd 0x1707(%rip), %xmm1     # 0x5168
ucomisd %xmm1, %xmm0
jbe 0x3a77
movss 0x1731(%rip), %xmm0     # 0x51a0
movss %xmm0, -0x4(%rsp)
jmp 0x3a83
movss -0x24(%rsp), %xmm0
movss %xmm0, -0x4(%rsp)
movss -0x4(%rsp), %xmm0
retq
nopw (%rax,%rax)