// File: /workspace/github_cpp_makefile_star2_O2/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 0x400f
leaq 0x720e(%rip), %rcx      # 0xb004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xc522(%rip), %rax      # 0x10328
movq 0xc513(%rip), %rcx      # 0x10320
xorl %edx, %edx
movq %rax, %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
decq %rsi
cmpq %rsi, %rdx
jae 0x3f21
leaq 0x1(%rdx), %rsi
movq %rsi, %r8
movq %rax, %r9
subq %rcx, %r9
sarq $0x3, %r9
cmpq %r9, %r8
jae 0x3e7a
movq (%rcx,%rdx,8), %r9
movq 0x8(%r9), %r11
subq 0x20(%r9), %r11
movq (%rcx,%r8,8), %r10
movq 0x8(%r10), %rbx
subq 0x20(%r10), %rbx
cmpq %rbx, %r11
jae 0x3e75
movq %r10, (%rcx,%rdx,8)
movq 0xc4bd(%rip), %rax      # 0x10320
movq %r9, (%rax,%r8,8)
movq 0xc4ba(%rip), %rax      # 0x10328
movq 0xc4ab(%rip), %rcx      # 0x10320
incq %r8
jmp 0x3e2c
movq %rsi, %rdx
jmp 0x3e0f
movq 0xc4a2(%rip), %rax      # 0x10328
movq 0xc493(%rip), %rcx      # 0x10320
jmp 0x3fa1
movq 0xc48f(%rip), %rax      # 0x10328
movq 0xc480(%rip), %rcx      # 0x10320
jmp 0x3f2f
movq 0xc47c(%rip), %rax      # 0x10328
movq 0xc46d(%rip), %rcx      # 0x10320
xorl %edx, %edx
movq %rax, %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
decq %rsi
cmpq %rsi, %rdx
jae 0x3f21
leaq 0x1(%rdx), %rsi
movq %rsi, %r8
movq %rax, %r9
subq %rcx, %r9
sarq $0x3, %r9
cmpq %r9, %r8
jae 0x3f1c
movq (%rcx,%rdx,8), %r9
movq 0x48(%r9), %r11
subq 0x58(%r9), %r11
movq (%rcx,%r8,8), %r10
movq 0x48(%r10), %rbx
subq 0x58(%r10), %rbx
cmpq %rbx, %r11
jae 0x3f17
movq %r10, (%rcx,%rdx,8)
movq 0xc41b(%rip), %rax      # 0x10320
movq %r9, (%rax,%r8,8)
movq 0xc418(%rip), %rax      # 0x10328
movq 0xc409(%rip), %rcx      # 0x10320
incq %r8
jmp 0x3ece
movq %rsi, %rdx
jmp 0x3eb5
cmpl $0x3, %edi
je 0x3fa1
cmpl $0x4, %edi
jne 0x400f
xorl %edx, %edx
movq %rax, %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
decq %rsi
cmpq %rsi, %rdx
jae 0x400f
leaq 0x1(%rdx), %rsi
movq %rsi, %rdi
movq %rax, %r8
subq %rcx, %r8
sarq $0x3, %r8
cmpq %r8, %rdi
jae 0x3f9c
movq (%rcx,%rdx,8), %r8
movq 0x60(%r8), %r10
subq 0x70(%r8), %r10
movq (%rcx,%rdi,8), %r9
movq 0x60(%r9), %r11
subq 0x70(%r9), %r11
cmpq %r11, %r10
jae 0x3f97
movq %r9, (%rcx,%rdx,8)
movq 0xc39b(%rip), %rax      # 0x10320
movq %r8, (%rax,%rdi,8)
movq 0xc398(%rip), %rax      # 0x10328
movq 0xc389(%rip), %rcx      # 0x10320
incq %rdi
jmp 0x3f4e
movq %rsi, %rdx
jmp 0x3f31
xorl %edx, %edx
movq %rax, %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
decq %rsi
cmpq %rsi, %rdx
jae 0x400f
leaq 0x1(%rdx), %rsi
movq %rsi, %rdi
movq %rax, %r8
subq %rcx, %r8
sarq $0x3, %r8
cmpq %r8, %rdi
jae 0x400a
movq (%rcx,%rdx,8), %r8
movq 0x28(%r8), %r10
subq 0x40(%r8), %r10
movq (%rcx,%rdi,8), %r9
movq 0x28(%r9), %r11
subq 0x40(%r9), %r11
cmpq %r11, %r10
jae 0x4005
movq %r9, (%rcx,%rdx,8)
movq 0xc32d(%rip), %rax      # 0x10320
movq %r8, (%rax,%rdi,8)
movq 0xc32a(%rip), %rax      # 0x10328
movq 0xc31b(%rip), %rcx      # 0x10320
incq %rdi
jmp 0x3fbc
movq %rsi, %rdx
jmp 0x3fa3
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0xc30d(%rip), %rcx      # 0x10328
movq 0xc2fe(%rip), %rax      # 0x10320
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r14
jae 0x4060
movq (%rax,%r14,8), %rdi
callq 0x92ca
testb %al, %al
jne 0x405b
movq 0xc2de(%rip), %rax      # 0x10320
movq (%rax,%r14,8), %rdi
movslq %ebx, %rbx
movq 0xc2b8(%rip), %rax      # 0x10308
movq (%rax,%rbx,8), %rsi
callq 0x92aa
incl %ebx
incq %r14
jmp 0x4014
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3d96