// File: /workspace/github_cpp_makefile_star2_O1/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 0x1d1e0(%rip), %rax     # 0x758b8
movl (%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl %ecx, 0x1d1ef(%rip)     # 0x758d8
movaps 0x8720(%rip), %xmm0     # 0x60e10
leaq 0x1f0(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x1d1ba(%rip), %rdx     # 0x758bc
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, 0x1c6dcd95(%rip)  # 0x1c735700
movl %edx, 0x1c6dcd93(%rip)  # 0x1c735704
movl %ebx, 0x1c6dcd91(%rip)  # 0x1c735708
movl %edx, 0x1c6dcd8f(%rip)  # 0x1c73570c
movl %edx, 0x1c6dcd8d(%rip)  # 0x1c735710
movl %ecx, 0x1c6dcd8b(%rip)  # 0x1c735714
movl %edx, 0x1c6dcd95(%rip)  # 0x1c735724
movl %edx, 0x1c6dcd93(%rip)  # 0x1c735728
movl %edx, 0x1c6dcd91(%rip)  # 0x1c73572c
movq $0x1, 0x1c6dcd8a(%rip) # 0x1c735730
movl %edx, 0x1c6dcd9c(%rip)  # 0x1c735748
movl %edx, 0x1c6dcd9a(%rip)  # 0x1c73574c
leal 0x1(%rdx), %esi
movl %esi, 0x1c6dcd95(%rip)  # 0x1c735750
movl %edx, 0x1c6dcd93(%rip)  # 0x1c735754
movl %ebx, 0x1c6dcd91(%rip)  # 0x1c735758
movl %edx, 0x1c6dcd8f(%rip)  # 0x1c73575c
movl %ebx, 0x1c6dcd8d(%rip)  # 0x1c735760
movl %esi, 0x1c6dcd8b(%rip)  # 0x1c735764
movl %edx, 0x1c6dcd89(%rip)  # 0x1c735768
movl %edx, 0x1c6dcd87(%rip)  # 0x1c73576c
movl %esi, 0x1c6dcd85(%rip)  # 0x1c735770
movl %edx, 0x1c6dcd83(%rip)  # 0x1c735774
movl %edx, 0x1c6dcd81(%rip)  # 0x1c735778
movslq 0x1ceda(%rip), %rdi     # 0x758d8
leaq 0x1c6dcd8b(%rip), %rdx  # 0x1c735790
leaq 0x1c6dac34(%rip), %rsi  # 0x1c733640
movq $0x0, (%rdx,%rcx,8)
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rax,%r9,4), %r10
addq %rdi, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x3, %r9
jne 0x58a1a
movq %r8, (%rdx,%rcx,8)
incq %rcx
addq $0xc, %rax
cmpq $0x6, %rcx
jne 0x58a0c
movslq 0x1ce92(%rip), %rax     # 0x758d8
leaq 0x60(%rsp), %rcx
xorl %edi, %edi
movq $0x0, 0x48(%rdx,%rdi,8)
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rcx,%r9,4), %r10
addq %rax, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x4, %r9
jne 0x58a5c
movq %r8, 0x48(%rdx,%rdi,8)
incq %rdi
addq $0x10, %rcx
cmpq $0x5, %rdi
jne 0x58a4d
movslq 0x1ce4f(%rip), %rax     # 0x758d8
leaq 0xb0(%rsp), %rcx
xorl %edi, %edi
movq $0x0, 0x90(%rdx,%rdi,8)
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rcx,%r9,4), %r10
addq %rax, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x5, %r9
jne 0x58aa5
movq %r8, 0x90(%rdx,%rdi,8)
incq %rdi
addq $0x14, %rcx
cmpq $0x9, %rdi
jne 0x58a93
movslq 0x1ce03(%rip), %rax     # 0x758d8
movq %rsp, %rcx
xorl %edi, %edi
movq $0x0, 0xd8(%rdx,%rdi,8)
xorl %r9d, %r9d
xorl %r8d, %r8d
movslq (%rcx,%r9,4), %r10
addq %rax, %r10
xorq (%rsi,%r10,8), %r8
incq %r9
cmpq $0x6, %r9
jne 0x58aec
movq %r8, 0xd8(%rdx,%rdi,8)
incq %rdi
addq $0x18, %rcx
cmpq $0x4, %rdi
jne 0x58ada
xorl %eax, %eax
leaq 0x1c6dcd92(%rip), %r15  # 0x1c7358b0
movl $0xffff, (%rax,%r15)    # imm = 0xFFFF
addq $0x4, %rax
cmpq $0x40000, %rax          # imm = 0x40000
jne 0x58b1e
xorl %r14d, %r14d
leaq 0x90e4(%rip), %r12      # 0x61c20
leaq 0x170(%rsp), %rbx
movl (%r12,%r14,4), %edi
movq %rbx, %rsi
callq 0x4ee4c
xorl %eax, %eax
movl 0x170(%rsp,%rax,4), %ecx
movl $0x0, (%r15,%rcx,4)
incq %rax
cmpq $0x10, %rax
jne 0x58b52
incq %r14
cmpq $0x86, %r14
jne 0x58b44
xorl %r12d, %r12d
leaq 0x82b0(%rip), %r13      # 0x60e30
leaq 0x170(%rsp), %rbx
leaq 0x1b0(%rsp), %r14
movl (%r13,%r12,8), %edi
movl 0x4(%r13,%r12,8), %ebp
movq %rbx, %rsi
callq 0x4ee4c
movl %ebp, %edi
movq %r14, %rsi
callq 0x4ee4c
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 0x58bae
incq %r12
cmpq $0x1be, %r12            # imm = 0x1BE
jne 0x58b90
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq