// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
leal -0x1(%rdi), %eax
cmpl $0x3, %eax
ja 0x4278
leaq 0x8041(%rip), %rcx      # 0xc004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xc35d(%rip), %rax      # 0x10330
subq 0xc34e(%rip), %rax      # 0x10328
cmpq $0x8, %rax
je 0x4119
xorl %eax, %eax
movq %rax, %rcx
incq %rax
movq 0xc33d(%rip), %rsi      # 0x10330
movq 0xc32e(%rip), %rdx      # 0x10328
subq %rdx, %rsi
sarq $0x3, %rsi
cmpq %rsi, %rax
jae 0x4052
movq %rax, %rsi
movq (%rdx,%rcx,8), %r8
movq 0x8(%r8), %r10
subq 0x20(%r8), %r10
movq (%rdx,%rsi,8), %r9
movq 0x8(%r9), %r11
subq 0x20(%r9), %r11
cmpq %r11, %r10
jae 0x4035
movq %r9, (%rdx,%rcx,8)
movq 0xc2f7(%rip), %rdx      # 0x10328
movq %r8, (%rdx,%rsi,8)
incq %rsi
movq 0xc2f1(%rip), %r8       # 0x10330
movq 0xc2e2(%rip), %rdx      # 0x10328
subq %rdx, %r8
sarq $0x3, %r8
cmpq %r8, %rsi
jb 0x4009
movq 0xc2d7(%rip), %rcx      # 0x10330
subq 0xc2c8(%rip), %rcx      # 0x10328
sarq $0x3, %rcx
decq %rcx
cmpq %rcx, %rax
jb 0x3fe6
jmp 0x4119
movq 0xc2b4(%rip), %rax      # 0x10330
subq 0xc2a5(%rip), %rax      # 0x10328
cmpq $0x8, %rax
je 0x4119
xorl %eax, %eax
movq %rax, %rcx
incq %rax
movq 0xc294(%rip), %rsi      # 0x10330
movq 0xc285(%rip), %rdx      # 0x10328
subq %rdx, %rsi
sarq $0x3, %rsi
cmpq %rsi, %rax
jae 0x40fb
movq %rax, %rsi
movq (%rdx,%rcx,8), %r8
movq 0x48(%r8), %r10
subq 0x58(%r8), %r10
movq (%rdx,%rsi,8), %r9
movq 0x48(%r9), %r11
subq 0x58(%r9), %r11
cmpq %r11, %r10
jae 0x40de
movq %r9, (%rdx,%rcx,8)
movq 0xc24e(%rip), %rdx      # 0x10328
movq %r8, (%rdx,%rsi,8)
incq %rsi
movq 0xc248(%rip), %r8       # 0x10330
movq 0xc239(%rip), %rdx      # 0x10328
subq %rdx, %r8
sarq $0x3, %r8
cmpq %r8, %rsi
jb 0x40b2
movq 0xc22e(%rip), %rcx      # 0x10330
subq 0xc21f(%rip), %rcx      # 0x10328
sarq $0x3, %rcx
decq %rcx
cmpq %rcx, %rax
jb 0x408f
cmpl $0x4, %edi
je 0x41d4
cmpl $0x3, %edi
jne 0x4278
movq 0xc1fe(%rip), %rax      # 0x10330
subq 0xc1ef(%rip), %rax      # 0x10328
cmpq $0x8, %rax
je 0x4278
xorl %eax, %eax
movq %rax, %rcx
incq %rax
movq 0xc1de(%rip), %rsi      # 0x10330
movq 0xc1cf(%rip), %rdx      # 0x10328
subq %rdx, %rsi
sarq $0x3, %rsi
cmpq %rsi, %rax
jae 0x41b1
movq %rax, %rsi
movq (%rdx,%rcx,8), %rdi
movq 0x28(%rdi), %r9
subq 0x40(%rdi), %r9
movq (%rdx,%rsi,8), %r8
movq 0x28(%r8), %r10
subq 0x40(%r8), %r10
cmpq %r10, %r9
jae 0x4194
movq %r8, (%rdx,%rcx,8)
movq 0xc198(%rip), %rdx      # 0x10328
movq %rdi, (%rdx,%rsi,8)
incq %rsi
movq 0xc192(%rip), %rdi      # 0x10330
movq 0xc183(%rip), %rdx      # 0x10328
subq %rdx, %rdi
sarq $0x3, %rdi
cmpq %rdi, %rsi
jb 0x4168
movq 0xc178(%rip), %rcx      # 0x10330
subq 0xc169(%rip), %rcx      # 0x10328
sarq $0x3, %rcx
decq %rcx
cmpq %rcx, %rax
jb 0x4145
jmp 0x4278
movq 0xc155(%rip), %rax      # 0x10330
subq 0xc146(%rip), %rax      # 0x10328
cmpq $0x8, %rax
je 0x4278
xorl %eax, %eax
movq %rax, %rcx
incq %rax
movq 0xc135(%rip), %rsi      # 0x10330
movq 0xc126(%rip), %rdx      # 0x10328
subq %rdx, %rsi
sarq $0x3, %rsi
cmpq %rsi, %rax
jae 0x425a
movq %rax, %rsi
movq (%rdx,%rcx,8), %rdi
movq 0x60(%rdi), %r9
subq 0x70(%rdi), %r9
movq (%rdx,%rsi,8), %r8
movq 0x60(%r8), %r10
subq 0x70(%r8), %r10
cmpq %r10, %r9
jae 0x423d
movq %r8, (%rdx,%rcx,8)
movq 0xc0ef(%rip), %rdx      # 0x10328
movq %rdi, (%rdx,%rsi,8)
incq %rsi
movq 0xc0e9(%rip), %rdi      # 0x10330
movq 0xc0da(%rip), %rdx      # 0x10328
subq %rdx, %rdi
sarq $0x3, %rdi
cmpq %rdi, %rsi
jb 0x4211
movq 0xc0cf(%rip), %rcx      # 0x10330
subq 0xc0c0(%rip), %rcx      # 0x10328
sarq $0x3, %rcx
decq %rcx
cmpq %rcx, %rax
jb 0x41ee
movq 0xc0a9(%rip), %rax      # 0x10328
cmpq %rax, 0xc0aa(%rip)      # 0x10330
je 0x42d8
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%rax,%rbx,8), %rdi
callq 0xa04a
testb %al, %al
jne 0x42bb
movq 0xc087(%rip), %rax      # 0x10328
movq (%rax,%rbx,8), %rdi
movslq %r14d, %r14
movq 0xc061(%rip), %rax      # 0x10310
movq (%rax,%r14,8), %rsi
callq 0xa02a
incl %r14d
incq %rbx
movq 0xc06b(%rip), %rcx      # 0x10330
movq 0xc05c(%rip), %rax      # 0x10328
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbx
jb 0x428d
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3f55