// File: /workspace/github_cpp_makefile_star2_O2/nesro[P]NCursesGomoku/src/game.cpp
// Function: CGame::showMenu()
void CGame::showMenu(void) {
	int key;
	int row = 0;
	int col = 0;

	clearScreen();

	mvprintw(row++, col, "/=====================================\\");
	mvprintw(row++, col, "|                                     |");
	mvprintw(row++, col, "| Program: \"NCursesGomoku\"            |");
	mvprintw(row++, col, "| Author:  \"nesrotom@fit.cvut.cz\"     |");
	mvprintw(row++, col, "|                                     |");
	mvprintw(row++, col, "|                                     |");
	mvprintw(row++, col, "| You can specify host and port with  |");
	mvprintw(row++, col, "| this usage:                         |");
	mvprintw(row++, col, "| nesrotom port host                  |");
	mvprintw(row++, col, "| if not, default is:                 |");
	mvprintw(row++, col, "| nesrotom %d localhost             |",
			CNetwork::DEFAULT_PORT);
	mvprintw(row++, col, "|                                     |");
	mvprintw(row++, col, "|                                     |");
	mvprintw(row++, col, "| \"1\" or \"a\" - New AI game            |");

	/* if we are clinet, we cannot convert to server */
	if ((m_IsServerUp == false && m_IsConnectionUp == false)
			|| (m_IsServerUp == true && m_IsConnectionUp == true)) {
		mvprintw(row++, col, "| \"2\" or \"s\" - New NET game (server)  |");
	}

	/* if we are server, we cannot convert to client */
	if ((m_IsServerUp == false && m_IsConnectionUp == false)
			|| (m_IsServerUp == false && m_IsConnectionUp == true)) {
		mvprintw(row++, col, "| \"3\" or \"c\" - New NET game (client)  |");
	}

	mvprintw(row++, col, "| \"4\" or \"w\" - Watch AI vs AI         |");
	mvprintw(row++, col, "| \"5\" or \"h\" - 2 players hotseat      |");
	mvprintw(row++, col, "| \"6\" or \"q\" - Quit                   |");
	mvprintw(row++, col, "|                                     |");
	mvprintw(row++, col, "\\=====================================/");

	move(0, 0);
	key = getch();

	/* just for safety */
	playerCleanup();

	switch (key) {
	case '1':
	case 'a':
	case 'A':
		m_Players[0] = new CLocal(m_Board, PLAYER_0_CHAR);
		m_Players[1] = new CAI(m_Board, PLAYER_1_CHAR);

		/* let random decide, who starts! */
		startGame(rand() % 2);
		break;
	case '2':
	case 's':
	case 'S':

		/* no for client */
		if (m_IsServerUp == false && m_IsConnectionUp == true) {
			showMenu();
			break;
		}

		m_Players[0] = new CLocal(m_Board, PLAYER_0_CHAR);
		m_Players[1] = new CServer(m_Board, PLAYER_1_CHAR, this);

		/* I (server) starts */
		startGame(0);
		break;
	case '3':
	case 'c':
	case 'C':

		/* no for server */
		if (m_IsServerUp) {
			showMenu();
			break;
		}

		m_Players[0] = new CLocal(m_Board, PLAYER_0_CHAR);
		m_Players[1] = new CClient(m_Board, PLAYER_1_CHAR, this);

		/* He (server) starts */
		startGame(1);
		break;
	case '4':
	case 'w':
	case 'W':
		m_Players[0] = new CAI(m_Board, PLAYER_0_CHAR);
		m_Players[1] = new CAI(m_Board, PLAYER_1_CHAR);

		/* random AI starts*/
		startGame(rand() % 2);

		break;
	case '5':
	case 'h':
	case 'H':
		m_Players[0] = new CLocal(m_Board, PLAYER_0_CHAR);
		m_Players[1] = new CLocal(m_Board, PLAYER_1_CHAR);

		startGame(0);
		break;
	case '6':
	case 'q':
	case 'Q':
		m_Status = CGame::STATUS_EXIT;
		break;
	default:
		showMenu();
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x22bb(%rip), %r15      # 0x5a6a
pushq $0xe
popq %r12
callq 0x36e0
xorl %edi, %edi
xorl %esi, %esi
leaq 0x1c7d(%rip), %rdx      # 0x5440
xorl %eax, %eax
callq 0x22a0
pushq $0x1
popq %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22a0
pushq $0x2
popq %rdi
xorl %esi, %esi
leaq 0x22ad(%rip), %rdx      # 0x5a92
xorl %eax, %eax
callq 0x22a0
pushq $0x3
popq %rdi
xorl %esi, %esi
leaq 0x22c2(%rip), %rdx      # 0x5aba
xorl %eax, %eax
callq 0x22a0
pushq $0x4
popq %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22a0
pushq $0x5
popq %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22a0
pushq $0x6
popq %rdi
xorl %esi, %esi
leaq 0x22b9(%rip), %rdx      # 0x5ae2
xorl %eax, %eax
callq 0x22a0
pushq $0x7
popq %rdi
xorl %esi, %esi
leaq 0x22ce(%rip), %rdx      # 0x5b0a
xorl %eax, %eax
callq 0x22a0
pushq $0x8
popq %rdi
xorl %esi, %esi
leaq 0x22e3(%rip), %rdx      # 0x5b32
xorl %eax, %eax
callq 0x22a0
pushq $0x9
popq %rdi
xorl %esi, %esi
leaq 0x22f8(%rip), %rdx      # 0x5b5a
xorl %eax, %eax
callq 0x22a0
pushq $0xa
popq %rdi
xorl %esi, %esi
leaq 0x230d(%rip), %rdx      # 0x5b82
movl $0x44d, %ecx            # imm = 0x44D
xorl %eax, %eax
callq 0x22a0
pushq $0xb
popq %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22a0
pushq $0xc
popq %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22a0
pushq $0xd
popq %rdi
xorl %esi, %esi
leaq 0x22fd(%rip), %rdx      # 0x5ba8
xorl %eax, %eax
callq 0x22a0
movb 0x4(%rbx), %cl
movb 0x10(%rbx), %al
movl %ecx, %edx
orb %al, %dl
jne 0x38de
movl %r12d, %edi
xorl %esi, %esi
leaq 0x2306(%rip), %rdx      # 0x5bd0
xorl %eax, %eax
callq 0x22a0
movb 0x4(%rbx), %cl
movb 0x10(%rbx), %al
pushq $0xf
popq %rdx
movl %edx, %ebp
jmp 0x38e9
movl %r12d, %ebp
testb %cl, %cl
je 0x38e9
testb $0x1, %al
jne 0x38be
movl %ecx, %edx
orb %al, %dl
jne 0x390a
leal 0x1(%rbp), %r14d
movl %ebp, %edi
xorl %esi, %esi
leaq 0x22fa(%rip), %rdx      # 0x5bf8
xorl %eax, %eax
callq 0x22a0
movl %r14d, %ebp
jmp 0x3912
testb %cl, %cl
jne 0x3912
testb $0x1, %al
jne 0x38ef
leal 0x1(%rbp), %r14d
movl %ebp, %edi
xorl %esi, %esi
leaq 0x22ff(%rip), %rdx      # 0x5c20
xorl %eax, %eax
callq 0x22a0
leal 0x2(%rbp), %r13d
movl %r14d, %edi
xorl %esi, %esi
leaq 0x2310(%rip), %rdx      # 0x5c48
xorl %eax, %eax
callq 0x22a0
leal 0x3(%rbp), %r14d
movl %r13d, %edi
xorl %esi, %esi
leaq 0x2321(%rip), %rdx      # 0x5c70
xorl %eax, %eax
callq 0x22a0
addl $0x4, %ebp
movl %r14d, %edi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22a0
movl %ebp, %edi
xorl %esi, %esi
leaq 0x1e98(%rip), %rdx      # 0x580b
xorl %eax, %eax
callq 0x22a0
xorl %edi, %edi
xorl %esi, %esi
callq 0x2170
movq 0x5646(%rip), %rax      # 0x8fd0
movq (%rax), %rdi
callq 0x20e0
movl %eax, %ebp
movq %rbx, %rdi
callq 0x367a
leal -0x31(%rbp), %eax
cmpl $0x12, %eax
jbe 0x39f4
cmpl $0x53, %ebp
je 0x3a13
cmpl $0x63, %ebp
je 0x3a04
cmpl $0x73, %ebp
je 0x3a13
cmpl $0x48, %ebp
je 0x3aea
cmpl $0x51, %ebp
je 0x3b2d
cmpl $0x57, %ebp
je 0x3b3f
cmpl $0x77, %ebp
je 0x3b3f
cmpl $0x68, %ebp
je 0x3aea
cmpl $0x71, %ebp
je 0x3b2d
cmpl $0x61, %ebp
jne 0x37b3
jmp 0x3a63
leaq 0x200d(%rip), %rcx      # 0x5a08
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x4(%rbx)
jne 0x37b3
jmp 0x3aa0
cmpb $0x0, 0x4(%rbx)
jne 0x3a23
cmpb $0x0, 0x10(%rbx)
jne 0x37b3
pushq $0x18
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x78
popq %rdx
movq %rax, %rdi
callq 0x3d90
movq %r14, 0x40(%rbx)
pushq $0x30
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x6f
popq %rdx
movq %rax, %rdi
movq %rbx, %rcx
callq 0x4098
jmp 0x3b22
pushq $0x18
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x78
popq %rdx
movq %rax, %rdi
callq 0x3d90
movq %r14, 0x40(%rbx)
pushq $0x28
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x6f
popq %rdx
movq %rax, %rdi
callq 0x2714
jmp 0x3b77
pushq $0x18
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x78
popq %rdx
movq %rax, %rdi
callq 0x3d90
movq %r14, 0x40(%rbx)
pushq $0x28
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x6f
popq %rdx
movq %rax, %rdi
movq %rbx, %rcx
callq 0x3160
movq %r14, 0x48(%rbx)
pushq $0x1
popq %rsi
movq %rbx, %rdi
jmp 0x3b8b
pushq $0x18
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x78
popq %rdx
movq %rax, %rdi
callq 0x3d90
movq %r14, 0x40(%rbx)
pushq $0x18
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x6f
popq %rdx
movq %rax, %rdi
callq 0x3d90
movq %r14, 0x48(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x3b8b
andl $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x28
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x78
popq %rdx
movq %rax, %rdi
callq 0x2714
movq %r14, 0x40(%rbx)
pushq $0x28
popq %rdi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
pushq $0x6f
popq %rdx
movq %rax, %rdi
callq 0x2714
movq %r14, 0x48(%rbx)
callq 0x2090
cltd
pushq $0x2
popq %rcx
idivl %ecx
movq %rbx, %rdi
movl %edx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3774
jmp 0x3baa
jmp 0x3bba
jmp 0x3baa
jmp 0x3bba
jmp 0x3baa
jmp 0x3bba
movq %rax, %rbx
pushq $0x28
jmp 0x3bbf
jmp 0x3bba
movq %rax, %rbx
pushq $0x30
jmp 0x3bbf
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x2320