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