// File: /workspace/github_c_makefile_star2_O0/MersenneTwister-Lab[P]MTGP/mtgp32-fast.c
// Function: mtgp32_init_by_array
int mtgp32_init_by_array(mtgp32_fast_t *mtgp32,
			 const mtgp32_params_fast_t *para,
			 uint32_t *array, int length) {
    int i, j, count;
    uint32_t r;
    int lag;
    int mid;
    int size = para->mexp / 32 + 1;
    uint32_t hidden_seed;
    uint32_t tmp;
    mtgp32_status_fast_t *st;
    int rc;

    rc = alloc_state(mtgp32, para);
    if (rc) {
	return rc;
    }

    st = mtgp32->status;
    if (size >= 623) {
	lag = 11;
    } else if (size >= 68) {
	lag = 7;
    } else if (size >= 39) {
	lag = 5;
    } else {
	lag = 3;
    }
    mid = (size - lag) / 2;

    hidden_seed = para->tbl[4] ^ (para->tbl[8] << 16);
    tmp = hidden_seed;
    tmp += tmp >> 16;
    tmp += tmp >> 8;
    memset(st->array, tmp & 0xff, sizeof(uint32_t) * size);
    mtgp32->params = *para;
    mtgp32->status = st;
    st->size = size;
    st->idx = size - 1;
    st->array[0] = hidden_seed;

    if (length + 1 > size) {
	count = length + 1;
    } else {
	count = size;
    }
    r = ini_func1(st->array[0] ^ st->array[mid] ^ st->array[size - 1]);
    st->array[mid] += r;
    r += length;
    st->array[(mid + lag) % size] += r;
    st->array[0] = r;
    i = 1;
    count--;
    for (i = 1, j = 0; (j < count) && (j < length); j++) {
	r = ini_func1(st->array[i] ^ st->array[(i + mid) % size]
		      ^ st->array[(i + size - 1) % size]);
	st->array[(i + mid) % size] += r;
	r += array[j] + i;
	st->array[(i + mid + lag) % size] += r;
	st->array[i] = r;
	i = (i + 1) % size;
    }
    for (; j < count; j++) {
	r = ini_func1(st->array[i] ^ st->array[(i + mid) % size]
		      ^ st->array[(i + size - 1) % size]);
	st->array[(i + mid) % size] += r;
	r += i;
	st->array[(i + mid + lag) % size] += r;
	st->array[i] = r;
	i = (i + 1) % size;
    }
    for (j = 0; j < size; j++) {
	r = ini_func2(st->array[i] + st->array[(i + mid) % size]
		      + st->array[(i + size - 1) % size]);
	st->array[(i + mid) % size] ^= r;
	r -= i;
	st->array[(i + mid + lag) % size] ^= r;
	st->array[i] = r;
	i = (i + 1) % size;
    }
    if (st->array[size - 1] == 0) {
	st->array[size - 1] = non_zero;
    }
    return 0;
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xe8(%rsp)
movq %rsi, 0xe0(%rsp)
movq %rdx, 0xd8(%rsp)
movl %ecx, 0xd4(%rsp)
movq 0xe0(%rsp), %rax
movl (%rax), %eax
movl $0x20, %ecx
cltd
idivl %ecx
addl $0x1, %eax
movl %eax, 0xb8(%rsp)
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x1250
movl %eax, 0xa4(%rsp)
cmpl $0x0, 0xa4(%rsp)
je 0x14db
movl 0xa4(%rsp), %eax
movl %eax, 0xf4(%rsp)
jmp 0x1cc9
movq 0xe8(%rsp), %rax
movq 0xf0(%rax), %rax
movq %rax, 0xa8(%rsp)
cmpl $0x26f, 0xb8(%rsp) # imm = 0x26F
jl 0x150c
movl $0xb, 0xc0(%rsp)
jmp 0x1549
cmpl $0x44, 0xb8(%rsp)
jl 0x1523
movl $0x7, 0xc0(%rsp)
jmp 0x1547
cmpl $0x27, 0xb8(%rsp)
jl 0x153a
movl $0x5, 0xc0(%rsp)
jmp 0x1545
movl $0x3, 0xc0(%rsp)
jmp 0x1547
jmp 0x1549
movl 0xb8(%rsp), %eax
subl 0xc0(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0xbc(%rsp)
movq 0xe0(%rsp), %rax
movl 0x20(%rax), %eax
movq 0xe0(%rsp), %rcx
movl 0x30(%rcx), %ecx
shll $0x10, %ecx
xorl %ecx, %eax
movl %eax, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
movl %eax, 0xb0(%rsp)
movl 0xb0(%rsp), %eax
shrl $0x10, %eax
addl 0xb0(%rsp), %eax
movl %eax, 0xb0(%rsp)
movl 0xb0(%rsp), %eax
shrl $0x8, %eax
addl 0xb0(%rsp), %eax
movl %eax, 0xb0(%rsp)
movq 0xa8(%rsp), %rdi
addq $0x10, %rdi
movl 0xb0(%rsp), %eax
andl $0xff, %eax
movslq 0xb8(%rsp), %rdx
shlq $0x2, %rdx
movzbl %al, %esi
callq 0x1070
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movl $0xec, %edx
callq 0x10a0
movq 0xa8(%rsp), %rcx
movq 0xe8(%rsp), %rax
movq %rcx, 0xf0(%rax)
movl 0xb8(%rsp), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x4(%rax)
movl 0xb8(%rsp), %ecx
subl $0x1, %ecx
movq 0xa8(%rsp), %rax
movl %ecx, (%rax)
movl 0xb4(%rsp), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x10(%rax)
movl 0xd4(%rsp), %eax
addl $0x1, %eax
cmpl 0xb8(%rsp), %eax
jle 0x1681
movl 0xd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc8(%rsp)
jmp 0x168f
movl 0xb8(%rsp), %eax
movl %eax, 0xc8(%rsp)
movq 0xa8(%rsp), %rax
movl 0x10(%rax), %edi
movq 0xa8(%rsp), %rax
movslq 0xbc(%rsp), %rcx
xorl 0x10(%rax,%rcx,4), %edi
movq 0xa8(%rsp), %rax
movl 0xb8(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
xorl 0x10(%rax,%rcx,4), %edi
callq 0x1ce0
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %edx
movq 0xa8(%rsp), %rax
movslq 0xbc(%rsp), %rcx
addl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xd4(%rsp), %eax
addl 0xc4(%rsp), %eax
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl %eax, 0xa0(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x98(%rsp)
movl 0xbc(%rsp), %eax
addl 0xc0(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x98(%rsp), %rax
movl %edx, %ecx
movl 0xa0(%rsp), %edx
movslq %ecx, %rcx
addl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xc4(%rsp), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x10(%rax)
movl $0x1, 0xd0(%rsp)
movl 0xc8(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xc8(%rsp)
movl $0x1, 0xd0(%rsp)
movl $0x0, 0xcc(%rsp)
movl 0xcc(%rsp), %ecx
xorl %eax, %eax
cmpl 0xc8(%rsp), %ecx
movb %al, 0x97(%rsp)
jge 0x17cc
movl 0xcc(%rsp), %eax
cmpl 0xd4(%rsp), %eax
setl %al
movb %al, 0x97(%rsp)
movb 0x97(%rsp), %al
testb $0x1, %al
jne 0x17dc
jmp 0x1970
movq 0xa8(%rsp), %rax
movslq 0xd0(%rsp), %rcx
movl 0x10(%rax,%rcx,4), %edi
movq 0xa8(%rsp), %rax
movq %rax, 0x68(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x68(%rsp), %rax
movslq %edx, %rcx
xorl 0x10(%rax,%rcx,4), %edi
movq 0xa8(%rsp), %rax
movq %rax, 0x70(%rsp)
movl 0xd0(%rsp), %eax
addl 0xb8(%rsp), %eax
subl $0x1, %eax
cltd
idivl 0xb8(%rsp)
movq 0x70(%rsp), %rax
movslq %edx, %rcx
xorl 0x10(%rax,%rcx,4), %edi
callq 0x1ce0
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl %eax, 0x84(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x78(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x78(%rsp), %rax
movl %edx, %ecx
movl 0x84(%rsp), %edx
movslq %ecx, %rcx
addl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movq 0xd8(%rsp), %rax
movslq 0xcc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
addl 0xd0(%rsp), %eax
addl 0xc4(%rsp), %eax
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl %eax, 0x90(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x88(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
addl 0xc0(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x88(%rsp), %rax
movl %edx, %ecx
movl 0x90(%rsp), %edx
movslq %ecx, %rcx
addl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xc4(%rsp), %edx
movq 0xa8(%rsp), %rax
movslq 0xd0(%rsp), %rcx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xd0(%rsp), %eax
addl $0x1, %eax
cltd
idivl 0xb8(%rsp)
movl %edx, 0xd0(%rsp)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x179b
jmp 0x1972
movl 0xcc(%rsp), %eax
cmpl 0xc8(%rsp), %eax
jge 0x1af5
movq 0xa8(%rsp), %rax
movslq 0xd0(%rsp), %rcx
movl 0x10(%rax,%rcx,4), %edi
movq 0xa8(%rsp), %rax
movq %rax, 0x38(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x38(%rsp), %rax
movslq %edx, %rcx
xorl 0x10(%rax,%rcx,4), %edi
movq 0xa8(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0xd0(%rsp), %eax
addl 0xb8(%rsp), %eax
subl $0x1, %eax
cltd
idivl 0xb8(%rsp)
movq 0x40(%rsp), %rax
movslq %edx, %rcx
xorl 0x10(%rax,%rcx,4), %edi
callq 0x1ce0
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x48(%rsp), %rax
movl %edx, %ecx
movl 0x54(%rsp), %edx
movslq %ecx, %rcx
addl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xd0(%rsp), %eax
addl 0xc4(%rsp), %eax
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl %eax, 0x64(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x58(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
addl 0xc0(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x58(%rsp), %rax
movl %edx, %ecx
movl 0x64(%rsp), %edx
movslq %ecx, %rcx
addl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xc4(%rsp), %edx
movq 0xa8(%rsp), %rax
movslq 0xd0(%rsp), %rcx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xd0(%rsp), %eax
addl $0x1, %eax
cltd
idivl 0xb8(%rsp)
movl %edx, 0xd0(%rsp)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x1972
movl $0x0, 0xcc(%rsp)
movl 0xcc(%rsp), %eax
cmpl 0xb8(%rsp), %eax
jge 0x1c85
movq 0xa8(%rsp), %rax
movslq 0xd0(%rsp), %rcx
movl 0x10(%rax,%rcx,4), %edi
movq 0xa8(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x8(%rsp), %rax
movslq %edx, %rcx
addl 0x10(%rax,%rcx,4), %edi
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsp)
movl 0xd0(%rsp), %eax
addl 0xb8(%rsp), %eax
subl $0x1, %eax
cltd
idivl 0xb8(%rsp)
movq 0x10(%rsp), %rax
movslq %edx, %rcx
addl 0x10(%rax,%rcx,4), %edi
callq 0x1d00
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x18(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x18(%rsp), %rax
movl %edx, %ecx
movl 0x24(%rsp), %edx
movslq %ecx, %rcx
xorl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xd0(%rsp), %ecx
movl 0xc4(%rsp), %eax
subl %ecx, %eax
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x28(%rsp)
movl 0xd0(%rsp), %eax
addl 0xbc(%rsp), %eax
addl 0xc0(%rsp), %eax
cltd
idivl 0xb8(%rsp)
movq 0x28(%rsp), %rax
movl %edx, %ecx
movl 0x34(%rsp), %edx
movslq %ecx, %rcx
xorl 0x10(%rax,%rcx,4), %edx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xc4(%rsp), %edx
movq 0xa8(%rsp), %rax
movslq 0xd0(%rsp), %rcx
movl %edx, 0x10(%rax,%rcx,4)
movl 0xd0(%rsp), %eax
addl $0x1, %eax
cltd
idivl 0xb8(%rsp)
movl %edx, 0xd0(%rsp)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x1b00
movq 0xa8(%rsp), %rax
movl 0xb8(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpl $0x0, 0x10(%rax,%rcx,4)
jne 0x1cbe
movq 0xa8(%rsp), %rax
movl 0xb8(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl $0x4d544750, 0x10(%rax,%rcx,4) # imm = 0x4D544750
movl $0x0, 0xf4(%rsp)
movl 0xf4(%rsp), %eax
addq $0xf8, %rsp
retq
nopl (%rax,%rax)