// File: /workspace/github_cpp_makefile_star2_O3/Matlock42[P]Jeopardy/jgameClass.cpp
// Function: Game::showBoard()
int Game::showBoard(void)
{
	clearScreen();
	int i,j,k;
	int lPrompt;
	int * t; // Number of additional tabs to add to make things line up
	t = new int [mSize];

	for(j = 0; j < mSize; j++)	// print category names
	{
		cout << mQuestionSet[j][0]->category() << "\t";
		t[j] = ((mQuestionSet[j][0]->category().length()) / 8); // each tab takes 8 char spaces in the terminal
	}
	cout << "\n";

	for(i = 0; i < mSize; i++)	// different rows (prices)
	{
		for(j=0; j < mSize; j++) // go through each category
		{
			std::string tabs = "\t"; // tabs between each
			for(k=0; k < t[j]; k++)
			{
				tabs.append("\t");  // Add any additional tabs
			}

			// display empty slot if the question has already been played
			if(mQuestionSet[j][i]->hasBeenPlayed())
			{
				cout << "----" << tabs;
			}
			else	// display the amount the question is worth
			{
				cout << "$" << mQuestionSet[j][i]->price() << tabs;
			}
		}
		cout << "\n\n";
	}
	// Display the current score and prompt for the next question
	cout << "\t\tScore: " << mScore << "\n";
	
	// validate the input
	bool lInputError = false;
	do
	{
		cout << "Next question: \n";
	    if (cin >> lPrompt) // Sanitize input to an integer
	    {
	    	lInputError = false;
	    } 
	    else
	    {
	        cout << "Entered value is not an Integer.\n";
	        cin.clear();
	        cin.ignore(numeric_limits<streamsize>::max(), '\n');
	        lInputError = true;
	    }
		if( lPrompt == 9000 )
		{
			cout << "I'm sorry, Dave. I'm afraid I can't do that.\n"; // 2001
			lInputError = true;
		}
		else if( lPrompt > (mSize * 11)) // only allow up to the max question number
		{
			cout << "We need to go to the crappy town where I'm a hero!\n"; // Firefly
			lInputError = true;
		}
		else if( lPrompt > 9000 )
		{
			cout << "It's over 9000!\n"; 
			lInputError = true;
		}

	} while (lInputError);
	clearScreen();
	showQuestion(lPrompt);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r12
movq 0x5fdf(%rip), %r14      # 0x8fc0
leaq 0x31ce(%rip), %r15      # 0x61b6
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2230
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2230
movslq 0x8(%r12), %rbx
leaq (,%rbx,4), %rax
testq %rbx, %rbx
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movq %rax, -0x60(%rbp)
testq %rbx, %rbx
movq %r12, -0x30(%rbp)
jle 0x30f0
xorl %r14d, %r14d
leaq -0x50(%rbp), %r15
movq 0x5f79(%rip), %rbx      # 0x8fc0
leaq 0x3022(%rip), %r13      # 0x6070
movq 0x10(%r12), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x5e00
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x2230
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2230
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x309b
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x5e00
movq -0x48(%rbp), %rax
shrq $0x3, %rax
movq -0x60(%rbp), %rcx
movl %eax, (%rcx,%r14,4)
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x30db
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
incq %r14
movq -0x30(%rbp), %r12
movslq 0x8(%r12), %rax
cmpq %rax, %r14
jl 0x304e
movq 0x5ec9(%rip), %rdi      # 0x8fc0
leaq 0x30b8(%rip), %rsi      # 0x61b6
movl $0x1, %edx
callq 0x2230
movl 0x8(%r12), %eax
testl %eax, %eax
movq %r12, %rbx
jle 0x3243
xorl %r14d, %r14d
leaq 0x2f4e(%rip), %r12      # 0x6070
leaq -0x50(%rbp), %r13
testl %eax, %eax
jle 0x3217
xorl %r15d, %r15d
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %r13, %rdi
movq %r12, %rsi
leaq 0x2f2b(%rip), %rdx      # 0x6071
callq 0x4460
movq -0x60(%rbp), %rax
movl (%rax,%r15,4), %ebx
testl %ebx, %ebx
jle 0x3166
movq %r13, %rdi
movq %r12, %rsi
callq 0x23c0
decl %ebx
jne 0x3157
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rdi
callq 0x5ddc
testb %al, %al
je 0x319c
movl $0x4, %edx
movq 0x5e35(%rip), %rbx      # 0x8fc0
movq %rbx, %rdi
leaq 0x2edd(%rip), %rsi      # 0x6072
callq 0x2230
jmp 0x31da
movl $0x1, %edx
movq 0x5e18(%rip), %rdi      # 0x8fc0
leaq 0x2ec8(%rip), %rsi      # 0x6077
callq 0x2230
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rdi
callq 0x5e2c
movq 0x5df0(%rip), %rdi      # 0x8fc0
movl %eax, %esi
callq 0x2340
movq %rax, %rbx
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x2230
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3203
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
incq %r15
movq -0x30(%rbp), %rax
movslq 0x8(%rax), %rax
cmpq %rax, %r15
jl 0x3131
movl $0x2, %edx
movq 0x5d9d(%rip), %rdi      # 0x8fc0
leaq 0x2f8b(%rip), %rsi      # 0x61b5
callq 0x2230
incq %r14
movq -0x30(%rbp), %rbx
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x3126
movq 0x5d76(%rip), %r14      # 0x8fc0
leaq 0x2e28(%rip), %rsi      # 0x6079
movl $0x9, %edx
movq %r14, %rdi
callq 0x2230
movl 0x4(%rbx), %esi
movq %r14, %rdi
callq 0x2340
leaq 0x2f46(%rip), %rsi      # 0x61b6
movl $0x1, %edx
movq %rax, %rdi
callq 0x2230
leaq 0x2dff(%rip), %rbx      # 0x6083
movq 0x5d45(%rip), %r12      # 0x8fd0
leaq -0x54(%rbp), %r13
movl $0x10, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2230
movq %r12, %rdi
movq %r13, %rsi
callq 0x2110
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %r15d
testb $0x5, %r15b
je 0x32f9
movl $0x21, %edx
movq %r14, %rdi
leaq 0x2dc9(%rip), %rsi      # 0x6094
callq 0x2230
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
xorl %esi, %esi
callq 0x2320
movq %r12, %rdi
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
movl $0xa, %edx
callq 0x2120
movl -0x54(%rbp), %eax
cmpl $0x2328, %eax           # imm = 0x2328
jne 0x331c
movl $0x2d, %edx
movq %r14, %rdi
leaq 0x2da4(%rip), %rsi      # 0x60b6
callq 0x2230
jmp 0x328f
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %ecx
leal (%rcx,%rcx,4), %edx
leal (%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
jle 0x3346
movl $0x33, %edx
movq %r14, %rdi
leaq 0x2da8(%rip), %rsi      # 0x60e4
callq 0x2230
jmp 0x328f
cmpl $0x2329, %eax           # imm = 0x2329
jl 0x3366
movl $0x10, %edx
movq %r14, %rdi
leaq 0x2dbc(%rip), %rsi      # 0x6118
callq 0x2230
jmp 0x328f
testb $0x5, %r15b
jne 0x328f
movq 0x5c49(%rip), %r14      # 0x8fc0
leaq 0x2e38(%rip), %r15      # 0x61b6
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2230
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2230
movl -0x54(%rbp), %esi
movq -0x30(%rbp), %rdi
callq 0x33e8
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x33c4
movq %rax, %rbx
jmp 0x33e0
jmp 0x33c4
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x33e0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2370