// File: /workspace/github_cpp_makefile_star2_O1/kobanium[P]Ray/src/pattern/Pattern.cpp
// Function: ClearPattern(pattern_t*)
void
ClearPattern( pattern_t *pat )
{
  memset(pat, 0, sizeof(pattern_t) * board_max); 

  for (int y = board_start; y <= board_end; y++){
    // 1線
    // 上
    pat[POS(y, board_start)].list[MD_2] |= 0x0003003F;  // 1 2 3 9
    pat[POS(y, board_start)].list[MD_3] |= 0x00F0003F;  // 13 14 15 23 24
    pat[POS(y, board_start)].list[MD_4] |= 0xFC0000FF;  // 25 26 27 28 38 39 40
    pat[POS(y, board_start)].large_list[MD_5] |= 0xFF000003FF;
    // 右
    pat[POS(board_end, y)].list[MD_2] |= 0x000CC330;  // 3 5 8 10
    pat[POS(board_end, y)].list[MD_3] |= 0x00000FFC;  // 14 15 16 17 18
    pat[POS(board_end, y)].list[MD_4] |= 0x0000FFFC;  // 26 27 28 29 30 31 32
    pat[POS(board_end, y)].large_list[MD_5] |= 0x00000FFFFC;
    // 下
    pat[POS(y, board_end)].list[MD_2] |= 0x0030FC00;  // 6 7 8 11
    pat[POS(y, board_end)].list[MD_3] |= 0x0003FF00;  // 17 18 19 20 21
    pat[POS(y, board_end)].list[MD_4] |= 0x00FFFC00;  // 30 31 32 33 34 35 36
    pat[POS(y, board_end)].large_list[MD_5] |= 0x003FFFF000;
    // 左
    pat[POS(board_start, y)].list[MD_2] |= 0x00C00CC3;  // 1 4 6 12
    pat[POS(board_start, y)].list[MD_3] |= 0x00FFC000;  // 20 21 22 23 24
    pat[POS(board_start, y)].list[MD_4] |= 0xFFFC0000;  // 34 35 36 37 38 39 40
    pat[POS(board_start, y)].large_list[MD_5] |= 0xFFFFC00000;

    // 2線
    // 上
    pat[POS(y, board_start + 1)].list[MD_2] |= 0x00030000;  // 9
    pat[POS(y, board_start + 1)].list[MD_3] |= 0x00C0000F;  // 13 14 24
    pat[POS(y, board_start + 1)].list[MD_4] |= 0xF000003F;  // 25 26 27 39 40
    pat[POS(y, board_start + 1)].large_list[MD_5] |= 0xFC000000FF;
    // 右
    pat[POS(board_end - 1, y)].list[MD_2] |= 0x000C0000;  // 10
    pat[POS(board_end - 1, y)].list[MD_3] |= 0x000003F0;  // 15 16 17
    pat[POS(board_end - 1, y)].list[MD_4] |= 0x00003FF0;  // 27 28 29 30 31
    pat[POS(board_end - 1, y)].large_list[MD_5] |= 0x000003FFF0;
    // 下
    pat[POS(y, board_end - 1)].list[MD_2] |= 0x00300000;  // 11
    pat[POS(y, board_end - 1)].list[MD_3] |= 0x0000FC00;  // 18 19 20
    pat[POS(y, board_end - 1)].list[MD_4] |= 0x003FF000;  // 31 32 33 34 35
    pat[POS(y, board_end - 1)].large_list[MD_5] |= 0x000FFFC000;
    // 左
    pat[POS(board_start + 1, y)].list[MD_2] |= 0x00C00000;  // 12
    pat[POS(board_start + 1, y)].list[MD_3] |= 0x003F0000;  // 21 22 23
    pat[POS(board_start + 1, y)].list[MD_4] |= 0x3FF00000;  // 35 36 37 38 39
    pat[POS(board_start + 1, y)].large_list[MD_5] |= 0x3FFF000000;

    // 3線
    // 上
    pat[POS(y, board_start + 2)].list[MD_3] |= 0x00000003;  // 13
    pat[POS(y, board_start + 2)].list[MD_4] |= 0xC000000F;  // 25 26 40
    pat[POS(y, board_start + 2)].large_list[MD_5] |= 0xF00000003F;
    // 右
    pat[POS(board_end - 2, y)].list[MD_3] |= 0x000000C0;  // 16
    pat[POS(board_end - 2, y)].list[MD_4] |= 0x00000FC0;  // 28 29 30
    pat[POS(board_end - 2, y)].large_list[MD_5] |= 0x000000FFC0;
    // 下
    pat[POS(y, board_end - 2)].list[MD_3] |= 0x00003000;  // 19
    pat[POS(y, board_end - 2)].list[MD_4] |= 0x000FC000;  // 32 33 34
    pat[POS(y, board_end - 2)].large_list[MD_5] |= 0x0003FF0000;
    // 左
    pat[POS(board_start + 2, y)].list[MD_3] |= 0x000C0000;  // 22
    pat[POS(board_start + 2, y)].list[MD_4] |= 0x0FC00000;  // 36 37 38
    pat[POS(board_start + 2, y)].large_list[MD_5] |= 0x0FFC000000;

    // 4線 
    // 上
    pat[POS(y, board_start + 3)].list[MD_4] |= 0x00000003;  // 25
    pat[POS(y, board_start + 3)].large_list[MD_5] |= 0xC00000000F;
    // 右
    pat[POS(board_end - 3, y)].list[MD_4] |= 0x00000300;  // 29
    pat[POS(board_end - 3, y)].large_list[MD_5] |= 0x0000003F00;
    // 下
    pat[POS(y, board_end - 3)].list[MD_4] |= 0x00030000;  // 33
    pat[POS(y, board_end - 3)].large_list[MD_5] |= 0x0000FC0000;
    // 左
    pat[POS(board_start + 3, y)].list[MD_4] |= 0x03000000;  // 37
    pat[POS(board_start + 3, y)].large_list[MD_5] |= 0x03F0000000;

    // 5線
    // 上
    pat[POS(y, board_start + 4)].large_list[MD_5] |= 0x0000000003;
    // 右
    pat[POS(board_end - 4, y)].large_list[MD_5] |= 0x0000000C00;
    // 下
    pat[POS(y, board_end - 4)].large_list[MD_5] |= 0x0000300000;
    // 左
    pat[POS(board_start + 4, y)].large_list[MD_5] |= 0x00C0000000;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x28147(%rip), %rax     # 0x758b8
movslq (%rax), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x6210
leaq 0x28136(%rip), %rax     # 0x758c0
movslq (%rax), %rcx
leaq 0x28130(%rip), %rdx     # 0x758c4
cmpl (%rdx), %ecx
jg 0x4de36
leal -0x1(%rcx), %esi
movl %ecx, %edi
xorl %r8d, %r8d
leaq 0x28111(%rip), %r9      # 0x758bc
movl $0xc0000, %ebp          # imm = 0xC0000
movabsq $0x3f0000000, %r11      # imm = 0x3F0000000
movslq (%rax), %r10
movslq (%r9), %r15
imulq %r10, %r15
leaq (%rcx,%r8), %r14
addq %r14, %r15
leaq (%r15,%r15,2), %r10
orl $0x3003f, (%rbx,%r10,8) # imm = 0x3003F
movslq (%rax), %r10
movslq (%r9), %r15
imulq %r10, %r15
addq %r14, %r15
leaq (%r15,%r15,2), %r10
orl $0xf0003f, 0x4(%rbx,%r10,8) # imm = 0xF0003F
movslq (%rax), %r10
movslq (%r9), %r15
imulq %r10, %r15
addq %r14, %r15
leaq (%r15,%r15,2), %r10
orl $0xfc0000ff, 0x8(%rbx,%r10,8) # imm = 0xFC0000FF
movslq (%rax), %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
leal (%rdi,%r8), %r15d
movabsq $0xff000003ff, %r13     # imm = 0xFF000003FF
orq %r13, 0x10(%rbx,%r10,8)
movslq (%rdx), %r10
movslq %r15d, %r15
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xcc330, (%rbx,%r10,8) # imm = 0xCC330
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xffc, 0x4(%rbx,%r10,8) # imm = 0xFFC
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xfffc, 0x8(%rbx,%r10,8) # imm = 0xFFFC
movl (%rdx), %r10d
movl (%r9), %r12d
movl %r12d, %r13d
imull %r15d, %r13d
addl %r10d, %r13d
movslq %r13d, %r13
imull %r10d, %r12d
movslq %r12d, %r10
leaq (,%r13,2), %r12
addq %r13, %r12
addq %r14, %r10
orq $0xffffc, 0x10(%rbx,%r12,8) # imm = 0xFFFFC
leaq (%r10,%r10,2), %r10
orl $0x30fc00, (%rbx,%r10,8) # imm = 0x30FC00
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0x3ff00, 0x4(%rbx,%r10,8) # imm = 0x3FF00
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0xfffc00, 0x8(%rbx,%r10,8) # imm = 0xFFFC00
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
orq $0x3ffff000, 0x10(%rbx,%r10,8) # imm = 0x3FFFF000
movslq (%rax), %r10
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xc00cc3, (%rbx,%r10,8) # imm = 0xC00CC3
movslq (%rax), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xffc000, 0x4(%rbx,%r10,8) # imm = 0xFFC000
movslq (%rax), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xfffc0000, 0x8(%rbx,%r10,8) # imm = 0xFFFC0000
movl (%rax), %r10d
movl (%r9), %r12d
movl %r12d, %r13d
imull %r15d, %r13d
addl %r10d, %r13d
incl %r10d
movslq %r13d, %r13
imull %r12d, %r10d
movslq %r10d, %r10
addq %r14, %r10
leaq (,%r13,2), %r12
addq %r13, %r12
leaq (%r10,%r10,2), %r10
movabsq $0xffffc00000, %r13     # imm = 0xFFFFC00000
orq %r13, 0x10(%rbx,%r12,8)
orb $0x3, 0x2(%rbx,%r10,8)
movslq (%rax), %r10
incq %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0xc0000f, 0x4(%rbx,%r10,8) # imm = 0xC0000F
movslq (%rax), %r10
incq %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0xf000003f, 0x8(%rbx,%r10,8) # imm = 0xF000003F
movslq (%rax), %r10
incq %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
movabsq $0xfc000000ff, %r13     # imm = 0xFC000000FF
orq %r13, 0x10(%rbx,%r10,8)
movl (%rdx), %r10d
imull %r15d, %r12d
addl %r12d, %r10d
decl %r10d
movslq %r10d, %r10
leaq (%r10,%r10,2), %r10
orl %ebp, (%rbx,%r10,8)
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0x3f0, -0x14(%rbx,%r10,8) # imm = 0x3F0
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0x3ff0, -0x10(%rbx,%r10,8) # imm = 0x3FF0
movslq (%rdx), %r10
movl (%r9), %r12d
movl %r12d, %r13d
imull %r15d, %r13d
movslq %r13d, %r13
addq %r10, %r13
decq %r13
decq %r10
imull %r12d, %r10d
movslq %r10d, %r10
addq %r14, %r10
leaq (,%r13,2), %r12
addq %r13, %r12
leaq (%r10,%r10,2), %r10
orq $0x3fff0, 0x10(%rbx,%r12,8) # imm = 0x3FFF0
orb $0x30, 0x2(%rbx,%r10,8)
movslq (%rdx), %r10
decq %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0xfc00, 0x4(%rbx,%r10,8) # imm = 0xFC00
movslq (%rdx), %r10
decq %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0x3ff000, 0x8(%rbx,%r10,8) # imm = 0x3FF000
movslq (%rdx), %r10
decq %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
orq $0xfffc000, 0x10(%rbx,%r10,8) # imm = 0xFFFC000
movl (%rax), %r10d
imull %r15d, %r12d
addl %r12d, %r10d
incl %r10d
movslq %r10d, %r10
leaq (%r10,%r10,2), %r10
orl $0xc00000, (%rbx,%r10,8) # imm = 0xC00000
movslq (%rax), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0x3f0000, 0x1c(%rbx,%r10,8) # imm = 0x3F0000
movslq (%rax), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0x3ff00000, 0x20(%rbx,%r10,8) # imm = 0x3FF00000
movl (%r9), %r10d
movl (%rax), %r12d
movl %r10d, %r13d
imull %r15d, %r13d
addl %r12d, %r13d
incl %r13d
movslq %r13d, %r13
addl $0x2, %r12d
imull %r10d, %r12d
movslq %r12d, %r10
leaq (,%r13,2), %r12
addq %r13, %r12
addq %r14, %r10
movabsq $0x3fff000000, %r13     # imm = 0x3FFF000000
orq %r13, 0x10(%rbx,%r12,8)
leaq (%r10,%r10,2), %r10
orb $0x3, 0x4(%rbx,%r10,8)
movslq (%rax), %r10
addq $0x2, %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0xc000000f, 0x8(%rbx,%r10,8) # imm = 0xC000000F
movslq (%rax), %r10
addq $0x2, %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
movabsq $0xf00000003f, %r13     # imm = 0xF00000003F
orq %r13, 0x10(%rbx,%r10,8)
movl (%rdx), %r10d
imull %r15d, %r12d
addl %r12d, %r10d
addl $-0x2, %r10d
movslq %r10d, %r10
leaq (%r10,%r10,2), %r10
orl $0xc0, 0x4(%rbx,%r10,8)
movslq (%rdx), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xfc0, -0x28(%rbx,%r10,8) # imm = 0xFC0
movl (%r9), %r10d
movslq (%rdx), %r12
movl %r10d, %r13d
imull %r15d, %r13d
movslq %r13d, %r13
addq %r12, %r13
addq $-0x2, %r13
addq $-0x2, %r12
imull %r10d, %r12d
movslq %r12d, %r10
leaq (,%r13,2), %r12
addq %r13, %r12
addq %r14, %r10
orq $0xffc0, 0x10(%rbx,%r12,8) # imm = 0xFFC0
leaq (%r10,%r10,2), %r10
orb $0x30, 0x5(%rbx,%r10,8)
movslq (%rdx), %r10
addq $-0x2, %r10
movslq (%r9), %r12
imulq %r10, %r12
addq %r14, %r12
leaq (%r12,%r12,2), %r10
orl $0xfc000, 0x8(%rbx,%r10,8) # imm = 0xFC000
movslq (%rdx), %r10
addq $-0x2, %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
orq $0x3ff0000, 0x10(%rbx,%r10,8) # imm = 0x3FF0000
movl (%rax), %r10d
imull %r15d, %r12d
addl %r12d, %r10d
addl $0x2, %r10d
movslq %r10d, %r10
leaq (%r10,%r10,2), %r10
orl %ebp, 0x4(%rbx,%r10,8)
movslq (%rax), %r10
movslq (%r9), %r12
imulq %r15, %r12
addq %r10, %r12
leaq (%r12,%r12,2), %r10
orl $0xfc00000, 0x38(%rbx,%r10,8) # imm = 0xFC00000
movl (%rax), %r10d
movl (%r9), %r12d
movl %r12d, %r13d
imull %r15d, %r13d
addl %r10d, %r13d
addl $0x2, %r13d
addl $0x3, %r10d
movslq %r13d, %r13
imull %r12d, %r10d
movslq %r10d, %r10
addq %r14, %r10
leaq (,%r13,2), %r12
addq %r13, %r12
leaq (%r10,%r10,2), %r10
movabsq $0xffc000000, %r13      # imm = 0xFFC000000
orq %r13, 0x10(%rbx,%r12,8)
orb $0x3, 0x8(%rbx,%r10,8)
movslq (%rax), %r10
addq $0x3, %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
movabsq $0xc00000000f, %r13     # imm = 0xC00000000F
orq %r13, 0x10(%rbx,%r10,8)
movl (%rdx), %r10d
imull %r15d, %r12d
addl %r12d, %r10d
addl $-0x3, %r10d
movslq %r10d, %r10
leaq (%r10,%r10,2), %r10
orl $0x300, 0x8(%rbx,%r10,8) # imm = 0x300
movslq (%rdx), %r10
movl (%r9), %r12d
movl %r12d, %r13d
imull %r15d, %r13d
movslq %r13d, %r13
addq %r10, %r13
addq $-0x3, %r13
addq $-0x3, %r10
imull %r12d, %r10d
movslq %r10d, %r10
addq %r14, %r10
leaq (,%r13,2), %r12
addq %r13, %r12
leaq (%r10,%r10,2), %r10
orq $0x3f00, 0x10(%rbx,%r12,8) # imm = 0x3F00
orb $0x3, 0xa(%rbx,%r10,8)
movslq (%rdx), %r10
addq $-0x3, %r10
movslq (%r9), %r12
imulq %r12, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
orq $0xfc0000, 0x10(%rbx,%r10,8) # imm = 0xFC0000
movl (%rax), %r10d
imull %r15d, %r12d
addl %r12d, %r10d
addl $0x3, %r10d
movslq %r10d, %r10
leaq (%r10,%r10,2), %r10
orl $0x3000000, 0x8(%rbx,%r10,8) # imm = 0x3000000
movl (%r9), %r12d
movl (%rax), %r10d
movl %r12d, %r13d
imull %r15d, %r13d
leal (%r10,%r13), %r15d
addl $0x3, %r15d
movslq %r15d, %r15
leaq (%r15,%r15,2), %r15
orq %r11, 0x10(%rbx,%r15,8)
leal (%r10,%r13), %r15d
addl $0x4, %r15d
addl $0x4, %r10d
imull %r12d, %r10d
movslq %r10d, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
orb $0x3, 0x10(%rbx,%r10,8)
movslq (%rdx), %r10
movslq %r13d, %r13
addq %r10, %r13
addq $-0x4, %r13
leaq (%r13,%r13,2), %r13
orq $0xc00, 0x10(%rbx,%r13,8) # imm = 0xC00
addq $-0x4, %r10
imull %r12d, %r10d
movslq %r10d, %r10
addq %r14, %r10
leaq (%r10,%r10,2), %r10
orb $0x30, 0x12(%rbx,%r10,8)
movslq %r15d, %r10
leaq (%r10,%r10,2), %r10
orb $-0x40, 0x13(%rbx,%r10,8)
incq %r8
leal (%rsi,%r8), %r10d
cmpl (%rdx), %r10d
jl 0x4d7ba
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq