// File: Stygain[P]bandwidth-monitor/src/interface.cpp
// Function: Interface::Print()
void Interface::Print()
{
	unsigned long int printableRBytes = (this->r_bytes - this->r_bytesZeroed);
	char rBytesUnit[3];
	strcpy(rBytesUnit, "B");
	if (printableRBytes > 1000)
	{
		printableRBytes = printableRBytes / 1000;
		strcpy(rBytesUnit, "KB");
	}
	if (printableRBytes > 1000)
	{
		printableRBytes = printableRBytes / 1000;
		strcpy(rBytesUnit, "MB");
	}
	if (printableRBytes > 1000)
	{
		printableRBytes = printableRBytes / 1000;
		strcpy(rBytesUnit, "GB");
	}
	if (printableRBytes > 1000)
	{
		printableRBytes = printableRBytes / 1000;
		strcpy(rBytesUnit, "TB");
	}
	unsigned long int printableRPackets = (this->r_packets - this->r_packetsZeroed);
	unsigned long int printableTBytes = (this->t_bytes - this->t_bytesZeroed);
	char tBytesUnit[3];
	strcpy(tBytesUnit, "B");
	if (printableTBytes > 1000)
	{
		printableTBytes = printableTBytes / 1000;
		strcpy(tBytesUnit, "KB");
	}
	if (printableTBytes > 1000)
	{
		printableTBytes = printableTBytes / 1000;
		strcpy(tBytesUnit, "MB");
	}
	if (printableTBytes > 1000)
	{
		printableTBytes = printableTBytes / 1000;
		strcpy(tBytesUnit, "GB");
	}
	if (printableTBytes > 1000)
	{
		printableTBytes = printableTBytes / 1000;
		strcpy(tBytesUnit, "TB");
	}
	unsigned long int printableTPackets = (this->t_packets - this->t_packetsZeroed);

	if (!this->hidden)
	{
		werase(this->interfaceRow->win);
		wborder(this->interfaceRow->win, 0, 0, 0, 0, 0, 0, 0, 0);

		if (this->active) {
			wattron(this->interfaceRow->win, COLOR_PAIR(ACTIVE_COLOR));
		}

		mvwprintw(this->interfaceRow->win, 1, 1,
				"%*s | %10lu %2s | %9lu | %10lu %2s | %9lu",
				longest,
				this->name,
				printableRBytes,
				rBytesUnit,
				printableRPackets,
				printableTBytes,
				tBytesUnit,
				printableTPackets);

		if (this->active) {
			wattroff(this->interfaceRow->win, COLOR_PAIR(ACTIVE_COLOR));
		}

		wrefresh(this->interfaceRow->win);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdi, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, -0x58(%rbp)
movq 0x8(%rcx), %rax
subq 0x20(%rcx), %rax
movq %rax, -0x28(%rbp)
leaq -0x2b(%rbp), %rdi
leaq 0x398b(%rip), %rsi      # 0x1666b
callq 0x32d0
cmpq $0x3e8, -0x28(%rbp)     # imm = 0x3E8
jbe 0x12d11
movq -0x28(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x28(%rbp)
leaq -0x2b(%rbp), %rdi
leaq 0x3958(%rip), %rsi      # 0x16664
callq 0x32d0
cmpq $0x3e8, -0x28(%rbp)     # imm = 0x3E8
jbe 0x12d3d
movq -0x28(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x28(%rbp)
leaq -0x2b(%rbp), %rdi
leaq 0x392f(%rip), %rsi      # 0x16667
callq 0x32d0
cmpq $0x3e8, -0x28(%rbp)     # imm = 0x3E8
jbe 0x12d69
movq -0x28(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x28(%rbp)
leaq -0x2b(%rbp), %rdi
leaq 0x3906(%rip), %rsi      # 0x1666a
callq 0x32d0
cmpq $0x3e8, -0x28(%rbp)     # imm = 0x3E8
jbe 0x12d95
movq -0x28(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x28(%rbp)
leaq -0x2b(%rbp), %rdi
leaq 0x38dd(%rip), %rsi      # 0x1666d
callq 0x32d0
movq -0x58(%rbp), %rcx
movq 0x48(%rcx), %rax
subq 0x58(%rcx), %rax
movq %rax, -0x38(%rbp)
movq 0x28(%rcx), %rax
subq 0x40(%rcx), %rax
movq %rax, -0x40(%rbp)
leaq -0x43(%rbp), %rdi
leaq 0x38af(%rip), %rsi      # 0x1666b
callq 0x32d0
cmpq $0x3e8, -0x40(%rbp)     # imm = 0x3E8
jbe 0x12ded
movq -0x40(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x40(%rbp)
leaq -0x43(%rbp), %rdi
leaq 0x387c(%rip), %rsi      # 0x16664
callq 0x32d0
cmpq $0x3e8, -0x40(%rbp)     # imm = 0x3E8
jbe 0x12e19
movq -0x40(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x40(%rbp)
leaq -0x43(%rbp), %rdi
leaq 0x3853(%rip), %rsi      # 0x16667
callq 0x32d0
cmpq $0x3e8, -0x40(%rbp)     # imm = 0x3E8
jbe 0x12e45
movq -0x40(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x40(%rbp)
leaq -0x43(%rbp), %rdi
leaq 0x382a(%rip), %rsi      # 0x1666a
callq 0x32d0
cmpq $0x3e8, -0x40(%rbp)     # imm = 0x3E8
jbe 0x12e71
movq -0x40(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x40(%rbp)
leaq -0x43(%rbp), %rdi
leaq 0x3801(%rip), %rsi      # 0x1666d
callq 0x32d0
movq -0x58(%rbp), %rax
movq 0x60(%rax), %rcx
subq 0x70(%rax), %rcx
movq %rcx, -0x50(%rbp)
testb $0x1, 0xb1(%rax)
jne 0x12fa1
movq -0x58(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
callq 0x3060
movq -0x58(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x31e0
movq -0x58(%rbp), %rax
testb $0x1, 0xb0(%rax)
je 0x12f03
movq -0x58(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
movl $0x200, %esi            # imm = 0x200
xorl %eax, %eax
movl %eax, %edx
callq 0x31a0
movq -0x58(%rbp), %rax
movq 0xa8(%rax), %rcx
movq (%rcx), %rdi
movl 0xb4(%rax), %r8d
movq (%rax), %r9
movq -0x28(%rbp), %r15
leaq -0x2b(%rbp), %r14
movq -0x38(%rbp), %rbx
movq -0x40(%rbp), %r11
leaq -0x43(%rbp), %r10
movq -0x50(%rbp), %rax
movl $0x1, %edx
leaq 0x3731(%rip), %rcx      # 0x16670
movl %edx, %esi
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movb $0x0, %al
callq 0x30d0
movq -0x58(%rbp), %rax
testb $0x1, 0xb0(%rax)
je 0x12f8e
movq -0x58(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
movl $0x200, %esi            # imm = 0x200
xorl %eax, %eax
movl %eax, %edx
callq 0x3420
movq -0x58(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
callq 0x3390
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)