// File: phillip-h[P]todo/src/draw.cpp
// Function: drawTasks(TodoList*, unsigned int)
void drawTasks(TodoList* list, unsigned selected)
{
    auto tasks = list->tasks();
    
    taskWin->clear();    

    if (tasks && tasks->size()){
        xpos = 1;
        ypos = 1;

        unsigned numTasks = height - 2;
        endTask = tasks->size();
        if (endTask > numTasks)
            endTask = numTasks;

        if (numTasks < tasks->size()){
            while (selected > (int) endTask + listOff - 2 && selected != 0)
                listOff++;
            while (selected < (int) startTask + listOff && 
                   selected != list->size() - 1)
                listOff--;
        } else{
            listOff = 0;
        }

        unsigned count = startTask + listOff;

        for (unsigned i = startTask + listOff; i < endTask + listOff &&
                                               i < tasks->size() ; i++){
            Task t = tasks->at(i);
            
            if (showNumbers){
                taskWin->inverse();
                taskWin->color(GUTTER_COLOR_PAIR);
                
                std::string number = std::to_string(count);
                if (!zeroIndexNumbers)
                    number = std::to_string(count + 1);
                while (number.size() < 2)
                    number = "0"+number;
                
                taskWin->print(number + ")", xpos, ypos);
                taskWin->colorOff(GUTTER_COLOR_PAIR);
                taskWin->inverseOff();
                xpos += 5;
            }
           
            if (i == selected){
                std::string tmp = tasks->at(i).task();
                if (tasks->at(i).div()){
                    taskWin->inverse();
                    taskWin->color(SELECT_COLOR_PAIR);
                    drawDivider(tmp.substr(5, tmp.size() - 5), ypos);
                    taskWin->colorOff(SELECT_COLOR_PAIR);
                    taskWin->inverseOff();
                    ypos++;
                    if (showNumbers){
                        xpos -= 5;
                    }
                    continue;
                }

                std::string line = tmp;
                unsigned pad = showNumbers ? 8 : 5;
                if (line.size() >= width - pad) {
                    line = line.substr(0, width - pad - 3) + "...";
                }
                if (highlightWholeLine){
                    for (int k = tmp.size() + xpos; k < width - 2; k++){
                        line += " ";
                    }
                }
                
                std::string mark = line.substr(0, STRING_COMPLETE.size());
                line = line.substr(mark.size());
                
                taskWin->inverse();

                taskWin->color(!t.completed() ? MARK_COLOR_PAIR
                                              : MARK_COLOR_PAIR_DONE); 
                taskWin->print(mark, xpos, ypos);
                taskWin->colorOff(!t.completed() ? MARK_COLOR_PAIR
                                                 : MARK_COLOR_PAIR_DONE);

                taskWin->color(SELECT_COLOR_PAIR);
                taskWin->print(line, xpos + mark.size(), ypos);
                taskWin->colorOff(SELECT_COLOR_PAIR);
                
                taskWin->inverseOff();
            } else{
                std::string tmp = tasks->at(i).task();
                if (tasks->at(i).div()){
                    drawDivider(tmp.substr(5, tmp.size() - 5), ypos);
                    ypos++;
                    if (showNumbers){
                        xpos -= 5;
                    }
                    continue;
                }
                
                std::string text = tmp;
                unsigned pad = showNumbers ? 8 : 5;
                if (text.size() >= width - pad) {
                    text = text.substr(0, width - pad - 3) + "...";
                }

                std::string mark = text.substr(0, STRING_COMPLETE.size());
                text = text.substr(mark.size());

                taskWin->color(!t.completed() ? MARK_COLOR_PAIR
                                              : MARK_COLOR_PAIR_DONE); 
                taskWin->print(mark, xpos, ypos);
                taskWin->colorOff(!t.completed() ? MARK_COLOR_PAIR
                                                 : MARK_COLOR_PAIR_DONE);

                taskWin->print(text, xpos + mark.size(), ypos);
            }
            ypos++;
            if (ypos > numTasks || i >= tasks->size() - 1){
                break;
            }
            if (showNumbers){
                xpos -= 5;
                count++;
            }
        }
    }
    
    taskWin->color(BORDER_COLOR_PAIR, true);
    taskWin->draw();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0xde10
movq %rax, -0x18(%rbp)
movq 0xd41a(%rip), %rdi      # 0x18740
callq 0x11ad0
cmpq $0x0, -0x18(%rbp)
je 0xc09b
movq -0x18(%rbp), %rdi
callq 0x87f0
cmpq $0x0, %rax
je 0xc09b
movl $0x1, 0xd415(%rip)      # 0x18768
movl $0x1, 0xd40f(%rip)      # 0x1876c
movl 0xd401(%rip), %eax      # 0x18764
subl $0x2, %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x87f0
movl %eax, 0xd3fc(%rip)      # 0x18774
movl 0xd3f6(%rip), %eax      # 0x18774
cmpl -0x1c(%rbp), %eax
jbe 0xb38c
movl -0x1c(%rbp), %eax
movl %eax, 0xd3e8(%rip)      # 0x18774
movl -0x1c(%rbp), %eax
movq %rax, -0x328(%rbp)
movq -0x18(%rbp), %rdi
callq 0x87f0
movq %rax, %rcx
movq -0x328(%rbp), %rax
cmpq %rcx, %rax
jae 0xb460
jmp 0xb3b4
movl -0xc(%rbp), %ecx
movl 0xd3b7(%rip), %edx      # 0x18774
addl 0xd3b5(%rip), %edx      # 0x18778
subl $0x2, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x329(%rbp)
jbe 0xb3df
cmpl $0x0, -0xc(%rbp)
setne %al
movb %al, -0x329(%rbp)
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0xb3eb
jmp 0xb3fc
movl 0xd387(%rip), %eax      # 0x18778
addl $0x1, %eax
movl %eax, 0xd37e(%rip)      # 0x18778
jmp 0xb3b4
jmp 0xb3fe
movl -0xc(%rbp), %ecx
movl 0xd369(%rip), %edx      # 0x18770
addl 0xd36b(%rip), %edx      # 0x18778
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x32a(%rbp)
jae 0xb441
movl -0xc(%rbp), %eax
movl %eax, -0x330(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd9c0
movl %eax, %ecx
movl -0x330(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
setne %al
movb %al, -0x32a(%rbp)
movb -0x32a(%rbp), %al
testb $0x1, %al
jne 0xb44d
jmp 0xb45e
movl 0xd325(%rip), %eax      # 0x18778
addl $-0x1, %eax
movl %eax, 0xd31c(%rip)      # 0x18778
jmp 0xb3fe
jmp 0xb46a
movl $0x0, 0xd30e(%rip)      # 0x18778
movl 0xd300(%rip), %eax      # 0x18770
addl 0xd302(%rip), %eax      # 0x18778
movl %eax, -0x20(%rbp)
movl 0xd2f1(%rip), %eax      # 0x18770
addl 0xd2f3(%rip), %eax      # 0x18778
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %ecx
movl 0xd2e3(%rip), %edx      # 0x18774
addl 0xd2e1(%rip), %edx      # 0x18778
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x331(%rbp)
jae 0xb4cc
movl -0x24(%rbp), %eax
movq %rax, -0x340(%rbp)
movq -0x18(%rbp), %rdi
callq 0x87f0
movq %rax, %rcx
movq -0x340(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x331(%rbp)
movb -0x331(%rbp), %al
testb $0x1, %al
jne 0xb4db
jmp 0xc099
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x8820
movq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0xc690
movq 0xd244(%rip), %rdi      # 0x18740
xorl %esi, %esi
callq 0x11c00
jmp 0xb505
movq 0xd234(%rip), %rdi      # 0x18740
movl $0x2, %esi
xorl %edx, %edx
callq 0x11d90
jmp 0xb51a
movl -0x20(%rbp), %esi
leaq -0x80(%rbp), %rdi
callq 0xc6d0
jmp 0xb528
jmp 0xb52a
leaq -0x80(%rbp), %rdi
callq 0x4270
cmpq $0x2, %rax
jae 0xb592
leaq 0x6fa5(%rip), %rsi      # 0x124e5
leaq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0xa580
jmp 0xb552
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4470
leaq -0xa0(%rbp), %rdi
callq 0x4738
jmp 0xb52a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xc08e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xb778
movq 0xd1a7(%rip), %rax      # 0x18740
movq %rax, -0x348(%rbp)
leaq 0x6e90(%rip), %rdx      # 0x12437
leaq -0xc0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xc7b0
jmp 0xb5b9
movq -0x348(%rbp), %rdi
movl 0xd1a2(%rip), %edx      # 0x18768
movl 0xd1a0(%rip), %ecx      # 0x1876c
leaq -0xc0(%rbp), %rsi
callq 0x11d30
jmp 0xb5da
leaq -0xc0(%rbp), %rdi
callq 0x4738
movq 0xd153(%rip), %rdi      # 0x18740
movl $0x2, %esi
xorl %edx, %edx
callq 0x11e00
jmp 0xb5fb
movq 0xd13e(%rip), %rdi      # 0x18740
xorl %esi, %esi
callq 0x11c60
jmp 0xb60b
movl 0xd157(%rip), %eax      # 0x18768
addl $0x5, %eax
movl %eax, 0xd14e(%rip)      # 0x18768
leaq -0x80(%rbp), %rdi
callq 0x4738
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jne 0xbb94
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x8820
movq %rax, -0x350(%rbp)
jmp 0xb646
movq -0x350(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0xcb10
jmp 0xb65b
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x8820
movq %rax, -0x358(%rbp)
jmp 0xb672
movq -0x358(%rbp), %rdi
callq 0xcf90
movb %al, -0x359(%rbp)
jmp 0xb686
movb -0x359(%rbp), %al
testb $0x1, %al
jne 0xb695
jmp 0xb7b4
movq 0xd0a4(%rip), %rdi      # 0x18740
xorl %esi, %esi
callq 0x11c00
jmp 0xb6a5
movq 0xd094(%rip), %rdi      # 0x18740
movl $0x3, %esi
xorl %edx, %edx
callq 0x11d90
jmp 0xb6ba
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x4270
movq -0x368(%rbp), %rsi
movq %rax, %rcx
addq $-0x5, %rcx
leaq -0x100(%rbp), %rdi
movl $0x5, %edx
callq 0x4370
jmp 0xb6ee
movl 0xd078(%rip), %esi      # 0x1876c
leaq -0x100(%rbp), %rdi
callq 0xc4a0
jmp 0xb702
leaq -0x100(%rbp), %rdi
callq 0x4738
movq 0xd02b(%rip), %rdi      # 0x18740
movl $0x3, %esi
xorl %edx, %edx
callq 0x11e00
jmp 0xb723
movq 0xd016(%rip), %rdi      # 0x18740
xorl %esi, %esi
callq 0x11c60
jmp 0xb733
movl 0xd033(%rip), %eax      # 0x1876c
addl $0x1, %eax
movl %eax, 0xd02a(%rip)      # 0x1876c
movl 0xd020(%rip), %eax      # 0x18768
subl $0x5, %eax
movl %eax, 0xd017(%rip)      # 0x18768
movl $0x8, -0x104(%rbp)
jmp 0xbb0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4738
leaq -0x80(%rbp), %rdi
callq 0x4738
jmp 0xc08e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xbb83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x4738
jmp 0xbb83
leaq -0x128(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x41c0
jmp 0xb7c9
movl $0x8, -0x12c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x4270
movl 0xcf7b(%rip), %ecx      # 0x18760
subl -0x12c(%rbp), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jb 0xb899
movl 0xcf64(%rip), %eax      # 0x18760
movl -0x12c(%rbp), %ecx
subl %ecx, %eax
addl $-0x3, %eax
movl %eax, %ecx
xorl %eax, %eax
movl %eax, %edx
leaq -0x170(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x4370
jmp 0xb822
leaq 0x6cbe(%rip), %rdx      # 0x124e7
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0xa530
jmp 0xb83e
leaq -0x128(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x4470
leaq -0x150(%rbp), %rdi
callq 0x4738
leaq -0x170(%rbp), %rdi
callq 0x4738
jmp 0xb899
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xbb77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x4738
jmp 0xbb77
leaq -0xe0(%rbp), %rdi
callq 0x4270
movl 0xcebd(%rip), %ecx      # 0x18768
addq %rcx, %rax
movl %eax, -0x174(%rbp)
movl -0x174(%rbp), %eax
movl 0xcea0(%rip), %ecx      # 0x18760
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0xb8ef
leaq 0x6bc5(%rip), %rsi      # 0x12493
leaq -0x128(%rbp), %rdi
callq 0x4320
jmp 0xb8dc
jmp 0xb8de
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x174(%rbp)
jmp 0xb8b4
leaq 0xcdc2(%rip), %rdi      # 0x186b8
callq 0x4270
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x198(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x4370
jmp 0xb917
leaq -0x198(%rbp), %rdi
callq 0x4270
movq %rax, %rdx
leaq -0x1b8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
movq $-0x1, %rcx
callq 0x4370
jmp 0xb942
leaq -0x128(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
movq %rsi, -0x370(%rbp)
callq 0x4470
movq -0x370(%rbp), %rdi
callq 0x4738
movq 0xcdd1(%rip), %rdi      # 0x18740
xorl %esi, %esi
callq 0x11c00
jmp 0xb978
movq 0xcdc1(%rip), %rax      # 0x18740
movq %rax, -0x380(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xd010
movb %al, -0x371(%rbp)
jmp 0xb997
movq -0x380(%rbp), %rdi
movb -0x371(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
addl $0x5, %esi
xorl %edx, %edx
callq 0x11d90
jmp 0xb9b6
movq 0xcd83(%rip), %rax      # 0x18740
movq %rax, -0x388(%rbp)
leaq -0x1d8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x41c0
jmp 0xb9d9
movq -0x388(%rbp), %rdi
movl 0xcd82(%rip), %edx      # 0x18768
movl 0xcd80(%rip), %ecx      # 0x1876c
leaq -0x1d8(%rbp), %rsi
callq 0x11d30
jmp 0xb9fa
leaq -0x1d8(%rbp), %rdi
callq 0x4738
movq 0xcd33(%rip), %rax      # 0x18740
movq %rax, -0x398(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xd010
movb %al, -0x389(%rbp)
jmp 0xba25
movq -0x398(%rbp), %rdi
movb -0x389(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
addl $0x5, %esi
xorl %edx, %edx
callq 0x11e00
jmp 0xba44
movq 0xccf5(%rip), %rdi      # 0x18740
movl $0x3, %esi
xorl %edx, %edx
callq 0x11d90
jmp 0xba59
movq 0xcce0(%rip), %rax      # 0x18740
movq %rax, -0x3a0(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x41c0
jmp 0xba7c
movl 0xcce6(%rip), %eax      # 0x18768
movl %eax, -0x3a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x4270
movl -0x3a4(%rbp), %edx
movq -0x3a0(%rbp), %rdi
addl %eax, %edx
movl 0xccc3(%rip), %ecx      # 0x1876c
leaq -0x1f8(%rbp), %rsi
callq 0x11d30
jmp 0xbab7
leaq -0x1f8(%rbp), %rdi
callq 0x4738
movq 0xcc76(%rip), %rdi      # 0x18740
movl $0x3, %esi
xorl %edx, %edx
callq 0x11e00
jmp 0xbad8
movq 0xcc61(%rip), %rdi      # 0x18740
xorl %esi, %esi
callq 0x11c60
jmp 0xbae8
leaq -0x198(%rbp), %rdi
callq 0x4738
leaq -0x128(%rbp), %rdi
callq 0x4738
movl $0x0, -0x104(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x4738
movl -0x104(%rbp), %eax
testl %eax, %eax
jne 0xc054
jmp 0xbb26
jmp 0xbfe6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xbb6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x4738
jmp 0xbb6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x4738
leaq -0x198(%rbp), %rdi
callq 0x4738
leaq -0x128(%rbp), %rdi
callq 0x4738
leaq -0xe0(%rbp), %rdi
callq 0x4738
jmp 0xc08e
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x8820
movq %rax, -0x3b0(%rbp)
jmp 0xbbab
movq -0x3b0(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0xcb10
jmp 0xbbc0
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x8820
movq %rax, -0x3b8(%rbp)
jmp 0xbbd7
movq -0x3b8(%rbp), %rdi
callq 0xcf90
movb %al, -0x3b9(%rbp)
jmp 0xbbeb
movb -0x3b9(%rbp), %al
testb $0x1, %al
jne 0xbbfa
jmp 0xbca9
leaq -0x218(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x4270
movq -0x3c8(%rbp), %rsi
movq %rax, %rcx
addq $-0x5, %rcx
leaq -0x238(%rbp), %rdi
movl $0x5, %edx
callq 0x4370
jmp 0xbc2e
movl 0xcb38(%rip), %esi      # 0x1876c
leaq -0x238(%rbp), %rdi
callq 0xc4a0
jmp 0xbc42
leaq -0x238(%rbp), %rdi
callq 0x4738
movl 0xcb18(%rip), %eax      # 0x1876c
addl $0x1, %eax
movl %eax, 0xcb0f(%rip)      # 0x1876c
movl 0xcb05(%rip), %eax      # 0x18768
subl $0x5, %eax
movl %eax, 0xcafc(%rip)      # 0x18768
movl $0x8, -0x104(%rbp)
jmp 0xbf5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xbfd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x4738
jmp 0xbfd5
leaq -0x258(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x41c0
jmp 0xbcbe
movl $0x8, -0x25c(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x4270
movl 0xca86(%rip), %ecx      # 0x18760
subl -0x25c(%rbp), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jb 0xbd8e
movl 0xca6f(%rip), %eax      # 0x18760
movl -0x25c(%rbp), %ecx
subl %ecx, %eax
addl $-0x3, %eax
movl %eax, %ecx
xorl %eax, %eax
movl %eax, %edx
leaq -0x2a0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x4370
jmp 0xbd17
leaq 0x67c9(%rip), %rdx      # 0x124e7
leaq -0x280(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0xa530
jmp 0xbd33
leaq -0x258(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x4470
leaq -0x280(%rbp), %rdi
callq 0x4738
leaq -0x2a0(%rbp), %rdi
callq 0x4738
jmp 0xbd8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xbfc9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x4738
jmp 0xbfc9
leaq 0xc923(%rip), %rdi      # 0x186b8
callq 0x4270
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x2c0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x4370
jmp 0xbdb6
leaq -0x2c0(%rbp), %rdi
callq 0x4270
movq %rax, %rdx
leaq -0x2e0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
movq $-0x1, %rcx
callq 0x4370
jmp 0xbde1
leaq -0x258(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
movq %rsi, -0x3e0(%rbp)
callq 0x4470
movq -0x3e0(%rbp), %rdi
callq 0x4738
movq 0xc932(%rip), %rax      # 0x18740
movq %rax, -0x3d8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xd010
movb %al, -0x3c9(%rbp)
jmp 0xbe26
movq -0x3d8(%rbp), %rdi
movb -0x3c9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
addl $0x5, %esi
xorl %edx, %edx
callq 0x11d90
jmp 0xbe45
movq 0xc8f4(%rip), %rax      # 0x18740
movq %rax, -0x3e8(%rbp)
leaq -0x300(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x41c0
jmp 0xbe68
movq -0x3e8(%rbp), %rdi
movl 0xc8f3(%rip), %edx      # 0x18768
movl 0xc8f1(%rip), %ecx      # 0x1876c
leaq -0x300(%rbp), %rsi
callq 0x11d30
jmp 0xbe89
leaq -0x300(%rbp), %rdi
callq 0x4738
movq 0xc8a4(%rip), %rax      # 0x18740
movq %rax, -0x3f8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xd010
movb %al, -0x3e9(%rbp)
jmp 0xbeb4
movq -0x3f8(%rbp), %rdi
movb -0x3e9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
addl $0x5, %esi
xorl %edx, %edx
callq 0x11e00
jmp 0xbed3
movq 0xc866(%rip), %rax      # 0x18740
movq %rax, -0x400(%rbp)
leaq -0x320(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x41c0
jmp 0xbef6
movl 0xc86c(%rip), %eax      # 0x18768
movl %eax, -0x404(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x4270
movl -0x404(%rbp), %edx
movq -0x400(%rbp), %rdi
addl %eax, %edx
movl 0xc849(%rip), %ecx      # 0x1876c
leaq -0x320(%rbp), %rsi
callq 0x11d30
jmp 0xbf31
leaq -0x320(%rbp), %rdi
callq 0x4738
leaq -0x2c0(%rbp), %rdi
callq 0x4738
leaq -0x258(%rbp), %rdi
callq 0x4738
movl $0x0, -0x104(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x4738
movl -0x104(%rbp), %eax
testl %eax, %eax
jne 0xc054
jmp 0xbf7b
jmp 0xbfe6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xbfbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x4738
jmp 0xbfbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x4738
leaq -0x2c0(%rbp), %rdi
callq 0x4738
leaq -0x258(%rbp), %rdi
callq 0x4738
leaq -0x218(%rbp), %rdi
callq 0x4738
jmp 0xc08e
movl 0xc780(%rip), %eax      # 0x1876c
addl $0x1, %eax
movl %eax, 0xc777(%rip)      # 0x1876c
movl 0xc771(%rip), %eax      # 0x1876c
cmpl -0x1c(%rbp), %eax
ja 0xc026
movl -0x24(%rbp), %eax
movq %rax, -0x410(%rbp)
movq -0x18(%rbp), %rdi
callq 0x87f0
movq %rax, %rcx
movq -0x410(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jb 0xc032
movl $0x6, -0x104(%rbp)
jmp 0xc054
movl 0xc730(%rip), %eax      # 0x18768
subl $0x5, %eax
movl %eax, 0xc727(%rip)      # 0x18768
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x104(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xa4d0
movl -0x104(%rbp), %eax
movl %eax, -0x414(%rbp)
testl %eax, %eax
je 0xc07e
jmp 0xc06f
movl -0x414(%rbp), %eax
subl $0x6, %eax
je 0xc099
jmp 0xc07c
jmp 0xc080
jmp 0xc080
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb488
leaq -0x50(%rbp), %rdi
callq 0xa4d0
jmp 0xc0c6
jmp 0xc09b
movq 0xc69e(%rip), %rdi      # 0x18740
movl $0x4, %esi
movl $0x1, %edx
callq 0x11d90
movq 0xc688(%rip), %rdi      # 0x18740
callq 0x11b00
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x4680
nop