// File: /workspace/github_cpp_makefile_star2_O2/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 0x92a4(%rip), %r14      # 0xbfc8
leaq 0x5482(%rip), %rsi      # 0x81ad
movq %r14, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0x5492(%rip), %rsi      # 0x81d4
movq %r14, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0x5348(%rip), %r15      # 0x80a1
movq %r14, %rdi
movq %r15, %rsi
callq 0x2150
movq 0x926d(%rip), %r12      # 0xbfd8
leaq -0x40(%rbp), %rsi
movq %r12, %rdi
callq 0x20b0
leaq 0x547c(%rip), %rsi      # 0x81fa
movq %r14, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %r14, %rdi
movq %r15, %rsi
callq 0x2150
leaq -0x44(%rbp), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x20b0
cmpl $0x1, (%r14)
jne 0x2ed3
movq %rbx, -0x50(%rbp)
movq 0x920b(%rip), %rbx      # 0xbfc8
xorl %r12d, %r12d
movq 0x9211(%rip), %r15      # 0xbfd8
leaq -0x38(%rbp), %r13
movq %rbx, %rdi
callq 0x2090
movq %rax, %rdi
leaq 0x5446(%rip), %rsi      # 0x8223
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq -0x300(%rbp), %rbx
xorl %eax, %eax
cmpq $0x5, %rax
je 0x2e32
movq %rax, -0x58(%rbp)
pushq $-0x5
popq %r14
testq %r14, %r14
je 0x2e25
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movzbl -0x38(%rbp), %eax
cmpb $0x30, %al
cmovel %r12d, %eax
movb %al, 0x5(%rbx,%r14)
incq %r14
jmp 0x2e01
movq -0x58(%rbp), %rax
incq %rax
addq $0x5, %rbx
jmp 0x2df3
movq 0x918f(%rip), %rbx      # 0xbfc8
movq %rbx, %rdi
leaq 0x5405(%rip), %rsi      # 0x8248
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %rbx, %rdi
leaq 0x5247(%rip), %rsi      # 0x80a1
callq 0x2150
movq %r15, %rdi
leaq -0x44(%rbp), %rsi
callq 0x20b0
cmpl $0x0, -0x44(%rbp)
je 0x2dcb
movq 0x914c(%rip), %r14      # 0xbfc8
movq %r14, %rdi
callq 0x2090
leaq 0x53e8(%rip), %rsi      # 0x8273
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0x51ff(%rip), %rsi      # 0x80a1
movq %r14, %rdi
callq 0x2150
movq 0x9127(%rip), %rdi      # 0xbfd8
leaq -0x5c(%rbp), %r14
movq %r14, %rsi
callq 0x20b0
movl (%r14), %edx
leaq -0x300(%rbp), %rsi
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x6504
movq 0x90ee(%rip), %r14      # 0xbfc8
movq %r14, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x6652
leaq -0x300(%rbp), %rdi
callq 0x3c24
movq 0x90db(%rip), %r13      # 0xbfd8
leaq -0x30(%rbp), %r12
cmpl $0x0, -0x40(%rbp)
je 0x2f21
movq %rbx, %rdi
callq 0x6d72
testb %al, %al
je 0x3084
cmpl $0x0, -0x40(%rbp)
jne 0x2ffb
movq %rbx, %rdi
callq 0x6d72
testb %al, %al
je 0x2ffb
movq %r14, %rdi
callq 0x2090
movq %rax, %rdi
leaq 0x538c(%rip), %rsi      # 0x82cf
callq 0x2150
movq %r13, %rdi
leaq -0x29(%rbp), %rsi
callq 0x21a0
movb -0x29(%rbp), %al
addb $-0x41, %al
cmpb $0x6, %al
jae 0x2f01
movq %r14, %rdi
leaq 0x51ad(%rip), %rsi      # 0x8114
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x5123(%rip), %rsi      # 0x80a1
callq 0x2150
movq %r13, %rdi
movq %r12, %rsi
callq 0x20b0
cmpl $0x2, -0x30(%rbp)
ja 0x2f01
movq %r14, %rdi
leaq 0x530a(%rip), %rsi      # 0x82ac
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x50e8(%rip), %rsi      # 0x80a1
callq 0x2150
movq %r13, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x20b0
cmpl $0x0, -0x3c(%rbp)
jne 0x2f01
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 0x692c
jmp 0x3063
movq %r14, %rdi
callq 0x2090
movq %rax, %rdi
leaq 0x52dd(%rip), %rsi      # 0x82ea
callq 0x2150
movq %r13, %rdi
movq %r12, %rsi
callq 0x21a0
movb -0x30(%rbp), %al
addb $-0x31, %al
cmpb $0x6, %al
jae 0x2f01
leaq -0x3e8(%rbp), %rdi
movq %rbx, %rsi
callq 0x6336
movsbl -0x30(%rbp), %edx
addl $-0x31, %edx
leaq -0x300(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x3f00
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
leaq -0x38(%rbp), %rsi
callq 0x692c
movl %eax, %r15d
movq %rbx, %rdi
callq 0x6652
testl %r15d, %r15d
jne 0x3158
movq %rbx, %rdi
callq 0x6a92
jmp 0x2f01
movq %r14, %rdi
callq 0x2090
movq %rax, %rdi
leaq 0x51fb(%rip), %rsi      # 0x8291
callq 0x2150
movq %r13, %rdi
leaq -0x29(%rbp), %rsi
callq 0x21a0
movb -0x29(%rbp), %al
addb $-0x31, %al
cmpb $0x6, %al
jae 0x2f01
movq %r14, %rdi
leaq 0x502f(%rip), %rsi      # 0x80ed
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x4fcc(%rip), %rsi      # 0x80a1
callq 0x2150
movq %r13, %rdi
movq %r12, %rsi
callq 0x20b0
cmpl $0x2, -0x30(%rbp)
ja 0x2f01
movq %r14, %rdi
leaq 0x51b3(%rip), %rsi      # 0x82ac
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x4f91(%rip), %rsi      # 0x80a1
callq 0x2150
movq %r13, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x20b0
cmpl $0x0, -0x3c(%rbp)
jne 0x2f01
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 0x692c
jmp 0x3063
movq 0x8e69(%rip), %rdi      # 0xbfc8
leaq 0x53c9(%rip), %rsi      # 0x852f
callq 0x2150
movq %rax, %rdi
callq 0x2090
movl -0x40(%rbp), %eax
movl %r15d, %ecx
xorl $0x2, %ecx
leaq 0x517b(%rip), %rsi      # 0x82fe
leaq 0x5192(%rip), %rdx      # 0x831c
orl %eax, %ecx
cmoveq %rsi, %rdx
testl %eax, %eax
cmoveq %rdx, %rsi
cmpl $0x1, %r15d
cmovneq %rdx, %rsi
movq 0x8e23(%rip), %rdi      # 0xbfc8
callq 0x2150
movq %rax, %rdi
callq 0x2090
movq 0x8e0f(%rip), %rdi      # 0xbfc8
leaq 0x536f(%rip), %rsi      # 0x852f
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq -0x300(%rbp), %rdi
callq 0x3b3e
addq $0x3c8, %rsp            # imm = 0x3C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x31fd
jmp 0x31fd
jmp 0x31fd
jmp 0x31fd
jmp 0x31fd
jmp 0x31fd
jmp 0x31fd
jmp 0x31fd
jmp 0x31fd
movq %rax, %rbx
leaq -0x300(%rbp), %rdi
callq 0x3b3e
movq %rbx, %rdi
callq 0x2220