// File: /workspace/github_cpp_makefile_star2_O1/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 0x1ecd(%rip), %r15      # 0x5a5a
leaq 0x1c67(%rip), %r14      # 0x57fb
callq 0x3a9c
xorl %edi, %edi
xorl %esi, %esi
leaq 0x188c(%rip), %rdx      # 0x5430
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 0x1eb8(%rip), %rdx      # 0x5a82
xorl %eax, %eax
callq 0x22b0
movl $0x3, %edi
xorl %esi, %esi
leaq 0x1ecb(%rip), %rdx      # 0x5aaa
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 0x1ebc(%rip), %rdx      # 0x5ad2
xorl %eax, %eax
callq 0x22b0
movl $0x7, %edi
xorl %esi, %esi
leaq 0x1ecf(%rip), %rdx      # 0x5afa
xorl %eax, %eax
callq 0x22b0
movl $0x8, %edi
xorl %esi, %esi
leaq 0x1ee2(%rip), %rdx      # 0x5b22
xorl %eax, %eax
callq 0x22b0
movl $0x9, %edi
xorl %esi, %esi
leaq 0x1ef5(%rip), %rdx      # 0x5b4a
xorl %eax, %eax
callq 0x22b0
movl $0xa, %edi
xorl %esi, %esi
leaq 0x1f08(%rip), %rdx      # 0x5b72
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 0x1ef2(%rip), %rdx      # 0x5b98
xorl %eax, %eax
callq 0x22b0
movb 0x4(%rbx), %cl
movb 0x10(%rbx), %al
movl %ecx, %edx
orb %al, %dl
jne 0x3cd6
movl $0xe, %edi
xorl %esi, %esi
leaq 0x1ef9(%rip), %rdx      # 0x5bc0
xorl %eax, %eax
callq 0x22b0
movl $0xf, %r12d
jmp 0x3ce4
movl $0xe, %r12d
testb %cl, %cl
je 0x3ce4
testb $0x1, %al
jne 0x3cb9
movb 0x4(%rbx), %cl
movb 0x10(%rbx), %al
movl %ecx, %edx
orb %al, %dl
jne 0x3d0d
leal 0x1(%r12), %ebp
movl %r12d, %edi
xorl %esi, %esi
leaq 0x1ee7(%rip), %rdx      # 0x5be8
xorl %eax, %eax
callq 0x22b0
movl %ebp, %r12d
jmp 0x3d15
testb %cl, %cl
jne 0x3d15
testb $0x1, %al
jne 0x3cf0
leal 0x1(%r12), %r13d
movl %r12d, %edi
xorl %esi, %esi
leaq 0x1eea(%rip), %rdx      # 0x5c10
xorl %eax, %eax
callq 0x22b0
leal 0x2(%r12), %ebp
movl %r13d, %edi
xorl %esi, %esi
leaq 0x1efa(%rip), %rdx      # 0x5c38
xorl %eax, %eax
callq 0x22b0
leal 0x3(%r12), %r13d
movl %ebp, %edi
xorl %esi, %esi
leaq 0x1f0b(%rip), %rdx      # 0x5c60
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 0x5242(%rip), %rax      # 0x8fd0
movq (%rax), %rdi
callq 0x20e0
movl %eax, %r12d
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x3da8
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x40(%rbx)
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x3dbf
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x48(%rbx)
cmpl $0x52, %r12d
jg 0x3de7
leal -0x31(%r12), %eax
cmpl $0x12, %eax
ja 0x3e42
leaq 0x1c1a(%rip), %rcx      # 0x59f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x67, %r12d
jg 0x3e08
cmpl $0x60, %r12d
jg 0x3e2d
cmpl $0x53, %r12d
je 0x3e14
cmpl $0x57, %r12d
jne 0x3b94
jmp 0x3f36
cmpl $0x72, %r12d
jle 0x3e5b
cmpl $0x73, %r12d
jne 0x3e74
cmpb $0x0, 0x4(%rbx)
jne 0x3ee0
cmpb $0x0, 0x10(%rbx)
jne 0x3b94
jmp 0x3ee0
cmpl $0x63, %r12d
jne 0x3e83
cmpb $0x0, 0x4(%rbx)
jne 0x3b94
jmp 0x3f95
cmpl $0x48, %r12d
je 0x3ff4
cmpl $0x51, %r12d
jne 0x3b94
jmp 0x4061
cmpl $0x68, %r12d
je 0x3ff4
cmpl $0x71, %r12d
jne 0x3b94
jmp 0x4061
cmpl $0x77, %r12d
jne 0x3b94
jmp 0x3f36
cmpl $0x61, %r12d
jne 0x3b94
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4598
leaq 0x4db6(%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 0x3f76
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4598
leaq 0x4d63(%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 0x4630
jmp 0x4045
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 0x404e
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4598
leaq 0x4cae(%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 0x3464
movq %r14, 0x48(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
jmp 0x404e
movl $0x18, %edi
callq 0x2220
movq %rax, %r14
movq 0x50(%rbx), %rsi
movq %rax, %rdi
movl $0x78, %edx
callq 0x4598
leaq 0x4c4f(%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 0x4598
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 0x3b52
movl $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4098
jmp 0x4098
jmp 0x4082
jmp 0x4098
jmp 0x4082
jmp 0x4082
movq %rax, %rbx
movl $0x28, %esi
jmp 0x40a0
jmp 0x4098
movq %rax, %rbx
movl $0x30, %esi
jmp 0x40a0
movq %rax, %rbx
movl $0x18, %esi
movq %r14, %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x2340