// File: /workspace/github_c_makefile_star2_O1/debbiemarkslab[P]plmc/src/lib/twister.c
// Function: genrand_int32
unsigned long genrand_int32(void)
{   
    unsigned long y;
    static unsigned long mag01[2]={0x0UL, MATRIX_A};
    /* mag01[x] = x * MATRIX_A  for x=0,1 */

    if (mti >= N) { /* generate N words at one time */
        int kk;

        if (mti == N+1)   /* if init_genrand() has not been called, */
            init_genrand(5489UL); /* a default initial seed is used */

        for (kk=0;kk<N-M;kk++) {
            y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
            mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
        }
        for (;kk<N-1;kk++) {
            y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
            mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
        }
        y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
        mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];

        mti = 0;
    }
  
    y = mt[mti++];

    /* Tempering */
    y ^= (y >> 11);
    y ^= (y << 7) & 0x9d2c5680UL;
    y ^= (y << 15) & 0xefc60000UL;
    y ^= (y >> 18);

    return y;
}

// Assembly:
movl 0xf0e7(%rip), %eax      # 0x12140
cmpl $0x270, %eax            # imm = 0x270
jl 0x3191
cmpl $0x271, %eax            # imm = 0x271
jne 0x30b1
movq $0x1571, 0xf10a(%rip) # imm = 0x1571
movl $0x1, %eax
movl $0x1571, %edx           # imm = 0x1571
leaq 0xf0f9(%rip), %rcx      # 0x12180
movq %rdx, %rsi
shrq $0x1e, %rsi
xorl %edx, %esi
imull $0x6c078965, %esi, %edx # imm = 0x6C078965
addl %eax, %edx
movq %rdx, (%rcx,%rax,8)
incq %rax
cmpq $0x270, %rax            # imm = 0x270
jne 0x3087
movl $0x270, 0xf08f(%rip)    # imm = 0x270
xorl %edx, %edx
leaq 0xf0c6(%rip), %rcx      # 0x12180
movl $0x80000000, %esi       # imm = 0x80000000
leaq 0xaf6a(%rip), %rax      # 0xe030
movl (%rcx,%rdx,8), %edi
andl %esi, %edi
movl 0x8(%rcx,%rdx,8), %r8d
movl %r8d, %r9d
andl $0x7ffffffe, %r9d       # imm = 0x7FFFFFFE
orl %edi, %r9d
shrl %r9d
andl $0x1, %r8d
movq (%rax,%r8,8), %rdi
xorq 0xc68(%rcx,%rdx,8), %rdi
xorq %r9, %rdi
movq %rdi, (%rcx,%rdx,8)
leaq 0x1(%rdx), %rdi
movq %rdi, %rdx
cmpq $0xe3, %rdi
jne 0x30c6
xorl %edx, %edx
movl $0x80000000, %esi       # imm = 0x80000000
movl 0x718(%rcx,%rdx,8), %edi
andl %esi, %edi
movl 0x720(%rcx,%rdx,8), %r8d
movl %r8d, %r9d
andl $0x7ffffffe, %r9d       # imm = 0x7FFFFFFE
orl %edi, %r9d
shrl %r9d
andl $0x1, %r8d
movq (%rax,%r8,8), %rdi
xorq (%rcx,%rdx,8), %rdi
xorq %r9, %rdi
movq %rdi, 0x718(%rcx,%rdx,8)
incq %rdx
cmpq $0x18c, %rdx            # imm = 0x18C
jne 0x310e
movl $0x80000000, %ecx       # imm = 0x80000000
andl 0x1039b(%rip), %ecx     # 0x134f8
movl 0xf01d(%rip), %edx      # 0x12180
movl %edx, %esi
andl $0x7ffffffe, %esi       # imm = 0x7FFFFFFE
orl %ecx, %esi
andl $0x1, %edx
movq (%rax,%rdx,8), %rax
xorq 0xfc65(%rip), %rax      # 0x12de0
shrl %esi
xorq %rsi, %rax
movq %rax, 0x10371(%rip)     # 0x134f8
movl $0x0, 0xefaf(%rip)      # 0x12140
movslq 0xefa8(%rip), %rax      # 0x12140
leal 0x1(%rax), %ecx
movl %ecx, 0xef9f(%rip)      # 0x12140
leaq 0xefd8(%rip), %rcx      # 0x12180
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
shrq $0xb, %rcx
xorq %rax, %rcx
movl %ecx, %eax
shll $0x7, %eax
andl $0x9d2c5680, %eax       # imm = 0x9D2C5680
xorq %rcx, %rax
movl %eax, %ecx
shll $0xf, %ecx
andl $0xefc60000, %ecx       # imm = 0xEFC60000
xorq %rax, %rcx
movq %rcx, %rax
shrq $0x12, %rax
xorq %rcx, %rax
retq