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