// File: /workspace/github_c_makefile_star2_O0/sTeeLM[P]dwipe/mt19937ar-cok.c
// Function: twister_init
void twister_init( twister_state_t* state, unsigned long init_key[], unsigned long key_length )
{
    int i = 1;
	 int j = 0;
    int k = ( N > key_length ? N : key_length );

    init_genrand( state, 19650218UL );

    for( ; k; k-- )
	 {
		state->array[i] = (state->array[i] ^ ((state->array[i-1] ^ (state->array[i-1] >> 30)) * 1664525UL)) + init_key[j] + j;
		state->array[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
		++i;
		++j;

		if ( i >= N )
		{
			state->array[0] = state->array[N-1];
			i = 1;
		}

		if ( j >= key_length )
		{
			j = 0;
		}
    }

    for( k = N -1; k; k-- )
	 {
		state->array[i] = (state->array[i] ^ ((state->array[i-1] ^ (state->array[i-1] >> 30)) * 1566083941UL)) - i;
		state->array[i] &= 0xffffffffUL;
		++i;

		if ( i >= N )
		{
			state->array[0] = state->array[N-1];
			i = 1;
		}
    }

	state->array[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */ 
	state->left = 1;
	state->initf = 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movl $0x1, 0x1c(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x270, %eax            # imm = 0x270
cmpq 0x20(%rsp), %rax
jbe 0xc89b
movl $0x270, %eax            # imm = 0x270
movq %rax, 0x8(%rsp)
jmp 0xc8a5
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl %eax, 0x14(%rsp)
movq 0x30(%rsp), %rdi
movl $0x12bd6aa, %esi        # imm = 0x12BD6AA
callq 0xc790
cmpl $0x0, 0x14(%rsp)
je 0xc9af
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x30(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rsp), %rcx
movl 0x1c(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rcx,%rsi,8), %rcx
shrq $0x1e, %rcx
xorq %rcx, %rax
imulq $0x19660d, %rax, %rax   # imm = 0x19660D
xorq %rax, %rdx
movq 0x28(%rsp), %rax
movslq 0x18(%rsp), %rcx
addq (%rax,%rcx,8), %rdx
movslq 0x18(%rsp), %rax
addq %rax, %rdx
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movabsq $0xffffffff, %rdx       # imm = 0xFFFFFFFF
andq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
cmpl $0x270, 0x1c(%rsp)      # imm = 0x270
jl 0xc989
movq 0x30(%rsp), %rax
movq 0x1378(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movl $0x1, 0x1c(%rsp)
movslq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rax
jb 0xc99d
movl $0x0, 0x18(%rsp)
jmp 0xc99f
movl 0x14(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xc8bd
movl $0x26f, 0x14(%rsp)      # imm = 0x26F
cmpl $0x0, 0x14(%rsp)
je 0xca7c
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x30(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rsp), %rcx
movl 0x1c(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rcx,%rsi,8), %rcx
shrq $0x1e, %rcx
xorq %rcx, %rax
imulq $0x5d588b65, %rax, %rax # imm = 0x5D588B65
xorq %rax, %rdx
movslq 0x1c(%rsp), %rax
subq %rax, %rdx
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movabsq $0xffffffff, %rdx       # imm = 0xFFFFFFFF
andq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
cmpl $0x270, 0x1c(%rsp)      # imm = 0x270
jl 0xca6a
movq 0x30(%rsp), %rax
movq 0x1378(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movl $0x1, 0x1c(%rsp)
jmp 0xca6c
movl 0x14(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xc9b7
movq 0x30(%rsp), %rax
movl $0x80000000, %ecx       # imm = 0x80000000
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
movl $0x1, 0x1380(%rax)
movq 0x30(%rsp), %rax
movl $0x1, 0x1384(%rax)
addq $0x38, %rsp
retq
nopl (%rax)