// File: /workspace/github_cpp_makefile_star2_O3/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 0x20e3(%rip), %r15      # 0x5a6a
leaq 0x1e7d(%rip), %r14      # 0x580b
callq 0x3898
xorl %edi, %edi
xorl %esi, %esi
leaq 0x1aa2(%rip), %rdx      # 0x5440
xorl %eax, %eax
callq 0x22b0
movl $0x1, %edi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
movl $0x2, %edi
xorl %esi, %esi
leaq 0x20ce(%rip), %rdx      # 0x5a92
xorl %eax, %eax
callq 0x22b0
movl $0x3, %edi
xorl %esi, %esi
leaq 0x20e1(%rip), %rdx      # 0x5aba
xorl %eax, %eax
callq 0x22b0
movl $0x4, %edi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
movl $0x5, %edi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
movl $0x6, %edi
xorl %esi, %esi
leaq 0x20d2(%rip), %rdx      # 0x5ae2
xorl %eax, %eax
callq 0x22b0
movl $0x7, %edi
xorl %esi, %esi
leaq 0x20e5(%rip), %rdx      # 0x5b0a
xorl %eax, %eax
callq 0x22b0
movl $0x8, %edi
xorl %esi, %esi
leaq 0x20f8(%rip), %rdx      # 0x5b32
xorl %eax, %eax
callq 0x22b0
movl $0x9, %edi
xorl %esi, %esi
leaq 0x210b(%rip), %rdx      # 0x5b5a
xorl %eax, %eax
callq 0x22b0
movl $0xa, %edi
xorl %esi, %esi
leaq 0x211e(%rip), %rdx      # 0x5b82
movl $0x44d, %ecx            # imm = 0x44D
xorl %eax, %eax
callq 0x22b0
movl $0xb, %edi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
movl $0xc, %edi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
movl $0xd, %edi
xorl %esi, %esi
leaq 0x2108(%rip), %rdx      # 0x5ba8
xorl %eax, %eax
callq 0x22b0
movb 0x4(%rbx), %cl
movb 0x10(%rbx), %al
movl %ecx, %edx
orb %al, %dl
jne 0x3ad6
movl $0xe, %edi
xorl %esi, %esi
leaq 0x210f(%rip), %rdx      # 0x5bd0
xorl %eax, %eax
callq 0x22b0
movb 0x4(%rbx), %cl
movb 0x10(%rbx), %al
movl $0xf, %r12d
jmp 0x3ae4
movl $0xe, %r12d
testb %cl, %cl
je 0x3ae4
testb $0x1, %al
jne 0x3ab3
movl %ecx, %edx
orb %al, %dl
jne 0x3b07
leal 0x1(%r12), %ebp
movl %r12d, %edi
xorl %esi, %esi
leaq 0x20fd(%rip), %rdx      # 0x5bf8
xorl %eax, %eax
callq 0x22b0
movl %ebp, %r12d
jmp 0x3b0f
testb %cl, %cl
jne 0x3b0f
testb $0x1, %al
jne 0x3aea
leal 0x1(%r12), %r13d
movl %r12d, %edi
xorl %esi, %esi
leaq 0x2100(%rip), %rdx      # 0x5c20
xorl %eax, %eax
callq 0x22b0
leal 0x2(%r12), %ebp
movl %r13d, %edi
xorl %esi, %esi
leaq 0x2110(%rip), %rdx      # 0x5c48
xorl %eax, %eax
callq 0x22b0
leal 0x3(%r12), %r13d
movl %ebp, %edi
xorl %esi, %esi
leaq 0x2121(%rip), %rdx      # 0x5c70
xorl %eax, %eax
callq 0x22b0
addl $0x4, %r12d
movl %r13d, %edi
xorl %esi, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
movl %r12d, %edi
xorl %esi, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22b0
xorl %edi, %edi
xorl %esi, %esi
callq 0x2170
movq 0x5448(%rip), %rax      # 0x8fd0
movq (%rax), %rdi
callq 0x20e0
movl %eax, %r12d
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x3ba2
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x40(%rbx)
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x3bb9
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x48(%rbx)
cmpl $0x52, %r12d
jg 0x3be1
leal -0x31(%r12), %eax
cmpl $0x12, %eax
ja 0x3c3c
leaq 0x1e30(%rip), %rcx      # 0x5a08
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x67, %r12d
jg 0x3c02
cmpl $0x60, %r12d
jg 0x3c27
cmpl $0x53, %r12d
je 0x3c0e
cmpl $0x57, %r12d
jne 0x398e
jmp 0x3d30
cmpl $0x72, %r12d
jle 0x3c55
cmpl $0x73, %r12d
jne 0x3c6e
cmpb $0x0, 0x4(%rbx)
jne 0x3cda
cmpb $0x0, 0x10(%rbx)
jne 0x398e
jmp 0x3cda
cmpl $0x63, %r12d
jne 0x3c7d
cmpb $0x0, 0x4(%rbx)
jne 0x398e
jmp 0x3d8f
cmpl $0x48, %r12d
je 0x3dee
cmpl $0x51, %r12d
jne 0x398e
jmp 0x3e5b
cmpl $0x68, %r12d
je 0x3dee
cmpl $0x71, %r12d
jne 0x398e
jmp 0x3e5b
cmpl $0x77, %r12d
jne 0x398e
jmp 0x3d30
cmpl $0x61, %r12d
jne 0x398e
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4398
leaq 0x4fbc(%rip), %rax      # 0x8c68
addq $0x10, %rax
movq %rax, (%r14)
movq %r14, 0x40(%rbx)
movl $0x28, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x6f, %edx
callq 0x2734
jmp 0x3d70
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4398
leaq 0x4f69(%rip), %rax      # 0x8c68
addq $0x10, %rax
movq %rax, (%r14)
movq %r14, 0x40(%rbx)
movl $0x30, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x6f, %edx
movq %rbx, %rcx
callq 0x4430
jmp 0x3e3f
movl $0x28, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x2734
movq %r14, 0x40(%rbx)
movl $0x28, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x6f, %edx
callq 0x2734
movq %r14, 0x48(%rbx)
callq 0x2090
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
subl %ecx, %eax
movq %rbx, %rdi
movl %eax, %esi
jmp 0x3e48
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4398
leaq 0x4eb4(%rip), %rax      # 0x8c68
addq $0x10, %rax
movq %rax, (%r14)
movq %r14, 0x40(%rbx)
movl $0x28, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x6f, %edx
movq %rbx, %rcx
callq 0x3260
movq %r14, 0x48(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
jmp 0x3e48
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4398
leaq 0x4e55(%rip), %r15      # 0x8c68
addq $0x10, %r15
movq %r15, (%r14)
movq %r14, 0x40(%rbx)
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x6f, %edx
callq 0x4398
movq %r15, (%r14)
movq %r14, 0x48(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x394c
movl $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3e92
jmp 0x3e92
jmp 0x3e7c
jmp 0x3e92
jmp 0x3e7c
jmp 0x3e7c
movq %rax, %rbx
movl $0x28, %esi
jmp 0x3e9a
jmp 0x3e92
movq %rax, %rbx
movl $0x30, %esi
jmp 0x3e9a
movq %rax, %rbx
movl $0x18, %esi
movq %r14, %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x2340