// File: acherkaoui[P]HTOP/terminal/terminal.cpp
// Function: Curses::ProgressBar[abi:cxx11](_win_st*, int, int, float)
std::string Curses::ProgressBar(WINDOW *win, int y, int x, float val)
{
	std::string bar = "[                    ]";
	wattron(win, COLOR_PAIR(8));
	mvwaddch(win, y, x, ACS_CKBOARD);
	wattroff(win, COLOR_PAIR(8));
	int round = (int)floor(val / 5) *5;
	int nbBars = round / 5;
	int i;
	for (i = 1; i < nbBars - 1; i++)
	{
		if (i <= nbBars && i <= 6)
		{
			wattron(win, COLOR_PAIR(4));
			mvwaddch(win, y, x + i, ACS_CKBOARD);
			wattroff(win, COLOR_PAIR(4));
			bar[i] = '=';
		}
		else if (i <= nbBars && i <= 9)
		{
			wattron(win, COLOR_PAIR(7));
			mvwaddch(win, y, x + i, ACS_CKBOARD);
			wattroff(win, COLOR_PAIR(7));
			bar[i] = '=';
		}
		else if (i <= nbBars && i <= 23)
		{
			wattron(win, COLOR_PAIR(5));
			mvwaddch(win, y, x + i, ACS_CKBOARD);
			wattroff(win, COLOR_PAIR(5));
			bar[i] = '=';
		}
	}
	wattron(win, COLOR_PAIR(8));
	mvwaddch(win, y, x + 22, ACS_CKBOARD);
	wattroff(win, COLOR_PAIR(8));
	return bar;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movss %xmm0, -0x24(%rbp)
movb $0x0, -0x25(%rbp)
leaq -0x26(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x4700
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq 0x3cda(%rip), %rsi      # 0x14878
callq 0x45a0
jmp 0x10ba5
leaq -0x26(%rbp), %rdi
callq 0x44a0
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x800, %esi            # imm = 0x800
callq 0x4250
jmp 0x10bc2
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x4460
movl %eax, -0x5c(%rbp)
jmp 0x10bd6
movl -0x5c(%rbp), %eax
cmpl $-0x1, %eax
jne 0x10be0
jmp 0x10bfa
movq -0x18(%rbp), %rdi
movq 0xa3ad(%rip), %rax      # 0x1af98
movl 0x184(%rax), %esi
callq 0x4160
jmp 0x10bf8
jmp 0x10bfa
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x800, %esi            # imm = 0x800
callq 0x4550
jmp 0x10c0e
movss -0x24(%rbp), %xmm0
movss 0x3755(%rip), %xmm1     # 0x14370
divss %xmm1, %xmm0
callq 0x12ac0
movss %xmm0, -0x60(%rbp)
jmp 0x10c2b
movss -0x60(%rbp), %xmm0
cvttss2si %xmm0, %eax
imull $0x5, %eax, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl $0x5, %ecx
cltd
idivl %ecx
movl %eax, -0x3c(%rbp)
movl $0x1, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x10e7d
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jg 0x10d2e
cmpl $0x6, -0x40(%rbp)
jg 0x10d2e
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x400, %esi            # imm = 0x400
callq 0x4250
jmp 0x10c8a
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x40(%rbp), %eax
addl %eax, %edx
callq 0x4460
movl %eax, -0x64(%rbp)
jmp 0x10ca3
movl -0x64(%rbp), %eax
cmpl $-0x1, %eax
jne 0x10cad
jmp 0x10cc7
movq -0x18(%rbp), %rdi
movq 0xa2e0(%rip), %rax      # 0x1af98
movl 0x184(%rax), %esi
callq 0x4160
jmp 0x10cc5
jmp 0x10cc7
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x400, %esi            # imm = 0x400
callq 0x4550
jmp 0x10cdb
movq -0x50(%rbp), %rdi
movslq -0x40(%rbp), %rsi
callq 0x4780
movq %rax, -0x70(%rbp)
jmp 0x10cee
movq -0x70(%rbp), %rax
movb $0x3d, (%rax)
jmp 0x10e6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x26(%rbp), %rdi
callq 0x44a0
jmp 0x10f06
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x42a0
jmp 0x10f06
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jg 0x10dc8
cmpl $0x9, -0x40(%rbp)
jg 0x10dc8
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x700, %esi            # imm = 0x700
callq 0x4250
jmp 0x10d58
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x40(%rbp), %eax
addl %eax, %edx
callq 0x4460
movl %eax, -0x74(%rbp)
jmp 0x10d71
movl -0x74(%rbp), %eax
cmpl $-0x1, %eax
jne 0x10d7b
jmp 0x10d95
movq -0x18(%rbp), %rdi
movq 0xa212(%rip), %rax      # 0x1af98
movl 0x184(%rax), %esi
callq 0x4160
jmp 0x10d93
jmp 0x10d95
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x700, %esi            # imm = 0x700
callq 0x4550
jmp 0x10da9
movq -0x50(%rbp), %rdi
movslq -0x40(%rbp), %rsi
callq 0x4780
movq %rax, -0x80(%rbp)
jmp 0x10dbc
movq -0x80(%rbp), %rax
movb $0x3d, (%rax)
jmp 0x10e6b
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jg 0x10e69
cmpl $0x17, -0x40(%rbp)
jg 0x10e69
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x500, %esi            # imm = 0x500
callq 0x4250
jmp 0x10df2
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x40(%rbp), %eax
addl %eax, %edx
callq 0x4460
movl %eax, -0x84(%rbp)
jmp 0x10e0e
movl -0x84(%rbp), %eax
cmpl $-0x1, %eax
jne 0x10e1b
jmp 0x10e35
movq -0x18(%rbp), %rdi
movq 0xa172(%rip), %rax      # 0x1af98
movl 0x184(%rax), %esi
callq 0x4160
jmp 0x10e33
jmp 0x10e35
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x500, %esi            # imm = 0x500
callq 0x4550
jmp 0x10e49
movq -0x50(%rbp), %rdi
movslq -0x40(%rbp), %rsi
callq 0x4780
movq %rax, -0x90(%rbp)
jmp 0x10e5f
movq -0x90(%rbp), %rax
movb $0x3d, (%rax)
jmp 0x10e6b
jmp 0x10e6d
jmp 0x10e6f
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x10c4f
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x800, %esi            # imm = 0x800
callq 0x4250
jmp 0x10e91
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
addl $0x16, %edx
callq 0x4460
movl %eax, -0x94(%rbp)
jmp 0x10eab
movl -0x94(%rbp), %eax
cmpl $-0x1, %eax
jne 0x10eb8
jmp 0x10ed2
movq -0x18(%rbp), %rdi
movq 0xa0d5(%rip), %rax      # 0x1af98
movl 0x184(%rax), %esi
callq 0x4160
jmp 0x10ed0
jmp 0x10ed2
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x800, %esi            # imm = 0x800
callq 0x4550
jmp 0x10ee6
movb $0x1, -0x25(%rbp)
testb $0x1, -0x25(%rbp)
jne 0x10ef9
movq -0x50(%rbp), %rdi
callq 0x42a0
movq -0x58(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x46f0
nop