// File: /workspace/github_cpp_makefile_star2_O2/Stygain[P]bandwidth-monitor/src/main.cpp
// Function: assessGraphUISize()
GraphMode assessGraphUISize()
{
	int numWide = 0;
	int numTall = 0;
	if (COLS > (GRAPH_MIN_WIDTH * 4))
	{
		// Or if the screen is wide enough add the other graphs
		logger->Log("Wide enough for four\n");
		numWide = 4;
	}
	else if (COLS > (GRAPH_MIN_WIDTH * 2))
	{
		// Or if the screen is wide enough add the other graphs
		logger->Log("Wide enough for two ");
		logger->Log(std::to_string(COLS));
		logger->Log(":");
		logger->Log(std::to_string(GRAPH_MIN_WIDTH*2));
		logger->Log("\n");
		numWide = 2;
	}
	else
	{
		logger->Log("Wide enough for one ");
		logger->Log(std::to_string(COLS));
		logger->Log(":");
		logger->Log(std::to_string(GRAPH_MIN_WIDTH*2));
		logger->Log("\n");
		numWide = 1;
	}

	logger->Log("Available vertical space: ");
	logger->Log(std::to_string((LINES - ((interfaceRows.size() * 3) + 1) - 2)));
	logger->Log(":");
	logger->Log(std::to_string(GRAPH_MIN_HEIGHT));
	logger->Log("\n");
	// If the screen is tall enough, add in the other graphs
	if ((LINES - ((interfaceRows.size() * 3) + 1) - 2) > (GRAPH_MIN_HEIGHT * 4))
	{
		logger->Log("Tall enough for four\n");
		numTall = 32;
	}
	else if ((LINES - ((interfaceRows.size() * 3) + 1) - 2) > (GRAPH_MIN_HEIGHT * 2))
	{
		logger->Log("Tall enough for two\n");
		numTall = 16;
	}
	else
	{
		logger->Log("Tall enough for one\n");
		numTall = 8;
	}

	logger->Log("Values: ");
	logger->Log(std::to_string(numWide));
	logger->Log("x");
	logger->Log(std::to_string(numTall));
	logger->Log(" | ");
	logger->Log(std::to_string(numWide | numTall));
	logger->Log("\n");

	// Translate numWide and numTall to GM types
	switch (numWide | numTall)
	{
		case 4 | 8:
		case 4 | 16:
		case 4 | 32:
		{
			logger->Log("Returning 4 wide\n");
			return GM_FOUR_WIDE;
		}
		case 2 | 8:
		{
			logger->Log("Returning 2 wide\n");
			return GM_TWO_WIDE;
		}
		case 2 | 16:
		case 2 | 32:
		{
			logger->Log("Returning 2 wide 2 tall\n");
			return GM_TWO_WIDE_TWO_TALL;
		}
		case 1 | 32:
		{
			logger->Log("Returning 4 tall\n");
			return GM_FOUR_TALL;
		}
		case 1 | 16:
		{
			logger->Log("Returning 2 tall\n");
			return GM_TWO_TALL;
		}
		case 1 | 8:
		{
			logger->Log("Returning 1\n");
			return GM_ONE;
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq 0xbee6(%rip), %r14      # 0xffc0
movl (%r14), %eax
cmpl $0xb5, %eax
jl 0x4102
leaq 0xc28d(%rip), %rax      # 0x10378
movq (%rax), %rdi
leaq 0x70b6(%rip), %rsi      # 0xb1ab
callq 0x97a6
pushq $0x4
popq %rbx
jmp 0x4211
leaq 0xc26f(%rip), %r15      # 0x10378
movq (%r15), %rdi
cmpl $0x5b, %eax
jl 0x4188
leaq 0x70a9(%rip), %rsi      # 0xb1c1
callq 0x97a6
movq (%r15), %rbx
movl (%r14), %esi
leaq 0x100(%rsp), %r14
movq %r14, %rdi
callq 0x6ce9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x97b8
leaq 0x100(%rsp), %rdi
callq 0x3170
movq (%r15), %rdi
leaq 0x7081(%rip), %rsi      # 0xb1d6
callq 0x97a6
movq (%r15), %rbx
leaq 0xe0(%rsp), %r14
pushq $0x5a
popq %rsi
movq %r14, %rdi
callq 0x6ce9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x97b8
pushq $0x2
popq %rbx
leaq 0xe0(%rsp), %rdi
jmp 0x41fd
leaq 0x7049(%rip), %rsi      # 0xb1d8
callq 0x97a6
movq (%r15), %rbx
movl (%r14), %esi
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0x6ce9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x97b8
leaq 0xc0(%rsp), %rdi
callq 0x3170
movq (%r15), %rdi
leaq 0x700a(%rip), %rsi      # 0xb1d6
callq 0x97a6
movq (%r15), %rbx
leaq 0xa0(%rsp), %r14
pushq $0x5a
popq %rsi
movq %r14, %rdi
callq 0x6ce9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x97b8
pushq $0x1
popq %rbx
leaq 0xa0(%rsp), %rdi
callq 0x3170
movq (%r15), %rdi
leaq 0x70b7(%rip), %rsi      # 0xb2c3
callq 0x97a6
leaq 0xc160(%rip), %r13      # 0x10378
movq (%r13), %rdi
leaq 0x6fca(%rip), %rsi      # 0xb1ed
callq 0x97a6
movq (%r13), %r15
movq 0xbd7d(%rip), %r12      # 0xffb0
movslq (%r12), %rax
movq 0xc0d2(%rip), %rcx      # 0x10310
subq 0xc0c3(%rip), %rcx      # 0x10308
sarq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
notq %rcx
leaq (%rax,%rcx), %rsi
addq $-0x2, %rsi
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0x6d42
movq %r15, %rdi
movq %r14, %rsi
callq 0x97b8
leaq 0x80(%rsp), %rdi
callq 0x3170
movq (%r13), %rdi
leaq 0x6f4b(%rip), %rsi      # 0xb1d6
callq 0x97a6
movq (%r13), %r15
leaq 0x60(%rsp), %r14
pushq $0x14
popq %rsi
movq %r14, %rdi
callq 0x6ce9
movq %r15, %rdi
movq %r14, %rsi
callq 0x97b8
leaq 0x60(%rsp), %rdi
callq 0x3170
movq (%r13), %rdi
leaq 0x6fff(%rip), %rsi      # 0xb2c3
callq 0x97a6
movslq (%r12), %rax
movq 0xc03c(%rip), %rcx      # 0x10310
subq 0xc02d(%rip), %rcx      # 0x10308
sarq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
notq %rcx
leaq (%rcx,%rax), %rdx
addq $-0x53, %rdx
cmpq $-0x52, %rdx
ja 0x4308
movq (%r13), %rdi
leaq 0x6f09(%rip), %rsi      # 0xb208
callq 0x97a6
pushq $0x20
jmp 0x4337
addq %rax, %rcx
addq $-0x2b, %rcx
movq (%r13), %rdi
cmpq $-0x2a, %rcx
ja 0x4329
leaq 0x6efe(%rip), %rsi      # 0xb21e
callq 0x97a6
pushq $0x10
jmp 0x4337
leaq 0x6f03(%rip), %rsi      # 0xb233
callq 0x97a6
pushq $0x8
popq %r15
movq (%r13), %rdi
leaq 0x6f04(%rip), %rsi      # 0xb248
callq 0x97a6
movq (%r13), %r12
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %ebx, %esi
callq 0x6ce9
movq %r12, %rdi
movq %r14, %rsi
callq 0x97b8
leaq 0x40(%rsp), %rdi
callq 0x3170
movq (%r13), %rdi
leaq 0x6ed5(%rip), %rsi      # 0xb251
callq 0x97a6
movq (%r13), %r12
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %esi
callq 0x6ce9
movq %r12, %rdi
movq %r14, %rsi
callq 0x97b8
leaq 0x20(%rsp), %rdi
callq 0x3170
movq (%r13), %rdi
leaq 0x6e9e(%rip), %rsi      # 0xb253
callq 0x97a6
movq (%r13), %r12
orl %ebx, %r15d
movq %rsp, %r14
movq %r14, %rdi
movl %r15d, %esi
callq 0x6ce9
movq %r12, %rdi
movq %r14, %rsi
callq 0x97b8
movq %rsp, %rdi
callq 0x3170
movq (%r13), %rdi
leaq 0x6ed6(%rip), %rsi      # 0xb2c3
callq 0x97a6
pushq $0x3
popq %rbx
leaq 0x6e5b(%rip), %rsi      # 0xb257
leal -0x9(%r15), %eax
cmpl $0xb, %eax
ja 0x4420
leaq 0x6c08(%rip), %rcx      # 0xb014
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebx, %ebx
leaq 0x6e9a(%rip), %rsi      # 0xb2b8
jmp 0x445a
cmpl $0x21, %r15d
je 0x4438
cmpl $0x22, %r15d
jne 0x445a
pushq $0x5
popq %rbx
leaq 0x6e45(%rip), %rsi      # 0xb27b
jmp 0x445a
pushq $0x4
popq %rbx
leaq 0x6e52(%rip), %rsi      # 0xb294
jmp 0x445a
pushq $0x2
popq %rbx
leaq 0x6e58(%rip), %rsi      # 0xb2a6
jmp 0x445a
pushq $0x1
popq %rbx
leaq 0x6e0f(%rip), %rsi      # 0xb269
movq (%r13), %rdi
callq 0x97a6
movl %ebx, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x4486
jmp 0x4486
jmp 0x4486
jmp 0x4486
jmp 0x4486
jmp 0x4486
jmp 0x4486
jmp 0x4486
movq %rax, %rbx
movq %r14, %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540