// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq 0x9c40(%rip), %rbx      # 0xcfc8
leaq 0x5e1e(%rip), %rsi      # 0x91ad
movl $0x26, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x5e0a(%rip), %rsi      # 0x91d4
movl $0x25, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x5c9c(%rip), %r15      # 0x90a1
movl $0x8, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2170
movq 0x9bbc(%rip), %r12      # 0xcfd8
leaq -0x40(%rbp), %rsi
movq %r12, %rdi
callq 0x20a0
leaq 0x5dcb(%rip), %rsi      # 0x91fa
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2170
leaq -0x44(%rbp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x20a0
cmpl $0x1, (%r15)
jne 0x3659
movq %r14, -0x50(%rbp)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq %rax, %r15
movl $0x24, %edx
movq %rax, %rdi
leaq 0x5d5a(%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 0x9ac5(%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 0x3517
movq -0x58(%rbp), %rax
incq %rax
addq $0x5, %r15
cmpq $0x5, %rax
jne 0x34fe
movl $0x2a, %edx
movq 0x9a75(%rip), %rbx      # 0xcfc8
movq %rbx, %rdi
leaq 0x5ceb(%rip), %rsi      # 0x9248
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x5b09(%rip), %rsi      # 0x90a1
callq 0x2170
movq 0x9a34(%rip), %rdi      # 0xcfd8
leaq -0x44(%rbp), %rsi
callq 0x20a0
cmpl $0x0, -0x44(%rbp)
je 0x3490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq %rax, %r15
leaq 0x5c8b(%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 0x5a7e(%rip), %rsi      # 0x90a1
movl $0x8, %edx
movq %rbx, %rdi
callq 0x2170
movq 0x99a1(%rip), %rdi      # 0xcfd8
leaq -0x5c(%rbp), %r15
movq %r15, %rsi
callq 0x20a0
movl (%r15), %edx
leaq -0x300(%rbp), %rsi
movq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x7c54
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq %r14, %rdi
callq 0x7d9c
leaq -0x300(%rbp), %rdi
callq 0x4e44
movq 0x993d(%rip), %r13      # 0xcfd8
cmpl $0x0, -0x40(%rbp)
je 0x36b1
movq %r14, %rdi
callq 0x872e
testb %al, %al
je 0x38c4
cmpl $0x0, -0x40(%rbp)
jne 0x3819
movq %r14, %rdi
callq 0x872e
testb %al, %al
je 0x3819
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x1a, %edx
movq %rax, %rdi
leaq 0x5bce(%rip), %rsi      # 0x92cf
callq 0x2170
movq %r13, %rdi
leaq -0x29(%rbp), %rsi
callq 0x2180
movb -0x29(%rbp), %al
addb $-0x41, %al
movl $0xa, %r15d
cmpb $0x6, %al
jae 0x3a12
movl $0x20, %edx
movq %rbx, %rdi
leaq 0x59e0(%rip), %rsi      # 0x9114
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x5932(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
leaq -0x30(%rbp), %rsi
callq 0x20a0
cmpl $0x2, -0x30(%rbp)
ja 0x3a12
movl $0x22, %edx
movq %rbx, %rdi
leaq 0x5b13(%rip), %rsi      # 0x92ac
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x58cd(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x20a0
cmpl $0x0, -0x3c(%rbp)
jne 0x3a12
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 %r14, %rdi
leaq -0x38(%rbp), %rsi
callq 0x818e
jmp 0x3a0c
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x13, %edx
movq %rax, %rdi
leaq 0x5a9b(%rip), %rsi      # 0x92ea
callq 0x2170
movq %r13, %rdi
leaq -0x30(%rbp), %rsi
callq 0x2180
movb -0x30(%rbp), %bl
addb $-0x31, %bl
movl $0xa, %r15d
cmpb $0x6, %bl
jae 0x38af
leaq -0x3e8(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x7a74
movsbl -0x30(%rbp), %edx
addl $-0x31, %edx
leaq -0x300(%rbp), %rdi
movq %r15, %rsi
callq 0x5478
movq %rax, -0x38(%rbp)
movq %r14, %rdi
leaq -0x38(%rbp), %rsi
callq 0x818e
movl %eax, %r12d
xorl %r15d, %r15d
cmpb $0x6, %bl
movq 0x970f(%rip), %rbx      # 0xcfc8
jb 0x3a1b
jmp 0x3b28
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x1a, %edx
movq %rax, %rdi
leaq 0x5997(%rip), %rsi      # 0x9291
callq 0x2170
movq %r13, %rdi
leaq -0x29(%rbp), %rsi
callq 0x2180
movb -0x29(%rbp), %al
addb $-0x31, %al
movl $0xa, %r15d
cmpb $0x6, %al
jae 0x3a12
movl $0x26, %edx
movq %rbx, %rdi
leaq 0x57c0(%rip), %rsi      # 0x90ed
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x5739(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
leaq -0x30(%rbp), %rsi
callq 0x20a0
cmpl $0x2, -0x30(%rbp)
ja 0x3a12
movl $0x22, %edx
movq %rbx, %rdi
leaq 0x591a(%rip), %rsi      # 0x92ac
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x56d4(%rip), %rsi      # 0x90a1
callq 0x2170
movq %r13, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x20a0
cmpl $0x0, -0x3c(%rbp)
jne 0x3a12
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 %r14, %rdi
leaq -0x38(%rbp), %rsi
callq 0x818e
movl %eax, %r12d
xorl %r15d, %r15d
testl %r15d, %r15d
jne 0x3b28
movq %r14, %rdi
callq 0x7d9c
testl %r12d, %r12d
je 0x3b1a
movl $0x24, %edx
movq %rbx, %rdi
leaq 0x5af4(%rip), %rsi      # 0x952f
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl -0x40(%rbp), %eax
testl %eax, %eax
je 0x3a80
movl $0x1d, %edx
leaq 0x5884(%rip), %rsi      # 0x92fe
cmpl $0x1, %r12d
je 0x3aa8
movl %r12d, %ecx
xorl $0x2, %ecx
orl %ecx, %eax
leaq 0x588d(%rip), %rsi      # 0x931c
leaq 0x5868(%rip), %rax      # 0x92fe
cmoveq %rax, %rsi
movl $0x17, %edx
movl $0x1d, %eax
cmoveq %rax, %rdx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0x24, %edx
movq %rbx, %rdi
leaq 0x5a49(%rip), %rsi      # 0x952f
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movl $0x1, %r15d
movq %rax, %rdi
callq 0x20c0
jmp 0x3b28
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x8316
xorl %r12d, %r12d
testl %r15d, %r15d
je 0x369b
cmpl $0xa, %r15d
je 0x369b
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x6090
leaq 0x922a(%rip), %r14      # 0xcd78
addq $0x10, %r14
movq %r14, -0x80(%rbx)
leaq -0xb0(%rbp), %rdi
callq 0x4de6
leaq -0xe0(%rbp), %rbx
movq %rbx, %rdi
callq 0x4de6
movq %r14, -0x98(%rbx)
leaq -0x130(%rbp), %rdi
callq 0x4de6
leaq -0x160(%rbp), %rbx
movq %rbx, %rdi
callq 0x4de6
movq %r14, -0x98(%rbx)
leaq -0x1b0(%rbp), %rdi
callq 0x4de6
leaq -0x1e0(%rbp), %rbx
movq %rbx, %rdi
callq 0x4de6
movq %r14, -0x98(%rbx)
leaq -0x230(%rbp), %rdi
callq 0x4de6
leaq -0x260(%rbp), %rbx
movq %rbx, %rdi
callq 0x4de6
movq %r14, -0x98(%rbx)
leaq -0x2b0(%rbp), %rdi
callq 0x4de6
leaq -0x2e0(%rbp), %rdi
callq 0x4de6
addq $0x3c8, %rsp            # imm = 0x3C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3c18
jmp 0x3c18
jmp 0x3c18
jmp 0x3c18
jmp 0x3c18
jmp 0x3c18
jmp 0x3c18
jmp 0x3c18
movq %rax, %rbx
leaq -0x300(%rbp), %rdi
callq 0x4d2c
movq %rbx, %rdi
callq 0x2200
nop