// File: /workspace/github_cpp_makefile_star2_O3/kobanium[P]Ray/src/feature/Nakade.cpp
// Function: InitializeNakadeHash()
void
InitializeNakadeHash( void )
{
  int nakade3[6][3], nakade4[5][4], nakade5[9][5], nakade6[4][6];

  start = board_max / 2;

  // 3目のナカデ
  nakade3[0][0] = 0; nakade3[0][1] = 1;              nakade3[0][2] = 2;
  nakade3[1][0] = 0; nakade3[1][1] = board_size;     nakade3[1][2] = 2 * board_size;
  nakade3[2][0] = 0; nakade3[2][1] = 1;              nakade3[2][2] = board_size + 1;
  nakade3[3][0] = 0; nakade3[3][1] = board_size - 1; nakade3[3][2] = board_size;
  nakade3[4][0] = 0; nakade3[4][1] = board_size;     nakade3[4][2] = board_size + 1;
  nakade3[5][0] = 0; nakade3[5][1] = 1;              nakade3[5][2] = board_size;

  // 4目のナカデ
  nakade4[0][0] = 0;              nakade4[0][1] = board_size - 1; 
  nakade4[0][2] = board_size;     nakade4[0][3] = board_size + 1;
  nakade4[1][0] = 0;              nakade4[1][1] = board_size - 1; 
  nakade4[1][2] = board_size;     nakade4[1][3] = 2 * board_size; 
  nakade4[2][0] = 0;              nakade4[2][1] = board_size; 
  nakade4[2][2] = board_size + 1; nakade4[2][3] = 2 * board_size;
  nakade4[3][0] = 0;              nakade4[3][1] = 1; 
  nakade4[3][2] = 2;              nakade4[3][3] = board_size + 1;
  nakade4[4][0] = 0;              nakade4[4][1] = 1; 
  nakade4[4][2] = board_size;     nakade4[4][3] = board_size + 1;

  // 5目のナカデ
  nakade5[0][0] = 0;                  nakade5[0][1] = board_size - 1; nakade5[0][2] = board_size;
  nakade5[0][3] = board_size + 1;     nakade5[0][4] = 2 * board_size;
  nakade5[1][0] = 0;                  nakade5[1][1] = board_size - 1; nakade5[1][2] = board_size;
  nakade5[1][3] = 2 * board_size - 1; nakade5[1][4] = 2 * board_size;
  nakade5[2][0] = 0;                  nakade5[2][1] = 1;              nakade5[2][2] = board_size;
  nakade5[2][3] = board_size + 1;     nakade5[2][4] = board_size + 2;
  nakade5[3][0] = 0;                  nakade5[3][1] = 1;              nakade5[3][2] = board_size;
  nakade5[3][3] = board_size + 1;     nakade5[3][4] = 2 * board_size;
  nakade5[4][0] = 0;                  nakade5[4][1] = 1;              nakade5[4][2] = 2;
  nakade5[4][3] = board_size + 1;     nakade5[4][4] = board_size + 2;
  nakade5[5][0] = 0;                  nakade5[5][1] = board_size;     nakade5[5][2] = board_size + 1;
  nakade5[5][3] = 2 * board_size;     nakade5[5][4] = 2 * board_size + 1;
  nakade5[6][0] = 0;                  nakade5[6][1] = 1;              nakade5[6][2] = 2;
  nakade5[6][3] = board_size;         nakade5[6][4] = board_size + 1;
  nakade5[7][0] = 0;                  nakade5[7][1] = 1;              nakade5[7][2] = board_size;
  nakade5[7][3] = board_size + 1;     nakade5[7][4] = 2 * board_size + 1;
  nakade5[8][0] = 0;                  nakade5[8][1] = 1;              nakade5[8][2] = board_size - 1;
  nakade5[8][3] = board_size;         nakade5[8][4] = board_size + 1;

  nakade6[0][0] = 0;                  nakade6[0][1] = board_size - 1;     
  nakade6[0][2] = board_size;         nakade6[0][3] = board_size + 1; 
  nakade6[0][4] = 2 * board_size - 1; nakade6[0][5] = 2 * board_size;
  nakade6[1][0] = 0;                  nakade6[1][1] = 1; 
  nakade6[1][2] = board_size;         nakade6[1][3] = board_size + 1; 
  nakade6[1][4] = board_size + 2;     nakade6[1][5] = 2 * board_size;
  nakade6[2][0] = 0;                  nakade6[2][1] = 1;
  nakade6[2][2] = board_size - 1;     nakade6[2][3] = board_size; 
  nakade6[2][4] = board_size + 1;     nakade6[2][5] = 2 * board_size;
  nakade6[3][0] = 0;                  nakade6[3][1] = board_size - 1; 
  nakade6[3][2] = board_size;         nakade6[3][3] = board_size + 1; 
  nakade6[3][4] = 2 * board_size;     nakade6[3][5] = 2 * board_size + 1;

  nakade_pos[0][0] = 1;
  nakade_pos[0][1] = board_size;
  nakade_pos[0][2] = 1;
  nakade_pos[0][3] = board_size;
  nakade_pos[0][4] = board_size;
  nakade_pos[0][5] = 0;

  nakade_pos[1][0] = board_size;
  nakade_pos[1][1] = board_size;
  nakade_pos[1][2] = board_size;
  nakade_pos[1][3] = 1;
  nakade_pos[1][4] = 0;

  nakade_pos[2][0] = board_size;
  nakade_pos[2][1] = board_size;
  nakade_pos[2][2] = board_size + 1;
  nakade_pos[2][3] = board_size;
  nakade_pos[2][4] = 1;
  nakade_pos[2][5] = board_size;
  nakade_pos[2][6] = 1;
  nakade_pos[2][7] = board_size + 1;
  nakade_pos[2][8] = board_size;

  nakade_pos[3][0] = board_size;
  nakade_pos[3][1] = board_size + 1;
  nakade_pos[3][2] = board_size;
  nakade_pos[3][3] = board_size;

  for (int i = 0; i < NAKADE_3; i++) {
    nakade_hash[0][i] = 0;
    for (int j = 0; j < 3; j++) {
      nakade_hash[0][i] ^= shape_bit[start + nakade3[i][j]];
    }
  }

  for (int i = 0; i < NAKADE_4; i++) {
    nakade_hash[1][i] = 0;
    for (int j = 0; j < 4; j++) {
      nakade_hash[1][i] ^= shape_bit[start + nakade4[i][j]];
    }
  }

  for (int i = 0; i < NAKADE_5; i++) {
    nakade_hash[2][i] = 0;
    for (int j = 0; j < 5; j++) {
      nakade_hash[2][i] ^= shape_bit[start + nakade5[i][j]];
    }
  }

  for (int i = 0; i < NAKADE_6; i++) {
    nakade_hash[3][i] = 0;
    for (int j = 0; j < 6; j++) {
      nakade_hash[3][i] ^= shape_bit[start + nakade6[i][j]];
    }
  }

  // 初期化
  for (int i = 0; i < PAT3_MAX; i++) {
    nakade_pat3_mask[i] = 0xffff;
  }

  // ナカデが出現しないパターンの初期化
  for (int i = 0; i < 134; i++) {
    unsigned int tmp_pat3[16];
    Pat3Transpose16(nakade_none[i], tmp_pat3);
    for (int j = 0; j < 16; j++) {
      nakade_pat3_mask[tmp_pat3[j]] = 0;
    }
  }

  // ナカデが出現しうるパターンの初期化
  for (int i = 0; i < 446; i++) {
    unsigned int tmp_pat3[16], tmp_mask[16];
    Pat3Transpose16(nakade_mask[i][0], tmp_pat3);
    Pat3Transpose16(nakade_mask[i][1], tmp_mask);
    for (int j = 0; j < 16; j++) {
      nakade_pat3_mask[tmp_pat3[j]] = tmp_mask[j];
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
leaq 0x1d8b8(%rip), %rax     # 0x768b8
movl (%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl %ecx, 0x1d8c7(%rip)     # 0x768d8
movaps 0x8088(%rip), %xmm0     # 0x610a0
leaq 0x1f0(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x1d892(%rip), %rdx     # 0x768bc
movl (%rdx), %esi
movl %esi, 0x10(%rax)
leal (%rsi,%rsi), %r10d
movl %r10d, 0x14(%rax)
movabsq $0x100000000, %rdi      # imm = 0x100000000
movq %rdi, 0x18(%rax)
leal 0x1(%rsi), %r8d
movl %r8d, 0x20(%rax)
xorl %ecx, %ecx
movl %ecx, 0x24(%rax)
leal -0x1(%rsi), %r9d
movl %r9d, 0x28(%rax)
movl %esi, 0x2c(%rax)
movl %ecx, 0x30(%rax)
movl %esi, 0x34(%rax)
movl %r8d, 0x38(%rax)
movq %rdi, 0x3c(%rax)
movl %esi, 0x44(%rax)
movl %ecx, 0x60(%rsp)
movl %r9d, 0x64(%rsp)
movl %esi, 0x68(%rsp)
movl %r8d, 0x6c(%rsp)
movl %ecx, 0x70(%rsp)
movl %r9d, 0x74(%rsp)
movl %esi, 0x78(%rsp)
movl %r10d, 0x7c(%rsp)
movl %ecx, 0x80(%rsp)
movl %esi, 0x84(%rsp)
movl %r8d, 0x88(%rsp)
movl %r10d, 0x8c(%rsp)
movq %rdi, 0x90(%rsp)
movl $0x2, %r11d
movl %r11d, 0x98(%rsp)
movl %r8d, 0x9c(%rsp)
movq %rdi, 0xa0(%rsp)
movl %esi, 0xa8(%rsp)
movl %r8d, 0xac(%rsp)
movl %ecx, 0xb0(%rsp)
movl %r9d, 0xb4(%rsp)
movl %esi, 0xb8(%rsp)
movl %r8d, 0xbc(%rsp)
movl %r10d, 0xc0(%rsp)
movl %ecx, 0xc4(%rsp)
movl %r9d, 0xc8(%rsp)
movl %esi, 0xcc(%rsp)
leal -0x1(%rsi,%rsi), %ebp
movl %ebp, 0xd0(%rsp)
movl %r10d, 0xd4(%rsp)
movq %rdi, 0xd8(%rsp)
movl %esi, 0xe0(%rsp)
movl %r8d, 0xe4(%rsp)
leal (%rsi,%r11), %r14d
movl %r14d, 0xe8(%rsp)
movq %rdi, 0xec(%rsp)
movl %esi, 0xf4(%rsp)
movl %r8d, 0xf8(%rsp)
movl %r10d, 0xfc(%rsp)
movq %rdi, 0x100(%rsp)
movl %r11d, 0x108(%rsp)
movl %r8d, 0x10c(%rsp)
movl %r14d, 0x110(%rsp)
movl %ecx, 0x114(%rsp)
movl %esi, 0x118(%rsp)
movl %r8d, 0x11c(%rsp)
movl %r10d, 0x120(%rsp)
movl $0x1, %ebx
movl %ecx, (%rsp)
movl %r9d, 0x4(%rsp)
movl %esi, 0x8(%rsp)
movl %r8d, 0xc(%rsp)
movl %ebp, 0x10(%rsp)
movl %r10d, 0x14(%rsp)
movq %rdi, 0x18(%rsp)
movl %esi, 0x20(%rsp)
movl %r8d, 0x24(%rsp)
movl %r14d, 0x28(%rsp)
movl %r10d, 0x2c(%rsp)
movq %rdi, 0x30(%rsp)
movl %r9d, 0x38(%rsp)
movl %esi, 0x3c(%rsp)
movl %r8d, 0x40(%rsp)
movl %r10d, 0x44(%rsp)
movl %ecx, 0x48(%rsp)
movl %r9d, 0x4c(%rsp)
movl %esi, 0x50(%rsp)
movl %r8d, 0x54(%rsp)
movl %r10d, 0x58(%rsp)
orl %ebx, %r10d
movl %r10d, 0x124(%rsp)
movq %rdi, 0x128(%rsp)
movl %r11d, 0x130(%rsp)
movl %esi, 0x134(%rsp)
movl %r8d, 0x138(%rsp)
movq %rdi, 0x13c(%rsp)
movl %esi, 0x144(%rsp)
movl %r8d, 0x148(%rsp)
movl %r10d, 0x14c(%rsp)
movq %rdi, 0x150(%rsp)
movl %r9d, 0x158(%rsp)
movl %esi, 0x15c(%rsp)
movl %r8d, 0x160(%rsp)
movl (%rdx), %edx
leal (%rdx,%rdx), %esi
orl %ebx, %esi
movl %esi, 0x5c(%rsp)
movl %ebx, 0x1c6dd46d(%rip)  # 0x1c736700
movl %edx, 0x1c6dd46b(%rip)  # 0x1c736704
movl %ebx, 0x1c6dd469(%rip)  # 0x1c736708
movl %edx, 0x1c6dd467(%rip)  # 0x1c73670c
movl %edx, 0x1c6dd465(%rip)  # 0x1c736710
movl %ecx, 0x1c6dd463(%rip)  # 0x1c736714
movl %edx, 0x1c6dd46d(%rip)  # 0x1c736724
movl %edx, 0x1c6dd46b(%rip)  # 0x1c736728
movl %edx, 0x1c6dd469(%rip)  # 0x1c73672c
movq $0x1, 0x1c6dd462(%rip) # 0x1c736730
movl %edx, 0x1c6dd474(%rip)  # 0x1c736748
movl %edx, 0x1c6dd472(%rip)  # 0x1c73674c
leal 0x1(%rdx), %esi
movl %esi, 0x1c6dd46d(%rip)  # 0x1c736750
movl %edx, 0x1c6dd46b(%rip)  # 0x1c736754
movl %ebx, 0x1c6dd469(%rip)  # 0x1c736758
movl %edx, 0x1c6dd467(%rip)  # 0x1c73675c
movl %ebx, 0x1c6dd465(%rip)  # 0x1c736760
movl %esi, 0x1c6dd463(%rip)  # 0x1c736764
movl %edx, 0x1c6dd461(%rip)  # 0x1c736768
movl %edx, 0x1c6dd45f(%rip)  # 0x1c73676c
movl %esi, 0x1c6dd45d(%rip)  # 0x1c736770
movl %edx, 0x1c6dd45b(%rip)  # 0x1c736774
movl %edx, 0x1c6dd459(%rip)  # 0x1c736778
movslq 0x1d5b2(%rip), %rdx     # 0x768d8
leaq 0x1c6db313(%rip), %rsi  # 0x1c734640
leaq 0x1c6dd45c(%rip), %rdi  # 0x1c736790
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rax,%r9,4), %r10
addq %rdx, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x3, %r9
jne 0x5933a
movq %r8, (%rdi,%rcx,8)
incq %rcx
addq $0xc, %rax
cmpq $0x6, %rcx
jne 0x59334
leaq 0x60(%rsp), %rax
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rax,%r9,4), %r10
addq %rdx, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x4, %r9
jne 0x5936c
movq %r8, 0x48(%rdi,%rcx,8)
incq %rcx
addq $0x10, %rax
cmpq $0x5, %rcx
jne 0x59366
leaq 0xb0(%rsp), %rax
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rax,%r9,4), %r10
addq %rdx, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x5, %r9
jne 0x593a2
movq %r8, 0x90(%rdi,%rcx,8)
incq %rcx
addq $0x14, %rax
cmpq $0x9, %rcx
jne 0x5939c
movq %rsp, %rax
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rax,%r9,4), %r10
addq %rdx, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x6, %r9
jne 0x593d6
movq %r8, 0xd8(%rdi,%rcx,8)
incq %rcx
addq $0x18, %rax
cmpq $0x4, %rcx
jne 0x593d0
xorl %eax, %eax
leaq 0x1c6dd4a8(%rip), %r15  # 0x1c7368b0
movaps 0x7ca1(%rip), %xmm0     # 0x610b0
movaps %xmm0, (%rax,%r15)
addq $0x10, %rax
cmpq $0x40000, %rax          # imm = 0x40000
jne 0x5940f
xorl %r14d, %r14d
leaq 0x8a96(%rip), %r12      # 0x61ec0
leaq 0x170(%rsp), %rbx
movl (%r12,%r14,4), %edi
movq %rbx, %rsi
callq 0x4f18c
xorl %eax, %eax
movl 0x170(%rsp,%rax,4), %ecx
movl $0x0, (%r15,%rcx,4)
incq %rax
cmpq $0x10, %rax
jne 0x59440
incq %r14
cmpq $0x86, %r14
jne 0x59432
xorl %r12d, %r12d
leaq 0x7c62(%rip), %r13      # 0x610d0
leaq 0x170(%rsp), %rbx
leaq 0x1b0(%rsp), %r14
movl (%r13,%r12,8), %edi
movl 0x4(%r13,%r12,8), %ebp
movq %rbx, %rsi
callq 0x4f18c
movl %ebp, %edi
movq %r14, %rsi
callq 0x4f18c
xorl %eax, %eax
movl 0x1b0(%rsp,%rax,4), %ecx
movl 0x170(%rsp,%rax,4), %edx
movl %ecx, (%r15,%rdx,4)
incq %rax
cmpq $0x10, %rax
jne 0x5949c
incq %r12
cmpq $0x1be, %r12            # imm = 0x1BE
jne 0x5947e
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq