// File: Stygain[P]bandwidth-monitor/src/main.cpp
// Function: sortInterfaces(InterfaceHeaderContent)
void sortInterfaces(InterfaceHeaderContent column)
{
	if (column == HEADER_RCVD_BYTES)
	{
		Interface *tmp = NULL;
		for (size_t i = 0; i < (interfaces.size() - 1); ++i)
		{
			for (size_t j = (i + 1); j < interfaces.size(); ++j)
			{
				if ((interfaces[i]->r_bytes - interfaces[i]->r_bytesZeroed) < (interfaces[j]->r_bytes - interfaces[j]->r_bytesZeroed))
				{
					tmp = interfaces[i];
					interfaces[i] = interfaces[j];
					interfaces[j] = tmp;
				}
			}
		}
	}
	else if (column == HEADER_RCVD_PKTS)
	{
		Interface *tmp = NULL;
		for (size_t i = 0; i < (interfaces.size() - 1); ++i)
		{
			for (size_t j = (i + 1); j < interfaces.size(); ++j)
			{
				if ((interfaces[i]->r_packets - interfaces[i]->r_packetsZeroed) < (interfaces[j]->r_packets - interfaces[j]->r_packetsZeroed))
				{
					tmp = interfaces[i];
					interfaces[i] = interfaces[j];
					interfaces[j] = tmp;
				}
			}
		}
	}
	if (column == HEADER_SENT_BYTES)
	{
		Interface *tmp = NULL;
		for (size_t i = 0; i < (interfaces.size() - 1); ++i)
		{
			for (size_t j = (i + 1); j < interfaces.size(); ++j)
			{
				if ((interfaces[i]->t_bytes - interfaces[i]->t_bytesZeroed) < (interfaces[j]->t_bytes - interfaces[j]->t_bytesZeroed))
				{
					tmp = interfaces[i];
					interfaces[i] = interfaces[j];
					interfaces[j] = tmp;
				}
			}
		}
	}
	else if (column == HEADER_SENT_PKTS)
	{
		Interface *tmp = NULL;
		for (size_t i = 0; i < (interfaces.size() - 1); ++i)
		{
			for (size_t j = (i + 1); j < interfaces.size(); ++j)
			{
				if ((interfaces[i]->t_packets - interfaces[i]->t_packetsZeroed) < (interfaces[j]->t_packets - interfaces[j]->t_packetsZeroed))
				{
					tmp = interfaces[i];
					interfaces[i] = interfaces[j];
					interfaces[j] = tmp;
				}
			}
		}
	}

	int interfaceRowIndex = 0;
	for (size_t i = 0; i < interfaces.size(); ++i)
	{
		if (!interfaces[i]->IsHidden())
		{
			interfaces[i]->setInterfaceRow(interfaceRows[interfaceRowIndex]);
			interfaceRowIndex++;
		}
	}

	updateInterfaceUI();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movl %edi, -0x4(%rbp)
cmpl $0x1, -0x4(%rbp)
jne 0x4472
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq 0x1a079(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0x80(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x446d
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq 0x1a042(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
jae 0x445a
movq -0x18(%rbp), %rsi
leaq 0x1a01f(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rsi
leaq 0x1a001(%rip), %rdi     # 0x1e370
callq 0x9c90
movq %rax, %rcx
movq -0xa0(%rbp), %rax
movq (%rcx), %rcx
subq 0x20(%rcx), %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rsi
leaq 0x19fd9(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rsi
leaq 0x19fbb(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x98(%rbp), %rcx
movq %rax, %rdx
movq -0x90(%rbp), %rax
movq (%rdx), %rdx
subq 0x20(%rdx), %rcx
cmpq %rcx, %rax
jae 0x4447
movq -0x18(%rbp), %rsi
leaq 0x19f8e(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rsi
leaq 0x19f77(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rsi
leaq 0x19f5d(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0xb0(%rbp), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x20(%rbp), %rsi
leaq 0x19f38(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0xa8(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x4449
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x431c
jmp 0x445c
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x42e8
jmp 0x461b
cmpl $0x2, -0x4(%rbp)
jne 0x4619
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq 0x19ed2(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0xb8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x4617
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq 0x19e98(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
jae 0x4604
movq -0x30(%rbp), %rsi
leaq 0x19e75(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x30(%rbp), %rsi
leaq 0x19e57(%rip), %rdi     # 0x1e370
callq 0x9c90
movq %rax, %rcx
movq -0xd8(%rbp), %rax
movq (%rcx), %rcx
subq 0x58(%rcx), %rax
movq %rax, -0xc8(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x19e2f(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x19e11(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0xd0(%rbp), %rcx
movq %rax, %rdx
movq -0xc8(%rbp), %rax
movq (%rdx), %rdx
subq 0x58(%rdx), %rcx
cmpq %rcx, %rax
jae 0x45f1
movq -0x30(%rbp), %rsi
leaq 0x19de4(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x19dcd(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x30(%rbp), %rsi
leaq 0x19db3(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0xe8(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x19d8e(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0xe0(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x45f3
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x44c6
jmp 0x4606
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x448c
jmp 0x4619
jmp 0x461b
cmpl $0x3, -0x4(%rbp)
jne 0x47c5
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq 0x19d29(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0xf0(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x47c0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq 0x19cef(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0xf8(%rbp), %rax
cmpq %rcx, %rax
jae 0x47ad
movq -0x48(%rbp), %rsi
leaq 0x19ccc(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x110(%rbp)
movq -0x48(%rbp), %rsi
leaq 0x19cae(%rip), %rdi     # 0x1e370
callq 0x9c90
movq %rax, %rcx
movq -0x110(%rbp), %rax
movq (%rcx), %rcx
subq 0x40(%rcx), %rax
movq %rax, -0x100(%rbp)
movq -0x50(%rbp), %rsi
leaq 0x19c86(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x108(%rbp)
movq -0x50(%rbp), %rsi
leaq 0x19c68(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x108(%rbp), %rcx
movq %rax, %rdx
movq -0x100(%rbp), %rax
movq (%rdx), %rdx
subq 0x40(%rdx), %rcx
cmpq %rcx, %rax
jae 0x479a
movq -0x48(%rbp), %rsi
leaq 0x19c3b(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x50(%rbp), %rsi
leaq 0x19c24(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0x120(%rbp)
movq -0x48(%rbp), %rsi
leaq 0x19c0a(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x120(%rbp), %rcx
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x50(%rbp), %rsi
leaq 0x19be5(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x118(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x479c
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x466f
jmp 0x47af
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x4635
jmp 0x496e
cmpl $0x4, -0x4(%rbp)
jne 0x496c
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq 0x19b7f(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0x128(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x496a
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x130(%rbp)
leaq 0x19b45(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0x130(%rbp), %rax
cmpq %rcx, %rax
jae 0x4957
movq -0x60(%rbp), %rsi
leaq 0x19b22(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x60(%rax), %rax
movq %rax, -0x148(%rbp)
movq -0x60(%rbp), %rsi
leaq 0x19b04(%rip), %rdi     # 0x1e370
callq 0x9c90
movq %rax, %rcx
movq -0x148(%rbp), %rax
movq (%rcx), %rcx
subq 0x70(%rcx), %rax
movq %rax, -0x138(%rbp)
movq -0x68(%rbp), %rsi
leaq 0x19adc(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq 0x60(%rax), %rax
movq %rax, -0x140(%rbp)
movq -0x68(%rbp), %rsi
leaq 0x19abe(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x140(%rbp), %rcx
movq %rax, %rdx
movq -0x138(%rbp), %rax
movq (%rdx), %rdx
subq 0x70(%rdx), %rcx
cmpq %rcx, %rax
jae 0x4944
movq -0x60(%rbp), %rsi
leaq 0x19a91(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x68(%rbp), %rsi
leaq 0x19a7a(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movq -0x60(%rbp), %rsi
leaq 0x19a60(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x158(%rbp), %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x68(%rbp), %rsi
leaq 0x19a3b(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x150(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x4946
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x4819
jmp 0x4959
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x47df
jmp 0x496c
jmp 0x496e
movl $0x0, -0x6c(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq 0x199e1(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0x160(%rbp), %rax
cmpq %rcx, %rax
jae 0x4a14
movq -0x78(%rbp), %rsi
leaq 0x199c2(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rdi
callq 0x130c0
testb $0x1, %al
jne 0x4a01
movq -0x78(%rbp), %rsi
leaq 0x199a6(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rax
movq %rax, -0x168(%rbp)
movslq -0x6c(%rbp), %rsi
leaq 0x19974(%rip), %rdi     # 0x1e358
callq 0x9d20
movq -0x168(%rbp), %rdi
movq (%rax), %rsi
callq 0x13040
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x4a03
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x497d
callq 0x4240
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)