// File: phillip-h[P]todo/src/todolist.cpp
// Function: TodoList::load()
void TodoList::load()
{
    if (!exists()){
        return;
    }

    std::ifstream file(getPath());
    if (!file.good()){
        std::cout << "failed to write to-do list!\n";
        return;
    }

    unsigned pos = 0;
    for (string line = ""; getline(file, line); pos++){
        add(Task(line).parse(), pos);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0xdd20
testb $0x1, %al
jne 0xda38
jmp 0xdcf6
movq -0x2e8(%rbp), %rsi
leaq -0x230(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0xd7b0
movq -0x2f0(%rbp), %rsi
leaq -0x210(%rbp), %rdi
movl $0x8, %edx
callq 0x4600
jmp 0xda6c
leaq -0x230(%rbp), %rdi
callq 0x4738
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x4640
movb %al, -0x2f1(%rbp)
jmp 0xda98
movb -0x2f1(%rbp), %al
testb $0x1, %al
jne 0xdb02
jmp 0xdaa4
movq 0xa51d(%rip), %rdi      # 0x17fc8
leaq 0x4b1e(%rip), %rsi      # 0x125d0
callq 0x4340
jmp 0xdab9
movl $0x1, -0x240(%rbp)
jmp 0xdcea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x4738
jmp 0xdd0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0xdcff
movl $0x0, -0x244(%rbp)
leaq -0x269(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x4690
movq -0x300(%rbp), %rdx
leaq 0x491d(%rip), %rsi      # 0x1244a
leaq -0x268(%rbp), %rdi
callq 0x85c0
jmp 0xdb3b
leaq -0x269(%rbp), %rdi
callq 0x43d0
leaq -0x210(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x40e0
movq %rax, -0x308(%rbp)
jmp 0xdb63
movq -0x308(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x4490
movb %al, -0x309(%rbp)
jmp 0xdb81
movb -0x309(%rbp), %al
testb $0x1, %al
jne 0xdbe2
jmp 0xdb8d
movl $0x2, -0x240(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x4738
jmp 0xdce0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x269(%rbp), %rdi
callq 0x43d0
jmp 0xdcff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0xdcd2
leaq -0x2e0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x41c0
jmp 0xdbf7
leaq -0x2c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0xca70
jmp 0xdc0c
leaq -0x298(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0xcd50
jmp 0xdc21
movq -0x2e8(%rbp), %rdi
movl -0x244(%rbp), %edx
leaq -0x298(%rbp), %rsi
callq 0xdd90
jmp 0xdc3c
leaq -0x298(%rbp), %rdi
callq 0xa4d0
leaq -0x2c0(%rbp), %rdi
callq 0xa4d0
leaq -0x2e0(%rbp), %rdi
callq 0x4738
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0xdb47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0xdcc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0xdcba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0xa4d0
leaq -0x2c0(%rbp), %rdi
callq 0xa4d0
leaq -0x2e0(%rbp), %rdi
callq 0x4738
leaq -0x268(%rbp), %rdi
callq 0x4738
jmp 0xdcff
movl $0x0, -0x240(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x4120
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
leaq -0x210(%rbp), %rdi
callq 0x4120
movq -0x238(%rbp), %rdi
callq 0x4680
nopw (%rax,%rax)