// File: /workspace/github_c_makefile_star2_O1/aokad[P]sequeeze/seqtk.c
// Function: kr_rand
krint64_t kr_rand(krand_t *kr)
{
	krint64_t x;
	static const krint64_t mag01[2] = { 0, 0xB5026F5AA96619E9ULL };
    if (kr->mti >= KR_NN) {
		int i;
		if (kr->mti == KR_NN + 1) kr_srand0(5489ULL, kr);
        for (i = 0; i < KR_NN - KR_MM; ++i) {
            x = (kr->mt[i] & KR_UM) | (kr->mt[i+1] & KR_LM);
            kr->mt[i] = kr->mt[i + KR_MM] ^ (x>>1) ^ mag01[(int)(x&1)];
        }
        for (; i < KR_NN - 1; ++i) {
            x = (kr->mt[i] & KR_UM) | (kr->mt[i+1] & KR_LM);
            kr->mt[i] = kr->mt[i + (KR_MM - KR_NN)] ^ (x>>1) ^ mag01[(int)(x&1)];
        }
        x = (kr->mt[KR_NN - 1] & KR_UM) | (kr->mt[0] & KR_LM);
        kr->mt[KR_NN - 1] = kr->mt[KR_MM - 1] ^ (x>>1) ^ mag01[(int)(x&1)];
        kr->mti = 0;
    }
    x = kr->mt[kr->mti++];
    x ^= (x >> 29) & 0x5555555555555555ULL;
    x ^= (x << 17) & 0x71D67FFFEDA60000ULL;
    x ^= (x << 37) & 0xFFF7EEE000000000ULL;
    x ^= (x >> 43);
    return x;
}

// Assembly:
movl (%rdi), %eax
cmpl $0x138, %eax            # imm = 0x138
jl 0x395f
cmpl $0x139, %eax            # imm = 0x139
jne 0x3882
movq $0x1571, 0x8(%rdi)      # imm = 0x1571
movl $0x1, %eax
movl $0x1571, %r8d           # imm = 0x1571
movl $0x2, %ecx
movabsq $0x5851f42d4c957f2d, %rdx # imm = 0x5851F42D4C957F2D
movq %r8, %rsi
shrq $0x3e, %rsi
xorq %r8, %rsi
imulq %rdx, %rsi
leaq (%rcx,%rsi), %r8
decq %r8
addq %rax, %rsi
movq %r8, (%rdi,%rcx,8)
incq %rax
incq %rcx
movq %rsi, %r8
cmpq $0x139, %rcx            # imm = 0x139
jne 0x3851
movl $0x138, (%rdi)          # imm = 0x138
movl $0x8, %ecx
movq $-0x80000000, %rdx      # imm = 0x80000000
leaq 0x77ab(%rip), %rax      # 0xb040
movq (%rdi,%rcx), %rsi
andq %rdx, %rsi
movq 0x8(%rdi,%rcx), %r8
movl %r8d, %r9d
andl $0x7ffffffe, %r9d       # imm = 0x7FFFFFFE
orq %rsi, %r9
shrq %r9
andl $0x1, %r8d
movq (%rax,%r8,8), %rsi
xorq 0x4e0(%rdi,%rcx), %rsi
xorq %r9, %rsi
movq %rsi, (%rdi,%rcx)
addq $0x8, %rcx
cmpq $0x4e8, %rcx            # imm = 0x4E8
jne 0x3895
movl $0x9e, %ecx
movq $-0x80000000, %rdx      # imm = 0x80000000
movq -0x8(%rdi,%rcx,8), %rsi
andq %rdx, %rsi
movq (%rdi,%rcx,8), %r8
movl %r8d, %r9d
andl $0x7ffffffe, %r9d       # imm = 0x7FFFFFFE
orq %rsi, %r9
shrq %r9
andl $0x1, %r8d
movq (%rax,%r8,8), %rsi
xorq -0x4e8(%rdi,%rcx,8), %rsi
xorq %r9, %rsi
movq %rsi, -0x8(%rdi,%rcx,8)
incq %rcx
cmpq $0x139, %rcx            # imm = 0x139
jne 0x38e1
movq $-0x80000000, %rcx      # imm = 0x80000000
andq 0x9c0(%rdi), %rcx
movq 0x8(%rdi), %rdx
movl %edx, %esi
andl $0x7ffffffe, %esi       # imm = 0x7FFFFFFE
orq %rcx, %rsi
andl $0x1, %edx
movq (%rax,%rdx,8), %rax
xorq 0x4e0(%rdi), %rax
shrq %rsi
xorq %rsi, %rax
movq %rax, 0x9c0(%rdi)
movl $0x0, (%rdi)
movslq (%rdi), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%rdi)
movq 0x8(%rdi,%rax,8), %rax
movq %rax, %rcx
shrq $0x1d, %rcx
movabsq $0x555555555, %rdx      # imm = 0x555555555
andq %rcx, %rdx
xorq %rax, %rdx
movq %rdx, %rax
shlq $0x11, %rax
movabsq $0x71d67fffeda60000, %rcx # imm = 0x71D67FFFEDA60000
andq %rax, %rcx
xorq %rdx, %rcx
movl %ecx, %edx
andl $0x7ffbf77, %edx        # imm = 0x7FFBF77
shlq $0x25, %rdx
xorq %rcx, %rdx
movq %rdx, %rax
shrq $0x2b, %rax
xorq %rdx, %rax
retq