// File: /workspace/github_c_makefile_star2_O0/MersenneTwister-Lab[P]MTGP/mtgp64-ref.c
// Function: next_state
static void next_state(mtgp64_ref_t *mtgp64) {
    uint64_t *array = mtgp64->status->array;
    int idx;
    int size = mtgp64->status->size;
    uint64_t x;
    uint64_t y;
    uint64_t r;
    uint32_t xh;
    uint32_t xl;
    uint32_t yh;
    uint32_t yl;

    mtgp64->status->idx += 1;
    if (mtgp64->status->idx >= size) {
	mtgp64->status->idx = 0;
    }
    idx = mtgp64->status->idx;
    x = (array[idx] & mtgp64->params.mask) ^ array[(idx + 1) % size];
    y = array[(idx + mtgp64->params.pos) % size];
    xh = (uint32_t)(x >> 32);
    xl = (uint32_t)(x & 0xffffffffU);
    yh = (uint32_t)(y >> 32);
    yl = (uint32_t)(y & 0xffffffffU);
    xh ^= xh << mtgp64->params.sh1;
    xl ^= xl << mtgp64->params.sh1;
    yh = xl ^ (yh >> mtgp64->params.sh2);
    yl = xh ^ (yl >> mtgp64->params.sh2);
    r = ((uint64_t)yh << 32) | yl;
    if (yl & 1) {
	r ^= mtgp64->params.tbl[0];
    }
    if (yl & 2) {
	r ^= mtgp64->params.tbl[1];
    }
    if (yl & 4) {
	r ^= mtgp64->params.tbl[2];
    }
    if (yl & 8) {
	r ^= mtgp64->params.tbl[3];
    }
    array[idx] = r;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq 0x70(%rax), %rax
addq $0x8, %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq 0x70(%rax), %rax
movl (%rax), %eax
movl %eax, -0x18(%rsp)
movq -0x8(%rsp), %rax
movq 0x70(%rax), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rsp), %rax
movq 0x70(%rax), %rax
movl 0x4(%rax), %eax
cmpl -0x18(%rsp), %eax
jl 0x26da
movq -0x8(%rsp), %rax
movq 0x70(%rax), %rax
movl $0x0, 0x4(%rax)
movq -0x8(%rsp), %rax
movq 0x70(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x14(%rsp)
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x8(%rsp), %rcx
andq 0x50(%rcx), %rax
movq %rax, -0x50(%rsp)
movq -0x10(%rsp), %rcx
movl -0x14(%rsp), %eax
addl $0x1, %eax
cltd
idivl -0x18(%rsp)
movq -0x50(%rsp), %rax
movslq %edx, %rdx
xorq (%rcx,%rdx,8), %rax
movq %rax, -0x20(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x48(%rsp)
movl -0x14(%rsp), %eax
movq -0x8(%rsp), %rcx
addl 0x4(%rcx), %eax
cltd
idivl -0x18(%rsp)
movq -0x48(%rsp), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rsp)
movq -0x20(%rsp), %rax
shrq $0x20, %rax
movl %eax, -0x34(%rsp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x20(%rsp), %rax
movl %eax, -0x38(%rsp)
movq -0x28(%rsp), %rax
shrq $0x20, %rax
movl %eax, -0x3c(%rsp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x28(%rsp), %rax
movl %eax, -0x40(%rsp)
movl -0x34(%rsp), %eax
movq -0x8(%rsp), %rcx
movl 0x8(%rcx), %ecx
shll %cl, %eax
xorl -0x34(%rsp), %eax
movl %eax, -0x34(%rsp)
movl -0x38(%rsp), %eax
movq -0x8(%rsp), %rcx
movl 0x8(%rcx), %ecx
shll %cl, %eax
xorl -0x38(%rsp), %eax
movl %eax, -0x38(%rsp)
movl -0x38(%rsp), %eax
movl -0x3c(%rsp), %edx
movq -0x8(%rsp), %rcx
movl 0xc(%rcx), %ecx
shrl %cl, %edx
movl %edx, %ecx
xorl %ecx, %eax
movl %eax, -0x3c(%rsp)
movl -0x34(%rsp), %eax
movl -0x40(%rsp), %edx
movq -0x8(%rsp), %rcx
movl 0xc(%rcx), %ecx
shrl %cl, %edx
movl %edx, %ecx
xorl %ecx, %eax
movl %eax, -0x40(%rsp)
movl -0x3c(%rsp), %eax
shlq $0x20, %rax
movl -0x40(%rsp), %ecx
orq %rcx, %rax
movq %rax, -0x30(%rsp)
movl -0x40(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2827
movq -0x8(%rsp), %rax
movq 0x10(%rax), %rax
xorq -0x30(%rsp), %rax
movq %rax, -0x30(%rsp)
movl -0x40(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2846
movq -0x8(%rsp), %rax
movq 0x18(%rax), %rax
xorq -0x30(%rsp), %rax
movq %rax, -0x30(%rsp)
movl -0x40(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2865
movq -0x8(%rsp), %rax
movq 0x20(%rax), %rax
xorq -0x30(%rsp), %rax
movq %rax, -0x30(%rsp)
movl -0x40(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x2884
movq -0x8(%rsp), %rax
movq 0x28(%rax), %rax
xorq -0x30(%rsp), %rax
movq %rax, -0x30(%rsp)
movq -0x30(%rsp), %rdx
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
retq
nopl (%rax,%rax)