// File: /workspace/github_cpp_makefile_star2_O3/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
movq 0xc393(%rip), %rcx      # 0x10330
movq 0xc384(%rip), %rax      # 0x10328
leal -0x1(%rdi), %edx
cmpl $0x3, %edx
ja 0x41f8
leaq 0x804d(%rip), %rsi      # 0xc004
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x8, %rdx
je 0x41f8
xorl %edx, %edx
movq %rdx, %rsi
incq %rdx
movq %rcx, %r8
subq %rax, %r8
sarq $0x3, %r8
cmpq %r8, %rdx
jae 0x4040
movq %rdx, %r8
movq (%rax,%rsi,8), %r9
movq 0x8(%r9), %r11
subq 0x20(%r9), %r11
movq (%rax,%r8,8), %r10
movq 0x8(%r10), %rbx
subq 0x20(%r10), %rbx
cmpq %rbx, %r11
jae 0x4024
movq %r10, (%rax,%rsi,8)
movq 0xc316(%rip), %rax      # 0x10328
movq %r9, (%rax,%r8,8)
movq 0xc313(%rip), %rcx      # 0x10330
movq 0xc304(%rip), %rax      # 0x10328
incq %r8
movq %rcx, %r9
subq %rax, %r9
sarq $0x3, %r9
cmpq %r9, %r8
jb 0x3fea
movq %rcx, %r8
subq %rax, %r8
sarq $0x3, %r8
decq %r8
cmpq %r8, %rdx
jb 0x3fd2
jmp 0x40d5
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x8, %rdx
je 0x41f8
xorl %edx, %edx
movq %rdx, %rsi
incq %rdx
movq %rcx, %r8
subq %rax, %r8
sarq $0x3, %r8
cmpq %r8, %rdx
jae 0x40cd
movq %rdx, %r8
movq (%rax,%rsi,8), %r9
movq 0x48(%r9), %r11
subq 0x58(%r9), %r11
movq (%rax,%r8,8), %r10
movq 0x48(%r10), %rbx
subq 0x58(%r10), %rbx
cmpq %rbx, %r11
jae 0x40b1
movq %r10, (%rax,%rsi,8)
movq 0xc289(%rip), %rax      # 0x10328
movq %r9, (%rax,%r8,8)
movq 0xc286(%rip), %rcx      # 0x10330
movq 0xc277(%rip), %rax      # 0x10328
incq %r8
movq %rcx, %r9
subq %rax, %r9
sarq $0x3, %r9
cmpq %r9, %r8
jb 0x4077
movq %rcx, %r8
subq %rax, %r8
sarq $0x3, %r8
decq %r8
cmpq %r8, %rdx
jb 0x405f
cmpl $0x4, %edi
je 0x4174
cmpl $0x3, %edi
jne 0x41f8
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x8, %rdx
je 0x41f8
xorl %edx, %edx
movq %rdx, %rsi
incq %rdx
movq %rcx, %rdi
subq %rax, %rdi
sarq $0x3, %rdi
cmpq %rdi, %rdx
jae 0x4167
movq %rdx, %rdi
movq (%rax,%rsi,8), %r8
movq 0x28(%r8), %r10
subq 0x40(%r8), %r10
movq (%rax,%rdi,8), %r9
movq 0x28(%r9), %r11
subq 0x40(%r9), %r11
cmpq %r11, %r10
jae 0x414b
movq %r9, (%rax,%rsi,8)
movq 0xc1ef(%rip), %rax      # 0x10328
movq %r8, (%rax,%rdi,8)
movq 0xc1ec(%rip), %rcx      # 0x10330
movq 0xc1dd(%rip), %rax      # 0x10328
incq %rdi
movq %rcx, %r8
subq %rax, %r8
sarq $0x3, %r8
cmpq %r8, %rdi
jb 0x4111
movq %rcx, %rdi
subq %rax, %rdi
sarq $0x3, %rdi
decq %rdi
cmpq %rdi, %rdx
jb 0x40f9
jmp 0x41f8
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x8, %rdx
je 0x41f8
xorl %edx, %edx
movq %rdx, %rsi
incq %rdx
movq %rcx, %rdi
subq %rax, %rdi
sarq $0x3, %rdi
cmpq %rdi, %rdx
jae 0x41f0
movq %rdx, %rdi
movq (%rax,%rsi,8), %r8
movq 0x60(%r8), %r10
subq 0x70(%r8), %r10
movq (%rax,%rdi,8), %r9
movq 0x60(%r9), %r11
subq 0x70(%r9), %r11
cmpq %r11, %r10
jae 0x41d4
movq %r9, (%rax,%rsi,8)
movq 0xc166(%rip), %rax      # 0x10328
movq %r8, (%rax,%rdi,8)
movq 0xc163(%rip), %rcx      # 0x10330
movq 0xc154(%rip), %rax      # 0x10328
incq %rdi
movq %rcx, %r8
subq %rax, %r8
sarq $0x3, %r8
cmpq %r8, %rdi
jb 0x419a
movq %rcx, %rdi
subq %rax, %rdi
sarq $0x3, %rdi
decq %rdi
cmpq %rdi, %rdx
jb 0x4182
cmpq %rax, %rcx
je 0x424d
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%rax,%rbx,8), %rdi
callq 0x9fe0
testb %al, %al
jne 0x4230
movq 0xc112(%rip), %rax      # 0x10328
movq (%rax,%rbx,8), %rdi
movslq %r14d, %r14
movq 0xc0ec(%rip), %rax      # 0x10310
movq (%rax,%r14,8), %rsi
callq 0x9fc0
incl %r14d
incq %rbx
movq 0xc0f6(%rip), %rcx      # 0x10330
movq 0xc0e7(%rip), %rax      # 0x10328
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbx
jb 0x4202
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3f3b