// File: /workspace/github_cpp_makefile_star2_O1/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 0xbc5e(%rip), %rbx      # 0xffb8
movl (%rbx), %eax
cmpl $0xb4, %eax
jle 0x4374
movl $0x4, %ebx
leaq 0x7e2c(%rip), %rsi      # 0xc19b
jmp 0x4620
leaq 0xc005(%rip), %r12      # 0x10380
movq (%r12), %rdi
cmpl $0x5b, %eax
jl 0x43ff
leaq 0x7e26(%rip), %rsi      # 0xc1b1
callq 0xa5cc
movq (%r12), %rax
movq %rax, (%rsp)
movl (%rbx), %ebx
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x4488
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x4476
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x4485
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x4488
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x43bd
addl $-0x3, %r14d
jmp 0x4488
leaq 0x7dc2(%rip), %rsi      # 0xc1c8
callq 0xa5cc
movq (%r12), %rax
movq %rax, (%rsp)
movl (%rbx), %ebx
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x454c
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x447c
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x4549
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x454c
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x4438
addl $-0x3, %r14d
jmp 0x454c
addl $-0x2, %r14d
jmp 0x4488
addl $-0x2, %r14d
jmp 0x454c
decl %r14d
shrl $0x1f, %ebx
movl %ebx, %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 %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x7a24
movq (%rsp), %rdi
movq %r15, %rsi
callq 0xa61a
movq 0xc8(%rsp), %rdi
cmpq %r13, %rdi
je 0x44ea
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r12), %rdi
leaq 0x7cd1(%rip), %rsi      # 0xc1c6
callq 0xa5cc
movq (%r12), %rbx
leaq 0x118(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x108(%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 0xa61a
movq 0x108(%rsp), %rdi
movl $0x2, %ebx
jmp 0x4608
decl %r14d
shrl $0x1f, %ebx
movl %ebx, %esi
addl %r14d, %esi
leaq 0xb8(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xa8(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x3340
movq (%r15), %rdi
addq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x7a24
movq (%rsp), %rdi
movq %r15, %rsi
callq 0xa61a
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x45ae
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r12), %rdi
leaq 0x7c0d(%rip), %rsi      # 0xc1c6
callq 0xa5cc
movq (%r12), %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 0xa61a
movq 0xe8(%rsp), %rdi
movl $0x1, %ebx
cmpq %r13, %rdi
je 0x4619
movq (%r13), %rsi
incq %rsi
callq 0x32d0
leaq 0x7c93(%rip), %rsi      # 0xc2b3
leaq 0xbd59(%rip), %r14      # 0x10380
movq (%r14), %rdi
callq 0xa5cc
movq (%r14), %rdi
leaq 0x7ba4(%rip), %rsi      # 0xc1dd
callq 0xa5cc
movq (%r14), %r14
movq 0xb960(%rip), %rbp      # 0xffa8
movslq (%rbp), %rax
movq 0xbcc5(%rip), %rcx      # 0x10318
subq 0xbcb6(%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 0x46c7
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %r15, %rcx
cmpq $0x63, %rcx
jbe 0x46c0
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x46c5
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x46c7
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x468a
addl $-0x3, %esi
jmp 0x46c7
addl $-0x2, %esi
jmp 0x46c7
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 0x7a91
movq %r14, %rdi
movq %r12, %rsi
callq 0xa61a
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
leaq 0xbc6b(%rip), %r12      # 0x10380
je 0x4727
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r12), %rdi
leaq 0x7a94(%rip), %rsi      # 0xc1c6
callq 0xa5cc
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 0xa61a
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x4785
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32d0
movq (%r12), %rdi
leaq 0x7b23(%rip), %rsi      # 0xc2b3
callq 0xa5cc
movslq (%rbp), %rax
movq 0xbb78(%rip), %rcx      # 0x10318
subq 0xbb69(%rip), %rcx      # 0x10310
sarq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
notq %rcx
leaq (%rcx,%rax), %rdx
addq $-0x53, %rdx
cmpq $-0x52, %rdx
ja 0x47d8
movq (%r12), %rdi
leaq 0x7a2d(%rip), %rsi      # 0xc1f8
callq 0xa5cc
movl $0x20, %r14d
jmp 0x47fb
addq %rax, %rcx
addq $-0x2b, %rcx
movq (%r12), %rdi
cmpq $-0x2a, %rcx
ja 0x4802
leaq 0x7a1e(%rip), %rsi      # 0xc20e
callq 0xa5cc
movl $0x10, %r14d
movl $0x2, %ebp
jmp 0x4819
leaq 0x7a1a(%rip), %rsi      # 0xc223
callq 0xa5cc
movl $0x8, %r14d
movl $0x1, %ebp
movq (%r12), %rdi
leaq 0x7a14(%rip), %rsi      # 0xc238
callq 0xa5cc
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 0x7a24
movq %r15, %rdi
movq %r12, %rsi
callq 0xa61a
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x487f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0xbafa(%rip), %r15      # 0x10380
movq (%r15), %rdi
leaq 0x79b1(%rip), %rsi      # 0xc241
callq 0xa5cc
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 0x7a24
movq %r15, %rdi
movq %r12, %rsi
callq 0xa61a
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x48e5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0xba94(%rip), %r15      # 0x10380
movq (%r15), %rdi
leaq 0x794d(%rip), %rsi      # 0xc243
callq 0xa5cc
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 0x7a24
movq %r15, %rdi
movq %r12, %rsi
callq 0xa61a
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x495b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0xba1e(%rip), %r15      # 0x10380
movq (%r15), %rdi
leaq 0x7947(%rip), %rsi      # 0xc2b3
callq 0xa5cc
movl $0x3, %ebx
leaq 0x78ca(%rip), %rsi      # 0xc247
cmpl $0x20, %r14d
jg 0x49a2
addl $-0x9, %r14d
leaq 0x7686(%rip), %rax      # 0xc014
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
xorl %ebx, %ebx
leaq 0x7908(%rip), %rsi      # 0xc2a8
jmp 0x49e4
cmpl $0x21, %r14d
je 0x49bc
cmpl $0x22, %r14d
jne 0x49e4
movl $0x5, %ebx
leaq 0x78b1(%rip), %rsi      # 0xc26b
jmp 0x49e4
movl $0x4, %ebx
leaq 0x78bc(%rip), %rsi      # 0xc284
jmp 0x49e4
movl $0x1, %ebx
leaq 0x7883(%rip), %rsi      # 0xc259
jmp 0x49e4
movl $0x2, %ebx
leaq 0x78b2(%rip), %rsi      # 0xc296
movq (%r15), %rdi
callq 0xa5cc
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 0xe8(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0x108(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0x8(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0x48(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0x68(%rsp), %rdi
jmp 0x4a67
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x4a78
movq (%r13), %rsi
incq %rsi
callq 0x32d0
movq %rbx, %rdi
callq 0x3550