// File: /workspace/github_cpp_makefile_star2_O1/CK7[P]abawaca/src/TinyMT-src-1.0.1/tinymt/tinymt32.c
// Function: tinymt32_init_by_array(TINYMT32_T*, unsigned int*, int)
void tinymt32_init_by_array(tinymt32_t * random, uint32_t init_key[],
			    int key_length) {
    const int lag = 1;
    const int mid = 1;
    const int size = 4;
    int i, j;
    int count;
    uint32_t r;
    uint32_t * st = &random->status[0];

    st[0] = 0;
    st[1] = random->mat1;
    st[2] = random->mat2;
    st[3] = random->tmat;
    if (key_length + 1 > MIN_LOOP) {
	count = key_length + 1;
    } else {
	count = MIN_LOOP;
    }
    r = ini_func1(st[0] ^ st[mid % size]
		  ^ st[(size - 1) % size]);
    st[mid % size] += r;
    r += key_length;
    st[(mid + lag) % size] += r;
    st[0] = r;
    count--;
    for (i = 1, j = 0; (j < count) && (j < key_length); j++) {
	r = ini_func1(st[i] ^ st[(i + mid) % size] ^ st[(i + size - 1) % size]);
	st[(i + mid) % size] += r;
	r += init_key[j] + i;
	st[(i + mid + lag) % size] += r;
	st[i] = r;
	i = (i + 1) % size;
    }
    for (; j < count; j++) {
	r = ini_func1(st[i] ^ st[(i + mid) % size] ^ st[(i + size - 1) % size]);
	st[(i + mid) % size] += r;
	r += i;
	st[(i + mid + lag) % size] += r;
	st[i] = r;
	i = (i + 1) % size;
    }
    for (j = 0; j < size; j++) {
	r = ini_func2(st[i] + st[(i + mid) % size] + st[(i + size - 1) % size]);
	st[(i + mid) % size] ^= r;
	r -= i;
	st[(i + mid + lag) % size] ^= r;
	st[i] = r;
	i = (i + 1) % size;
    }
    period_certification(random);
    for (i = 0; i < PRE_LOOP; i++) {
	tinymt32_next_state(random);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x10(%rdi), %ecx
movl 0x18(%rdi), %edi
movl %edi, 0xc(%rbx)
cmpl $0x8, %edx
movl $0x7, %eax
cmovgel %edx, %eax
xorl %ecx, %edi
movl %edi, %r8d
shrl $0x1b, %r8d
xorl %edi, %r8d
imull $0x19660d, %r8d, %edi   # imm = 0x19660D
addl %edi, %ecx
movl %ecx, 0x4(%rbx)
addl %edx, %edi
movl 0x14(%rbx), %ecx
addl %edi, %ecx
movl %ecx, 0x8(%rbx)
movl %edi, (%rbx)
testl %edx, %edx
jle 0xbc65
movl %edx, %edi
movl $0x1, %ecx
xorl %edx, %edx
movslq %ecx, %r8
leal 0x1(%r8), %ecx
leal 0x4(%r8), %r9d
testl %ecx, %ecx
cmovnsl %ecx, %r9d
andl $-0x4, %r9d
leal 0x3(%r8), %ecx
leal 0x6(%r8), %r10d
negl %r9d
testl %ecx, %ecx
cmovnsl %ecx, %r10d
movl (%rbx,%r8,4), %r11d
leal (%r8,%r9), %ecx
incl %ecx
andl $-0x4, %r10d
negl %r10d
movslq %ecx, %r9
addl %r8d, %r10d
addl $0x3, %r10d
movslq %r10d, %r10
xorl (%rbx,%r10,4), %r11d
movl (%rbx,%r9,4), %r10d
xorl %r10d, %r11d
movl %r11d, %r14d
shrl $0x1b, %r14d
xorl %r11d, %r14d
imull $0x19660d, %r14d, %r11d # imm = 0x19660D
addl %r11d, %r10d
movl %r10d, (%rbx,%r9,4)
movl (%rsi,%rdx,4), %r9d
addl %r8d, %r9d
leal 0x2(%r8), %r10d
addl %r11d, %r9d
leal 0x5(%r8), %r11d
testl %r10d, %r10d
cmovnsl %r10d, %r11d
andl $-0x4, %r11d
negl %r11d
leal (%r8,%r11), %r10d
addl $0x2, %r10d
movslq %r10d, %r10
addl %r9d, (%rbx,%r10,4)
movl %r9d, (%rbx,%r8,4)
incq %rdx
cmpq %rdx, %rdi
jne 0xbbbd
jmp 0xbc6c
movl $0x1, %ecx
xorl %edx, %edx
subl %edx, %eax
jbe 0xbd06
movslq %ecx, %rdx
movl (%rbx,%rdx,4), %esi
leal 0x1(%rdx), %ecx
leal 0x4(%rdx), %edi
testl %ecx, %ecx
cmovnsl %ecx, %edi
andl $-0x4, %edi
negl %edi
leal (%rdx,%rdi), %ecx
incl %ecx
movslq %ecx, %rdi
movl (%rbx,%rdi,4), %r8d
leal 0x3(%rdx), %r9d
leal 0x6(%rdx), %r10d
testl %r9d, %r9d
cmovnsl %r9d, %r10d
andl $-0x4, %r10d
negl %r10d
leal (%rdx,%r10), %r9d
addl $0x3, %r9d
movslq %r9d, %r9
xorl (%rbx,%r9,4), %esi
xorl %r8d, %esi
movl %esi, %r9d
shrl $0x1b, %r9d
xorl %esi, %r9d
imull $0x19660d, %r9d, %esi   # imm = 0x19660D
addl %esi, %r8d
addl %edx, %esi
leal 0x2(%rdx), %r9d
leal 0x5(%rdx), %r10d
testl %r9d, %r9d
cmovnsl %r9d, %r10d
movl %r8d, (%rbx,%rdi,4)
andl $-0x4, %r10d
negl %r10d
leal (%rdx,%r10), %edi
addl $0x2, %edi
movslq %edi, %rdi
addl %esi, (%rbx,%rdi,4)
movl %esi, (%rbx,%rdx,4)
decl %eax
jne 0xbc74
movl $0x4, %eax
movslq %ecx, %rdx
leal 0x1(%rdx), %ecx
leal 0x4(%rdx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
andl $-0x4, %esi
negl %esi
leal (%rdx,%rsi), %ecx
incl %ecx
movslq %ecx, %rsi
movl (%rbx,%rdx,4), %r8d
movl (%rbx,%rsi,4), %edi
addl %edi, %r8d
leal 0x3(%rdx), %r9d
leal 0x6(%rdx), %r10d
testl %r9d, %r9d
cmovnsl %r9d, %r10d
andl $-0x4, %r10d
negl %r10d
leal (%rdx,%r10), %r9d
addl $0x3, %r9d
movslq %r9d, %r9
addl (%rbx,%r9,4), %r8d
movl %r8d, %r9d
shrl $0x1b, %r9d
xorl %r8d, %r9d
imull $0x5d588b65, %r9d, %r8d # imm = 0x5D588B65
xorl %r8d, %edi
leal 0x2(%rdx), %r9d
subl %edx, %r8d
leal 0x5(%rdx), %r10d
testl %r9d, %r9d
cmovnsl %r9d, %r10d
andl $-0x4, %r10d
negl %r10d
leal (%rdx,%r10), %r9d
addl $0x2, %r9d
movl %edi, (%rbx,%rsi,4)
movslq %r9d, %rsi
xorl %r8d, (%rbx,%rsi,4)
movl %r8d, (%rbx,%rdx,4)
decl %eax
jne 0xbd0b
movq %rbx, %rdi
callq 0xbb3f
movl 0x10(%rbx), %eax
movl 0x14(%rbx), %edx
movl 0xc(%rbx), %ecx
movl (%rbx), %r10d
movl 0x4(%rbx), %r9d
movl 0x8(%rbx), %edi
movl $0x8, %esi
movl %r9d, %r8d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
xorl %edi, %r9d
xorl %r10d, %r9d
leal (%r9,%r9), %r10d
xorl %r9d, %r10d
movl %ecx, %r9d
shrl %r9d
xorl %r9d, %ecx
xorl %r10d, %ecx
movl %ecx, %r11d
andl $0x1, %r11d
negl %r11d
movl %eax, %r9d
andl %r11d, %r9d
xorl %edi, %r9d
movl %ecx, %edi
shll $0xa, %edi
andl %edx, %r11d
xorl %r10d, %edi
xorl %r11d, %edi
movl %r8d, %r10d
decl %esi
jne 0xbdc0
movl %ecx, 0xc(%rbx)
movl %r8d, (%rbx)
movl %r9d, 0x4(%rbx)
movl %edi, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)