// File: /workspace/github_cpp_makefile_star2_O3/tyhsu[P]Ewn/play.cpp
// Function: Play::contest_AI_mode()
void Play::contest_AI_mode()
{
    int is_right_upper_side;
    cout << "Whose AI is at the left upper section?" << endl;
    cout << "=>Who is A (1~6)? 0)Ours 1)Opponent's" << endl;
    cout << "Choose: ";
    cin >> is_right_upper_side;

    int is_init_board, is_switch;
    cout << "Do you need to set the board? 0)No 1)Yes" << endl;
    cout << "Choose: ";
    cin >> is_init_board;
    if (is_init_board == 1) {
        char board[5][5];
        do {
            cout << endl << "Please give values for the 5x5 array" << endl;
            char c;
            for (int i=0; i<5; i++) {
                for (int j=0; j<5; j++) {
                    cin >> c;
                    if (c == '0')
                        board[i][j] = 0;
                    else
                        board[i][j] = c;
                }
            }
            cout << "Are you ready to set the board? 0)No 1)Yes" << endl;
            cout << "Choose: ";
            cin >> is_init_board;
        } while (!is_init_board);

        cout << endl << "Whose turn is it now? 0)A 1)B" << endl;
        cout << "Choose: ";
        cin >> is_switch;
        this->game.set_board(board, is_switch);
    }
    cout << endl;
    this->game.print_board();

    EwnAI ewnAI;
    while (1) {
        int game_status;
        //The opponent's turn (A)
        if (is_right_upper_side && !this->game.get_is_switch()) {
            char chs_symbol;
            int direct;
            cout << endl << "Choose the chessman(1~6): ";
            cin >> chs_symbol;
            if (!(chs_symbol>='1' && chs_symbol<='6'))
                continue;

            cout << "Direction: 0)Right 1)Down 2)Right-down" << endl;
            cout << "Choose: ";
            cin >> direct;
            if (!(direct>=0 && direct<=2))
                continue;

            int is_recover;
            cout << "Do you want to recover? 0)No 1)Yes" << endl;
            cout << "Choose: ";
            cin >> is_recover;
            if (is_recover != 0)
                continue;

            game_status = this->game.update_game_status(make_pair(chs_symbol-'1', direct));
        }

        //The opponent's turn (B)
        else if (!is_right_upper_side && this->game.get_is_switch()) {
            char chs_symbol;
            int direct;
            cout << endl << "Choose the chessman(A~F): ";
            cin >> chs_symbol;
            if (!(chs_symbol>='A' && chs_symbol<='F'))
                continue;

            cout << "Direction: 0)Left 1)Up 2)Left-up" << endl;
            cout << "Choose: ";
            cin >> direct;
            if (!(direct>=0 && direct<=2))
                continue;

            int is_recover;
            cout << "Do you want to recover? 0)No 1)Yes" << endl;
            cout << "Choose: ";
            cin >> is_recover;
            if (is_recover != 0)
                continue;

            game_status = this->game.update_game_status(make_pair(chs_symbol-'A', direct));
        }

        //Our AI's turn
        else {
            char dice;
            cout << endl << "Set the dice(1~6): ";
            cin >> dice;
            if (!(dice>='1' && dice<='6'))
                continue;

            game_status = this->game.update_game_status(ewnAI.AI_move(this->game, dice-'1'));
        }

        this->game.print_board();
        //update: 0(game continues), 1(A wins), 2(B wins)
        if (game_status!=0) {
            cout << "====================================" << endl;
            if ((is_right_upper_side && game_status==1) || (!is_right_upper_side && game_status==2))
                cout << "The opponent is the winner!!!" << endl;
            else
                cout << "Our AI is the winner!!!" << endl;
            cout << "====================================" << endl;
            return;
        }
        this->game.switch_player();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3c8, %rsp            # imm = 0x3C8
movq %rdi, %rbx
movq 0x9c12(%rip), %r14      # 0xcfc8
leaq 0x5df0(%rip), %rsi      # 0x91ad
movl $0x26, %edx
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x5ddc(%rip), %rsi      # 0x91d4
movl $0x25, %edx
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x5c6e(%rip), %r15      # 0x90a1
movl $0x8, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2170
movq 0x9b8e(%rip), %r12      # 0xcfd8
leaq -0x40(%rbp), %rsi
movq %r12, %rdi
callq 0x20a0
leaq 0x5d9d(%rip), %rsi      # 0x91fa
movl $0x28, %edx
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2170
leaq -0x44(%rbp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x20a0
cmpl $0x1, (%r15)
jne 0x3687
movq %rbx, -0x50(%rbp)
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq %rax, %r15
movl $0x24, %edx
movq %rax, %rdi
leaq 0x5d2c(%rip), %rsi      # 0x9223
callq 0x2170
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq -0x300(%rbp), %r15
xorl %eax, %eax
movq %rax, -0x58(%rbp)
movq $-0x5, %rbx
xorl %r12d, %r12d
movq 0x9a97(%rip), %r13      # 0xcfd8
leaq -0x38(%rbp), %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0x2180
movzbl -0x38(%rbp), %eax
cmpb $0x30, %al
cmovel %r12d, %eax
movb %al, 0x5(%r15,%rbx)
incq %rbx
jne 0x3545
movq -0x58(%rbp), %rax
incq %rax
addq $0x5, %r15
cmpq $0x5, %rax
jne 0x352c
movl $0x2a, %edx
movq 0x9a47(%rip), %r14      # 0xcfc8
movq %r14, %rdi
leaq 0x5cbd(%rip), %rsi      # 0x9248
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %r14, %rdi
leaq 0x5adb(%rip), %rsi      # 0x90a1
callq 0x2170
movq 0x9a06(%rip), %rdi      # 0xcfd8
leaq -0x44(%rbp), %rsi
callq 0x20a0
cmpl $0x0, -0x44(%rbp)
je 0x34be
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq %rax, %r15
leaq 0x5c5d(%rip), %rsi      # 0x9273
movl $0x1d, %edx
movq %rax, %rdi
callq 0x2170
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x5a50(%rip), %rsi      # 0x90a1
movl $0x8, %edx
movq %r14, %rdi
callq 0x2170
movq 0x9973(%rip), %rdi      # 0xcfd8
leaq -0x5c(%rbp), %r15
movq %r15, %rsi
callq 0x20a0
movl (%r15), %edx
leaq -0x300(%rbp), %rsi
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x7a98
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x7be2
leaq -0x300(%rbp), %rdi
callq 0x4e6c
movq 0x990f(%rip), %r13      # 0xcfd8
leaq -0x30(%rbp), %r12
cmpl $0x0, -0x40(%rbp)
je 0x36ed
movq %rbx, %rdi
callq 0x855c
testb %al, %al
je 0x38ed
cmpl $0x0, -0x40(%rbp)
jne 0x3840
movq %rbx, %rdi
callq 0x855c
testb %al, %al
je 0x3840
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x1a, %edx
movq %rax, %rdi
leaq 0x5b9c(%rip), %rsi      # 0x92cf
callq 0x2170
movq %r13, %rdi
leaq -0x29(%rbp), %rsi
callq 0x2180
movb -0x29(%rbp), %al
addb $-0x41, %al
cmpb $0x6, %al
jae 0x36cd
movl $0x20, %edx
movq %r14, %rdi
leaq 0x59b8(%rip), %rsi      # 0x9114
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %r14, %rdi
leaq 0x590a(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
movq %r12, %rsi
callq 0x20a0
cmpl $0x2, -0x30(%rbp)
ja 0x36cd
movl $0x22, %edx
movq %r14, %rdi
leaq 0x5aec(%rip), %rsi      # 0x92ac
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %r14, %rdi
leaq 0x58a6(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x20a0
cmpl $0x0, -0x3c(%rbp)
jne 0x36cd
movsbl -0x29(%rbp), %eax
movl $0xffffffbf, %ecx       # imm = 0xFFFFFFBF
addl %ecx, %eax
movl -0x30(%rbp), %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
leaq -0x38(%rbp), %rsi
callq 0x7fea
jmp 0x38cc
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x13, %edx
movq %rax, %rdi
leaq 0x5a74(%rip), %rsi      # 0x92ea
callq 0x2170
movq %r13, %rdi
movq %r12, %rsi
callq 0x2180
movb -0x30(%rbp), %al
addb $-0x31, %al
cmpb $0x6, %al
jae 0x36cd
leaq -0x3e8(%rbp), %rdi
movq %rbx, %rsi
callq 0x78e2
movsbl -0x30(%rbp), %edx
addl $-0x31, %edx
leaq -0x300(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x54a0
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
leaq -0x38(%rbp), %rsi
callq 0x7fea
movl %eax, %r15d
movq %rbx, %rdi
callq 0x7be2
testl %r15d, %r15d
jne 0x3a37
movq %rbx, %rdi
callq 0x8150
jmp 0x36cd
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x1a, %edx
movq %rax, %rdi
leaq 0x596e(%rip), %rsi      # 0x9291
callq 0x2170
movq %r13, %rdi
leaq -0x29(%rbp), %rsi
callq 0x2180
movb -0x29(%rbp), %al
addb $-0x31, %al
cmpb $0x6, %al
jae 0x36cd
movl $0x26, %edx
movq %r14, %rdi
leaq 0x579d(%rip), %rsi      # 0x90ed
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %r14, %rdi
leaq 0x5716(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
movq %r12, %rsi
callq 0x20a0
cmpl $0x2, -0x30(%rbp)
ja 0x36cd
movl $0x22, %edx
movq %r14, %rdi
leaq 0x58f8(%rip), %rsi      # 0x92ac
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %r14, %rdi
leaq 0x56b2(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x20a0
cmpl $0x0, -0x3c(%rbp)
jne 0x36cd
movsbl -0x29(%rbp), %eax
movl $0xffffffbf, %ecx       # imm = 0xFFFFFFBF
addl %ecx, %eax
addl $0x10, %eax
movl -0x30(%rbp), %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
leaq -0x38(%rbp), %rsi
callq 0x7fea
jmp 0x38cc
movq 0x958a(%rip), %rbx      # 0xcfc8
leaq 0x5aea(%rip), %rsi      # 0x952f
movl $0x24, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x9558(%rip), %rdi      # 0xcfc8
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl -0x40(%rbp), %eax
testl %eax, %eax
setne %cl
cmpl $0x1, %r15d
sete %dl
testb %cl, %dl
je 0x3a9e
movl $0x1d, %edx
leaq 0x5862(%rip), %rsi      # 0x92fe
jmp 0x3ac5
xorl $0x2, %r15d
orl %eax, %r15d
leaq 0x5852(%rip), %rax      # 0x92fe
leaq 0x5869(%rip), %rsi      # 0x931c
cmoveq %rax, %rsi
movl $0x1d, %eax
movl $0x17, %edx
cmoveq %rax, %rdx
movq 0x94fc(%rip), %rbx      # 0xcfc8
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x94d6(%rip), %rdi      # 0xcfc8
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq 0x94c2(%rip), %rbx      # 0xcfc8
leaq 0x5a22(%rip), %rsi      # 0x952f
movl $0x24, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x9490(%rip), %rdi      # 0xcfc8
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x5fa0
leaq 0x9220(%rip), %r14      # 0xcd78
addq $0x10, %r14
movq %r14, -0x80(%rbx)
leaq -0xb0(%rbp), %rdi
callq 0x4e0e
leaq -0xe0(%rbp), %rbx
movq %rbx, %rdi
callq 0x4e0e
movq %r14, -0x98(%rbx)
leaq -0x130(%rbp), %rdi
callq 0x4e0e
leaq -0x160(%rbp), %rbx
movq %rbx, %rdi
callq 0x4e0e
movq %r14, -0x98(%rbx)
leaq -0x1b0(%rbp), %rdi
callq 0x4e0e
leaq -0x1e0(%rbp), %rbx
movq %rbx, %rdi
callq 0x4e0e
movq %r14, -0x98(%rbx)
leaq -0x230(%rbp), %rdi
callq 0x4e0e
leaq -0x260(%rbp), %rbx
movq %rbx, %rdi
callq 0x4e0e
movq %r14, -0x98(%rbx)
leaq -0x2b0(%rbp), %rdi
callq 0x4e0e
leaq -0x2e0(%rbp), %rdi
callq 0x4e0e
addq $0x3c8, %rsp            # imm = 0x3C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3c24
jmp 0x3c24
jmp 0x3c24
jmp 0x3c24
jmp 0x3c24
jmp 0x3c24
jmp 0x3c24
jmp 0x3c24
jmp 0x3c24
movq %rax, %rbx
leaq -0x300(%rbp), %rdi
callq 0x4d54
movq %rbx, %rdi
callq 0x2200
nop