// File: phillip-h[P]todo/src/draw.cpp
// Function: buildTitle[abi:cxx11](TodoList*)
std::string buildTitle(TodoList *list)
{
    std::string title = "[todo version "+vn+"]";

    unsigned cent = (COLS - list->name.size() - 2) / 2;

    for (unsigned i = title.size(); i < cent; i++){
        title += division;
    }

    title += "[";
    title += list->name;
    title += "]";

    std::string stats = "[" + list->completedStr() + "]";

    for (unsigned i = title.size() + stats.size(); i < (unsigned)COLS; i++){
        title += division;
    }

    title += stats;
    return title;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0xc8(%rbp)
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
leaq 0x62cc(%rip), %rsi      # 0x124eb
leaq 0xc432(%rip), %rdx      # 0x18658
leaq -0x38(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0xa580
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
leaq 0x5dbf(%rip), %rdx      # 0x1200a
callq 0xa530
jmp 0xc252
leaq -0x38(%rbp), %rdi
callq 0x4738
movq 0xbd3e(%rip), %rax      # 0x17fa0
movslq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x4270
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movq -0xd8(%rbp), %rax
subq %rcx, %rax
subq $0x2, %rax
shrq %rax
movl %eax, -0x48(%rbp)
callq 0x4270
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jae 0xc2f4
movq -0xc8(%rbp), %rdi
leaq 0xc423(%rip), %rsi      # 0x186d8
callq 0x44c0
jmp 0xc2bc
jmp 0xc2be
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xc29f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4738
jmp 0xc493
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xc487
movq -0xc8(%rbp), %rdi
leaq 0x6137(%rip), %rsi      # 0x12439
callq 0x4320
jmp 0xc309
movq -0xc8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x44c0
jmp 0xc31f
movq -0xc8(%rbp), %rdi
leaq 0x5cdd(%rip), %rsi      # 0x1200a
callq 0x4320
jmp 0xc334
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0xdeb0
jmp 0xc346
leaq 0x60ec(%rip), %rsi      # 0x12439
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0xc830
jmp 0xc362
leaq 0x5ca1(%rip), %rdx      # 0x1200a
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xa530
jmp 0xc37b
leaq -0x90(%rbp), %rdi
callq 0x4738
leaq -0xb0(%rbp), %rdi
callq 0x4738
movq -0xc8(%rbp), %rdi
callq 0x4270
movq %rax, -0xe0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4270
movq %rax, %rcx
movq -0xe0(%rbp), %rax
addq %rcx, %rax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movq 0xbbd1(%rip), %rcx      # 0x17fa0
cmpl (%rcx), %eax
jae 0xc446
movq -0xc8(%rbp), %rdi
leaq 0xc2f7(%rip), %rsi      # 0x186d8
callq 0x44c0
jmp 0xc3e8
jmp 0xc3ea
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0xc3c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xc421
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4738
leaq -0xb0(%rbp), %rdi
callq 0x4738
jmp 0xc487
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4738
jmp 0xc487
movq -0xc8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x44c0
jmp 0xc458
movb $0x1, -0x11(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4738
testb $0x1, -0x11(%rbp)
jne 0xc477
movq -0xc8(%rbp), %rdi
callq 0x4738
movq -0xd0(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x4738
movq -0x40(%rbp), %rdi
callq 0x4680
nopl (%rax)