// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq 0xbce9(%rip), %r14      # 0xffb8
movl (%r14), %eax
cmpl $0xb5, %eax
jl 0x42f9
leaq 0xc0a0(%rip), %rax      # 0x10380
movq (%rax), %rdi
leaq 0x7ec1(%rip), %rsi      # 0xc1ab
callq 0xa57c
movl $0x4, %ebx
jmp 0x45dc
leaq 0xc080(%rip), %rbx      # 0x10380
movq (%rbx), %rdi
cmpl $0x5b, %eax
jl 0x4381
leaq 0x7eb2(%rip), %rsi      # 0xc1c1
callq 0xa57c
movq (%rbx), %rbx
movl (%r14), %r12d
movl %r12d, %ebp
negl %ebp
cmovsl %r12d, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x4408
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x43f6
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x4405
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x4408
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x433f
addl $-0x3, %r14d
jmp 0x4408
leaq 0x7e50(%rip), %rsi      # 0xc1d8
callq 0xa57c
movq (%rbx), %rbx
movl (%r14), %r12d
movl %r12d, %ebp
negl %ebp
cmovsl %r12d, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x44f6
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x43fc
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x44f3
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x44f6
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x43b8
addl $-0x3, %r14d
jmp 0x44f6
addl $-0x2, %r14d
jmp 0x4408
addl $-0x2, %r14d
jmp 0x44f6
decl %r14d
shrl $0x1f, %r12d
movl %r12d, %esi
addl %r14d, %esi
leaq 0x118(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x108(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r15), %rdi
addq %r12, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x79ca
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa5ca
movq 0x108(%rsp), %rdi
cmpq %r13, %rdi
leaq 0xbf20(%rip), %r15      # 0x10380
je 0x4472
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r15), %rdi
leaq 0x7d5a(%rip), %rsi      # 0xc1d6
callq 0xa57c
movq (%r15), %rbx
leaq 0xf8(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xe8(%rsp), %r14
movl $0x2, %esi
movq %r14, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r14), %rax
movw $0x3039, (%rax)         # imm = 0x3039
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa5ca
movq 0xe8(%rsp), %rdi
cmpq %r13, %rdi
je 0x44da
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r15), %rdi
leaq 0x7ddf(%rip), %rsi      # 0xc2c3
callq 0xa57c
movl $0x2, %ebx
jmp 0x45dc
decl %r14d
shrl $0x1f, %r12d
movl %r12d, %esi
addl %r14d, %esi
leaq 0xd8(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xc8(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r15), %rdi
addq %r12, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x79ca
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa5ca
movq 0xc8(%rsp), %rdi
cmpq %r13, %rdi
leaq 0xbe32(%rip), %r15      # 0x10380
je 0x4560
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r15), %rdi
leaq 0x7c6c(%rip), %rsi      # 0xc1d6
callq 0xa57c
movq (%r15), %rbx
leaq 0xb8(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xa8(%rsp), %r14
movl $0x2, %esi
movq %r14, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r14), %rax
movw $0x3039, (%rax)         # imm = 0x3039
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa5ca
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x45c8
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r15), %rdi
leaq 0x7cf1(%rip), %rsi      # 0xc2c3
callq 0xa57c
movl $0x1, %ebx
leaq 0xbd9d(%rip), %r14      # 0x10380
movq (%r14), %rdi
leaq 0x7c00(%rip), %rsi      # 0xc1ed
callq 0xa57c
movq (%r14), %r14
movq 0xb9ac(%rip), %rbp      # 0xffa8
movslq (%rbp), %rax
movq 0xbd11(%rip), %rcx      # 0x10318
subq 0xbd02(%rip), %rcx      # 0x10310
sarq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
notq %rcx
leaq (%rax,%rcx), %r15
addq $-0x2, %r15
movl $0x1, %esi
cmpq $0xa, %r15
jb 0x467b
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %r15, %rcx
cmpq $0x63, %rcx
jbe 0x4674
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x4679
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x467b
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x463e
addl $-0x3, %esi
jmp 0x467b
addl $-0x2, %esi
jmp 0x467b
decl %esi
movl %esi, %esi
leaq 0x98(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x88(%rsp), %r12
movq %r12, %rdi
xorl %edx, %edx
callq 0x3340
movq (%r12), %rdi
movl 0x8(%r12), %esi
movq %r15, %rdx
callq 0x7a37
movq %r14, %rdi
movq %r12, %rsi
callq 0xa5ca
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
leaq 0xbcb7(%rip), %r12      # 0x10380
je 0x46db
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r12), %rdi
leaq 0x7af0(%rip), %rsi      # 0xc1d6
callq 0xa57c
movq (%r12), %r14
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x68(%rsp), %r15
movl $0x2, %esi
movq %r15, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r15), %rax
movw $0x3032, (%rax)         # imm = 0x3032
movq %r14, %rdi
movq %r15, %rsi
callq 0xa5ca
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x4739
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r12), %rdi
leaq 0x7b7f(%rip), %rsi      # 0xc2c3
callq 0xa57c
movslq (%rbp), %rax
movq 0xbbc4(%rip), %rcx      # 0x10318
subq 0xbbb5(%rip), %rcx      # 0x10310
sarq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
notq %rcx
leaq (%rcx,%rax), %rdx
addq $-0x53, %rdx
cmpq $-0x52, %rdx
ja 0x478c
movq (%r12), %rdi
leaq 0x7a89(%rip), %rsi      # 0xc208
callq 0xa57c
movl $0x20, %r14d
jmp 0x47af
addq %rax, %rcx
addq $-0x2b, %rcx
movq (%r12), %rdi
cmpq $-0x2a, %rcx
ja 0x47b6
leaq 0x7a7a(%rip), %rsi      # 0xc21e
callq 0xa57c
movl $0x10, %r14d
movl $0x2, %ebp
jmp 0x47cd
leaq 0x7a76(%rip), %rsi      # 0xc233
callq 0xa57c
movl $0x8, %r14d
movl $0x1, %ebp
movq (%r12), %rdi
leaq 0x7a70(%rip), %rsi      # 0xc248
callq 0xa57c
movq (%r12), %r15
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x48(%rsp), %r12
movl $0x1, %esi
movq %r12, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r12), %rdi
movl $0x1, %esi
movl %ebx, %edx
callq 0x79ca
movq %r15, %rdi
movq %r12, %rsi
callq 0xa5ca
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x4833
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0xbb46(%rip), %r15      # 0x10380
movq (%r15), %rdi
leaq 0x7a0d(%rip), %rsi      # 0xc251
callq 0xa57c
movq (%r15), %r15
movl %ebp, %esi
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r12), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x79ca
movq %r15, %rdi
movq %r12, %rsi
callq 0xa5ca
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x4899
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0xbae0(%rip), %r15      # 0x10380
movq (%r15), %rdi
leaq 0x79a9(%rip), %rsi      # 0xc253
callq 0xa57c
movq (%r15), %r15
orl %ebx, %r14d
cmpl $0xa, %r14d
movl $0x2, %ebx
sbbl $0x0, %ebx
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movl $0x2d, %edx
callq 0x3340
movq (%r12), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x79ca
movq %r15, %rdi
movq %r12, %rsi
callq 0xa5ca
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x490f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0xba6a(%rip), %r15      # 0x10380
movq (%r15), %rdi
leaq 0x79a3(%rip), %rsi      # 0xc2c3
callq 0xa57c
movl $0x3, %ebx
leaq 0x7926(%rip), %rsi      # 0xc257
cmpl $0x20, %r14d
jg 0x4956
addl $-0x9, %r14d
leaq 0x76d2(%rip), %rax      # 0xc014
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
xorl %ebx, %ebx
leaq 0x7964(%rip), %rsi      # 0xc2b8
jmp 0x4998
cmpl $0x21, %r14d
je 0x4970
cmpl $0x22, %r14d
jne 0x4998
movl $0x5, %ebx
leaq 0x790d(%rip), %rsi      # 0xc27b
jmp 0x4998
movl $0x4, %ebx
leaq 0x7918(%rip), %rsi      # 0xc294
jmp 0x4998
movl $0x1, %ebx
leaq 0x78df(%rip), %rsi      # 0xc269
jmp 0x4998
movl $0x2, %ebx
leaq 0x790e(%rip), %rsi      # 0xc2a6
movq (%r15), %rdi
callq 0xa57c
movl %ebx, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0x108(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0x48(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0x68(%rsp), %rdi
jmp 0x4a1b
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x4a2c
movq (%r13), %rsi
incq %rsi
callq 0x32d0
movq %rbx, %rdi
callq 0x3550