// File: bendem[P]DiskGraph/src/string_manips.cpp
// Function: displayGraph[abi:cxx11](unsigned int, unsigned int, char)
string displayGraph(unsigned percent, unsigned width, char graphChar) {
    if(width <= 2) {
        return "";
    }
    ostringstream ss;
    ss << '[' << GREEN;
    bool empty = false;
    for(unsigned i = 0; i < width-2; ++i) {
        if(!empty) {
            if (i > width / 4 * 3) {
                // More than 75%
                ss << RED;
            } else if (i >= width / 2) {
                // More than 50%
                ss << YELLOW;
            }
            if (i > percent * width / 100) {
                empty = true;
            }
        }
        ss << (empty ? ' ' : graphChar);
    }
    ss << RESET << ']';
    return ss.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x1b8(%rbp)
movb %cl, %al
movq %rdi, %rcx
movq %rcx, -0x1b0(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movb %al, -0x11(%rbp)
cmpl $0x2, -0x10(%rbp)
ja 0x7405
leaq -0x12(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x2310
movq -0x1b8(%rbp), %rdi
movq -0x1c0(%rbp), %rdx
leaq 0x2d5b(%rip), %rsi      # 0xa131
callq 0x2220
jmp 0x73dd
leaq -0x12(%rbp), %rdi
callq 0x21f0
jmp 0x75b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x21f0
jmp 0x75c2
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x2210
movq -0x1d0(%rbp), %rdi
movl $0x5b, %esi
callq 0x2200
movq %rax, -0x1c8(%rbp)
jmp 0x7432
movq -0x1c8(%rbp), %rdi
leaq 0x8228(%rip), %rsi      # 0xf668
callq 0x2170
jmp 0x7447
movb $0x0, -0x1a1(%rbp)
movl $0x0, -0x1a8(%rbp)
movl -0x1a8(%rbp), %eax
movl -0x10(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jae 0x7562
testb $0x1, -0x1a1(%rbp)
jne 0x7519
movl -0x1a8(%rbp), %eax
movl -0x10(%rbp), %ecx
shrl $0x2, %ecx
imull $0x3, %ecx, %ecx
cmpl %ecx, %eax
jbe 0x74c0
leaq 0x81b5(%rip), %rsi      # 0xf648
leaq -0x1a0(%rbp), %rdi
callq 0x2170
jmp 0x74a1
jmp 0x74e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x2050
jmp 0x75c2
movl -0x1a8(%rbp), %eax
movl -0x10(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jb 0x74e6
leaq 0x81b2(%rip), %rsi      # 0xf688
leaq -0x1a0(%rbp), %rdi
callq 0x2170
jmp 0x74e4
jmp 0x74e6
jmp 0x74e8
movl -0x1a8(%rbp), %eax
movl %eax, -0x1d4(%rbp)
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movl -0x1d4(%rbp), %eax
cmpl %ecx, %eax
jbe 0x7517
movb $0x1, -0x1a1(%rbp)
jmp 0x7519
testb $0x1, -0x1a1(%rbp)
je 0x752c
movb $0x20, %al
movb %al, -0x1d5(%rbp)
jmp 0x7535
movb -0x11(%rbp), %al
movb %al, -0x1d5(%rbp)
movb -0x1d5(%rbp), %al
movsbl %al, %esi
leaq -0x1a0(%rbp), %rdi
callq 0x2200
jmp 0x754c
jmp 0x754e
movl -0x1a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a8(%rbp)
jmp 0x7458
leaq 0x809f(%rip), %rsi      # 0xf608
leaq -0x1a0(%rbp), %rdi
callq 0x2170
movq %rax, -0x1e0(%rbp)
jmp 0x757e
movq -0x1e0(%rbp), %rdi
movl $0x5d, %esi
callq 0x2200
jmp 0x7591
movq -0x1b8(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x21c0
jmp 0x75a6
leaq -0x1a0(%rbp), %rdi
callq 0x2050
movq -0x1b0(%rbp), %rax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x2300
nopl (%rax,%rax)