// File: /workspace/github_cpp_makefile_star2_O3/chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::ran2(int*)
double ran2(int * idum) {
        // ******************************************************
        // Long period (> 2 x 10^18) random number generator of L'Ecuyer
        // with Bays-Durham shuffle and added safeguards.
        // Returns a uniform random deviate between 0.0 and 1.0 (exclusive of the endpoint values).
        // Call with idum a negative integer to initialize; thereafter,
        // do not alter idum between successive deviates in a sequence.
        // RNMX should approximate the largest floating value that is less than 1.
        // ******************************************************
        static const int IM1=2147483563, IM2=2147483399, IMM1=IM1-1, IA1=40014, IA2=40692, IQ1=53668,
                        IQ2=52774, IR1=12211, IR2=3791, NTAB=32, NDIV=1+IMM1/NTAB;
        static const double AM=1.0/IM1, RNMX=1.0-1.2e-7;
        static int idum2 = 123456789;
        static int iy = 0;
        static int iv[NTAB];
        int j, k;
        if (*idum <= 0) {
            *idum = std::max(-*idum, 1);
            idum2 = *idum;
            for (j = NTAB+7; j >= 0; j--) {
                k = *idum/IQ1;
                *idum = IA1*(*idum-k*IQ1)-k*IR1;
                if (*idum < 0) *idum += IM1;
                if (j < NTAB) iv[j] = *idum;
            }
            iy = iv[0];
        }
        k = *idum/IQ1;
        *idum = IA1*(*idum-k*IQ1)-k*IR1;
        if (*idum < 0) *idum += IM1;
        k = idum2/IQ2;
        idum2 = IA2*(idum2-k*IQ2)-k*IR2;
        if (idum2 < 0) idum2 += IM2;
        j = iy/NDIV;
        iy = iv[j]-idum2;
        iv[j] = *idum;
        if (iy < 1) iy += IMM1;
        double ret = std::min(AM*iy, RNMX);
        return ret;
    }

// Assembly:
movl (%rsi), %eax
testl %eax, %eax
jg 0xc0d3
negl %eax
movl $0x1, %ecx
cmovbl %eax, %ecx
movl %ecx, (%rsi)
movl %ecx, 0x6228(%rip)      # 0x12290
movl $0x27, %eax
leaq 0x623c(%rip), %rcx      # 0x122b0
movslq (%rsi), %rdx
imulq $0x1389c755, %rdx, %rdi # imm = 0x1389C755
movq %rdi, %r8
shrq $0x3f, %r8
sarq $0x2c, %rdi
addl %r8d, %edi
imull $0xffff2e5c, %edi, %r8d # imm = 0xFFFF2E5C
addl %edx, %r8d
imull $0x9c4e, %r8d, %r8d     # imm = 0x9C4E
imull $0xffffd04d, %edi, %edi # imm = 0xFFFFD04D
leal (%r8,%rdi), %edx
addl $0x7fffffab, %edx       # imm = 0x7FFFFFAB
addl %edi, %r8d
cmovnsl %r8d, %edx
movl %edx, (%rsi)
cmpq $0x1f, %rax
ja 0xc0bf
movl %edx, (%rcx,%rax,4)
addq $-0x1, %rax
jb 0xc074
movl 0x61e5(%rip), %eax      # 0x122b0
movl %eax, 0x61d3(%rip)      # 0x122a4
movl (%rsi), %eax
cltq
imulq $0x1389c755, %rax, %rcx # imm = 0x1389C755
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
sarl $0xc, %ecx
addl %edx, %ecx
imull $0xffff2e5c, %ecx, %edx # imm = 0xFFFF2E5C
addl %edx, %eax
imull $0x9c4e, %eax, %eax     # imm = 0x9C4E
imull $0xffffd04d, %ecx, %ecx # imm = 0xFFFFD04D
leal (%rax,%rcx), %edx
addl $0x7fffffab, %edx       # imm = 0x7FFFFFAB
addl %ecx, %eax
cmovnsl %eax, %edx
movl %edx, (%rsi)
movslq 0x6179(%rip), %rax      # 0x12290
imulq $0x4f7a09cd, %rax, %rcx # imm = 0x4F7A09CD
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
sarl $0xe, %ecx
addl %edx, %ecx
imull $0xffff31da, %ecx, %edx # imm = 0xFFFF31DA
addl %eax, %edx
imull $0x9ef4, %edx, %eax     # imm = 0x9EF4
imull $0xfffff131, %ecx, %ecx # imm = 0xFFFFF131
leal (%rax,%rcx), %edx
addl $0x7fffff07, %edx       # imm = 0x7FFFFF07
addl %ecx, %eax
cmovnsl %eax, %edx
movl %edx, 0x613a(%rip)      # 0x12290
movslq 0x6147(%rip), %rax      # 0x122a4
imulq $-0x7fffffbf, %rax, %rcx # imm = 0x80000041
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
sarl $0x19, %ecx
addl %eax, %ecx
movslq %ecx, %rcx
leaq 0x6132(%rip), %rdi      # 0x122b0
movl (%rdi,%rcx,4), %eax
subl %edx, %eax
movl %eax, 0x611b(%rip)      # 0x122a4
movl (%rsi), %edx
movl %edx, (%rdi,%rcx,4)
jg 0xc19b
addl $0x7fffffaa, %eax       # imm = 0x7FFFFFAA
movl %eax, 0x6109(%rip)      # 0x122a4
cvtsi2sd %eax, %xmm1
mulsd 0x1f19(%rip), %xmm1     # 0xe0c0
movsd 0x1f19(%rip), %xmm0     # 0xe0c8
minsd %xmm1, %xmm0
retq