// File: Stygain[P]bandwidth-monitor/src/main.cpp
// Function: initializeInterfaceUI()
int initializeInterfaceUI()
{
	int placement = 1;

	for (size_t i = 0; i < interfaces.size(); ++i)
	{
		bool skip = false;
		if (!settings->root["hiddenInterfaces"].isNull() && settings->root["hiddenInterfaces"].isArray())
		{
			for (size_t j = 0; j < settings->root["hiddenInterfaces"].size(); ++j)
			{
				if (strcmp(settings->root["hiddenInterfaces"][(int)j].asString().c_str(), interfaces[i]->name) == 0)
				{
					logger->Log("Skipping hidden interface: ");
					logger->Log(interfaces[i]->name);
					logger->Log("\n");
					interfaces[i]->RemoveFromUI();
					skip = true;
				}
			}
		}

		if (!skip)
		{
			InterfaceRow *interfaceRow = new InterfaceRow(0, placement, COLS, 3);
			interfaceRows.push_back(interfaceRow);
			interfaces[i]->setInterfaceRow(interfaceRow);

			placement += 3;
		}
	}

	for (size_t i = 0; i < interfaces.size(); ++i)
	{
		interfaces[i]->Refresh();
	}

	refresh();

	return placement;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x1, -0x4(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq 0x1a3f7(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x41ce
movb $0x0, -0x11(%rbp)
leaq 0x1a43f(%rip), %rax     # 0x1e3d8
movq (%rax), %rdi
leaq 0x1217b(%rip), %rsi     # 0x1611e
callq 0x3140
movq %rax, %rdi
callq 0x34e0
testb $0x1, %al
jne 0x411e
leaq 0x1a419(%rip), %rax     # 0x1e3d8
movq (%rax), %rdi
leaq 0x12155(%rip), %rsi     # 0x1611e
callq 0x3140
movq %rax, %rdi
callq 0x3570
testb $0x1, %al
jne 0x3fdf
jmp 0x411e
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x1a3e2(%rip), %rax     # 0x1e3d8
movq (%rax), %rdi
leaq 0x1211e(%rip), %rsi     # 0x1611e
callq 0x3140
movq %rax, %rdi
callq 0x3550
movl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x411c
leaq 0x1a3b3(%rip), %rax     # 0x1e3d8
movq (%rax), %rdi
leaq 0x120ef(%rip), %rsi     # 0x1611e
callq 0x3140
movq %rax, %rdi
movq -0x20(%rbp), %rax
movl %eax, %esi
callq 0x3380
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x3600
leaq -0x40(%rbp), %rdi
callq 0x3160
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x1a30a(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x80(%rbp), %rdi
movq (%rax), %rax
movq (%rax), %rsi
callq 0x3460
movl %eax, -0x74(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3250
movl -0x74(%rbp), %eax
cmpl $0x0, %eax
jne 0x4109
leaq 0x1a333(%rip), %rax     # 0x1e3c8
movq (%rax), %rdi
leaq 0x12090(%rip), %rsi     # 0x1612f
callq 0x13910
leaq 0x1a31d(%rip), %rax     # 0x1e3c8
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x1a2b0(%rip), %rdi     # 0x1e370
callq 0x9c90
movq -0x88(%rbp), %rdi
movq (%rax), %rax
movq (%rax), %rsi
callq 0x138e0
leaq 0x1a2ea(%rip), %rax     # 0x1e3c8
movq (%rax), %rdi
leaq 0x1217b(%rip), %rsi     # 0x16263
callq 0x13910
movq -0x10(%rbp), %rsi
leaq 0x1a278(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rdi
callq 0x13080
movb $0x1, -0x11(%rbp)
jmp 0x410b
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3fe7
jmp 0x411e
testb $0x1, -0x11(%rbp)
jne 0x41bb
movl $0x18, %edi
callq 0x3320
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movl -0x4(%rbp), %edx
movq 0x19e77(%rip), %rax     # 0x1dfc0
movl (%rax), %ecx
xorl %esi, %esi
movl $0x3, %r8d
callq 0x123f0
jmp 0x415a
movq -0x90(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq 0x1a1ec(%rip), %rdi     # 0x1e358
leaq -0x48(%rbp), %rsi
callq 0x9cb0
movq -0x10(%rbp), %rsi
leaq 0x1a1f0(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rdi
movq -0x48(%rbp), %rsi
callq 0x13040
movl -0x4(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x4(%rbp)
jmp 0x41bb
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x18, %esi
callq 0x3330
jmp 0x4233
jmp 0x41bd
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x3f6a
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq 0x1a188(%rip), %rdi     # 0x1e370
callq 0x9c70
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0x4222
movq -0x60(%rbp), %rsi
leaq 0x1a169(%rip), %rdi     # 0x1e370
callq 0x9c90
movq (%rax), %rdi
callq 0x12610
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x41d6
callq 0x35a0
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x35c0
nopl (%rax)