// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
pushq %rax
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 0xbb71
movl %edx, %edi
movl $0x1, %ecx
xorl %r8d, %r8d
movslq %ecx, %r9
leal 0x1(%r9), %ecx
leal 0x4(%r9), %r10d
testl %ecx, %ecx
cmovnsl %ecx, %r10d
andl $-0x4, %r10d
leal 0x3(%r9), %ecx
leal 0x6(%r9), %r11d
negl %r10d
testl %ecx, %ecx
cmovnsl %ecx, %r11d
movl (%rbx,%r9,4), %r14d
leal (%r9,%r10), %ecx
incl %ecx
andl $-0x4, %r11d
negl %r11d
movslq %ecx, %r10
addl %r9d, %r11d
addl $0x3, %r11d
movslq %r11d, %r11
xorl (%rbx,%r11,4), %r14d
movl (%rbx,%r10,4), %r11d
xorl %r11d, %r14d
movl %r14d, %r15d
shrl $0x1b, %r15d
xorl %r14d, %r15d
imull $0x19660d, %r15d, %r14d # imm = 0x19660D
addl %r14d, %r11d
movl %r11d, (%rbx,%r10,4)
movl (%rsi,%r8,4), %r10d
addl %r9d, %r10d
leal 0x2(%r9), %r11d
addl %r14d, %r10d
leal 0x5(%r9), %r14d
testl %r11d, %r11d
cmovnsl %r11d, %r14d
andl $-0x4, %r14d
negl %r14d
leal (%r9,%r14), %r11d
addl $0x2, %r11d
movslq %r11d, %r11
addl %r10d, (%rbx,%r11,4)
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpq %r8, %rdi
jne 0xbac1
cmpl $0x6, %edx
jle 0xbb78
jmp 0xbc0c
xorl %edx, %edx
movl $0x1, %ecx
subl %edx, %eax
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 0xbb7a
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 0xbc11
movq %rbx, %rdi
callq 0xba3f
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 0xbcc6
movl %ecx, 0xc(%rbx)
movl %r8d, (%rbx)
movl %r9d, 0x4(%rbx)
movl %edi, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)