// File: tanakh[P]icfpc2015/main.cpp
// Function: init_by_array(unsigned long*, int)
void init_by_array(unsigned long init_key[], int key_length)
{
    int i, j, k;
    init_genrand(19650218UL);
    i=1; j=0;
    k = (N>key_length ? N : key_length);
    for (; k; k--) {
        mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
          + init_key[j] + j; /* non linear */
        mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
        i++; j++;
        if (i>=N) { mt[0] = mt[N-1]; i=1; }
        if (j>=key_length) j=0;
    }
    for (k=N-1; k; k--) {
        mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
          - i; /* non linear */
        mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
        i++;
        if (i>=N) { mt[0] = mt[N-1]; i=1; }
    }

    mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl $0x12bd6aa, %edi        # imm = 0x12BD6AA
callq 0x4950
movl $0x1, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x270, %eax            # imm = 0x270
cmpl 0x1c(%rsp), %eax
jle 0x4a5d
movl $0x270, %eax            # imm = 0x270
movl %eax, 0xc(%rsp)
jmp 0x4a65
movl 0x1c(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
je 0x4b68
movslq 0x18(%rsp), %rcx
leaq 0x4595c(%rip), %rax     # 0x4a3e0
movq (%rax,%rcx,8), %rdx
movl 0x18(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x45947(%rip), %rax     # 0x4a3e0
movq (%rax,%rcx,8), %rax
movl 0x18(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rsi
leaq 0x45932(%rip), %rcx     # 0x4a3e0
movq (%rcx,%rsi,8), %rcx
shrq $0x1e, %rcx
xorq %rcx, %rax
imulq $0x19660d, %rax, %rax   # imm = 0x19660D
xorq %rax, %rdx
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
addq (%rax,%rcx,8), %rdx
movslq 0x14(%rsp), %rax
addq %rax, %rdx
movslq 0x18(%rsp), %rcx
leaq 0x458fb(%rip), %rax     # 0x4a3e0
movq %rdx, (%rax,%rcx,8)
movslq 0x18(%rsp), %rcx
leaq 0x458eb(%rip), %rax     # 0x4a3e0
movabsq $0xffffffff, %rdx       # imm = 0xFFFFFFFF
andq (%rax,%rcx,8), %rdx
leaq 0x458d6(%rip), %rax     # 0x4a3e0
movq %rdx, (%rax,%rcx,8)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
cmpl $0x270, 0x18(%rsp)      # imm = 0x270
jl 0x4b44
movq 0x46c23(%rip), %rax     # 0x4b758
movq %rax, 0x458a4(%rip)     # 0x4a3e0
movl $0x1, 0x18(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jl 0x4b56
movl $0x0, 0x14(%rsp)
jmp 0x4b58
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x4a6d
movl $0x26f, 0x10(%rsp)      # imm = 0x26F
cmpl $0x0, 0x10(%rsp)
je 0x4c40
movslq 0x18(%rsp), %rcx
leaq 0x45859(%rip), %rax     # 0x4a3e0
movq (%rax,%rcx,8), %rdx
movl 0x18(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x45844(%rip), %rax     # 0x4a3e0
movq (%rax,%rcx,8), %rax
movl 0x18(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rsi
leaq 0x4582f(%rip), %rcx     # 0x4a3e0
movq (%rcx,%rsi,8), %rcx
shrq $0x1e, %rcx
xorq %rcx, %rax
imulq $0x5d588b65, %rax, %rax # imm = 0x5D588B65
xorq %rax, %rdx
movslq 0x18(%rsp), %rax
subq %rax, %rdx
movslq 0x18(%rsp), %rcx
leaq 0x45806(%rip), %rax     # 0x4a3e0
movq %rdx, (%rax,%rcx,8)
movslq 0x18(%rsp), %rcx
leaq 0x457f6(%rip), %rax     # 0x4a3e0
movabsq $0xffffffff, %rdx       # imm = 0xFFFFFFFF
andq (%rax,%rcx,8), %rdx
leaq 0x457e1(%rip), %rax     # 0x4a3e0
movq %rdx, (%rax,%rcx,8)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
cmpl $0x270, 0x18(%rsp)      # imm = 0x270
jl 0x4c2e
movq 0x46b39(%rip), %rax     # 0x4b758
movq %rax, 0x457ba(%rip)     # 0x4a3e0
movl $0x1, 0x18(%rsp)
jmp 0x4c30
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x4b70
movl $0x80000000, %eax       # imm = 0x80000000
movq %rax, 0x45794(%rip)     # 0x4a3e0
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)