// File: /workspace/github_cpp_makefile_star2_O3/Stygain[P]bandwidth-monitor/src/graph.cpp
// Function: Graph::Resize(int, int, int, int)
void Graph::Resize(int placementX, int placementY, int width, int height)
{
	this->placementX = placementX;
	this->placementY = placementY;
	this->width = width;
	this->height = height;

	this->graphTitle->Resize(this->placementX + 1, this->placementY, this->width, 1);
	this->graphMaxItem->Resize(this->placementX + 2, this->placementY + 2, 5, 1);

	//TODO update the rows and columns as well
	int oldCols = this->numCols;
	this->numCols = (this->width - 3);
	std::vector<GraphDataColumn *> newCols;
	for (int i = 0; i < this->numCols; i++)
	{
		newCols.push_back(new GraphDataColumn(this->graphType, this->interfaces, this->interface));
	}

	int smallerCols = oldCols < this->numCols ? oldCols : this->numCols;
	for (int i = 1; i < smallerCols + 1; i++)
	{
		newCols[this->numCols - i]->SetValue(this->gDataCols[oldCols - i]->GetValue());
	}
	this->gDataCols.clear();
	this->gDataCols = newCols;

	for (size_t i = 0; i < (this->gDataCols.size() - 1); i++)
	{
		this->gDataCols[i]->SetNext(gDataCols[i+1]);
	}

	int oldRows = this->numRows;
	this->numRows = (this->height - 2);
	std::vector<GraphRow *> newRows;
	for (int i = 0; i < this->numRows; i++)
	{
		newRows.push_back(
			new GraphRow(
				1,
				(this->width - 3),
				(this->placementX + 1),
				(this->placementY + 1 + ((i * 1) + 1)),
				(this->numRows - i - 1),
				(this->numRows - 1)
			)
		);
	}

	this->gRows.clear();
	this->gRows = newRows;

	wresize(this->win, height, width);
	mvwin(this->win, this->placementY + 1, this->placementX);

	this->Update();

	this->graphTitle->Update();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movl %esi, 0x8(%rdi)
movl %edx, 0xc(%rdi)
movl %ecx, 0x10(%rdi)
movl %r8d, 0x8(%rsp)
movl %r8d, 0x14(%rdi)
movq 0x38(%rdi), %rdi
incl %esi
movl %ecx, 0xc(%rsp)
movl $0x1, %r8d
callq 0x85ce
movq 0x40(%rbx), %rdi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
addl $0x2, %esi
addl $0x2, %edx
movl $0x5, %ecx
movl $0x1, %r8d
callq 0x8656
movslq 0x1c(%rbx), %r14
movl 0x10(%rbx), %eax
leal -0x3(%rax), %edx
movl %edx, 0x1c(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpl $0x4, %eax
jl 0x8a6a
xorl %ebp, %ebp
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r12
movl $0x20, %edi
callq 0x32c0
movl 0x30(%rbx), %ecx
movl $0x0, (%rax)
movq $0x0, 0x18(%rax)
movl %ecx, 0x4(%rax)
movups 0x20(%rbx), %xmm0
movups %xmm0, 0x8(%rax)
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x907a
incl %ebp
movl 0x1c(%rbx), %edx
cmpl %edx, %ebp
jl 0x8a2b
cmpl %edx, %r14d
movl %edx, %ecx
cmovll %r14d, %ecx
testl %ecx, %ecx
jle 0x8aaf
movq 0x60(%rbx), %rax
movslq %edx, %rdx
incl %ecx
leaq (%rax,%r14,8), %rsi
shlq $0x3, %rdx
addq 0x30(%rsp), %rdx
negq %rcx
movq $-0x1, %rdi
movq (%rdx,%rdi,8), %r8
movq (%rsi,%rdi,8), %r9
movl (%r9), %r9d
movl %r9d, (%r8)
decq %rdi
cmpq %rdi, %rcx
jne 0x8a97
jmp 0x8ab3
movq 0x60(%rbx), %rax
leaq 0x60(%rbx), %rdi
cmpq %rax, 0x68(%rbx)
je 0x8ac1
movq %rax, 0x68(%rbx)
leaq 0x30(%rsp), %rsi
callq 0x8eb2
movq 0x60(%rbx), %rax
movq 0x68(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq $0x1, %rcx
je 0x8afb
movq (%rax), %rsi
movl $0x1, %edx
movq (%rax,%rdx,8), %rdi
movq %rdi, 0x18(%rsi)
incq %rdx
movq %rdi, %rsi
cmpq %rdx, %rcx
jne 0x8ae8
movl 0x14(%rbx), %eax
leal -0x2(%rax), %r15d
movl %r15d, 0x18(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x3, %eax
jl 0x8bab
movl $0x2, %ebp
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq 0x50(%rsp), %r12
movl $0x20, %edi
callq 0x32c0
movq %rax, %r13
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %esi
addl $-0x3, %esi
incl %ecx
movl 0xc(%rbx), %edx
addl %ebp, %edx
leal (%r15,%r14), %eax
decl %r15d
movl %r15d, 0xc(%r13)
movl %eax, 0x8(%r13)
movl %edx, 0x10(%r13)
movl %ecx, 0x14(%r13)
movl $0x1, 0x18(%r13)
movl %esi, 0x1c(%r13)
movl $0x1, %edi
callq 0x32e0
movq %rax, (%r13)
movq %rax, %rdi
callq 0x3310
movq %r13, 0x50(%rsp)
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x91ee
movl 0x18(%rbx), %r15d
leal 0x1(%rbp), %eax
decl %ebp
decl %r14d
cmpl %r15d, %ebp
movl %eax, %ebp
jl 0x8b30
leaq 0x48(%rbx), %rdi
movq 0x48(%rbx), %rax
cmpq %rax, 0x50(%rbx)
je 0x8bbd
movq %rax, 0x50(%rbx)
leaq 0x10(%rsp), %rsi
callq 0x8f96
movq (%rbx), %rdi
movl 0x8(%rsp), %esi
movl 0xc(%rsp), %edx
callq 0x31f0
movq (%rbx), %rdi
movl 0xc(%rbx), %esi
incl %esi
movl 0x8(%rbx), %edx
callq 0x3150
movq %rbx, %rdi
callq 0x8c8a
movq 0x38(%rbx), %rdi
callq 0x8548
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8c0f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32d0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8c26
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32d0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8c67
jmp 0x8c4b
movq %rax, %rbx
movl $0x20, %esi
movq %r13, %rdi
callq 0x32d0
jmp 0x8c4e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8c6a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32d0
jmp 0x8c6a
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8c81
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32d0
movq %rbx, %rdi
callq 0x3550
nop