// File: /workspace/github_cpp_makefile_star2_O2/phillip-h[P]todo/src/args.cpp
// Function: renameList()
void renameList()
{
    TodoList *list = Core::list(name());
    if (!list->exists()){
        cout << ANSI_RED << "Todo List '" << list->name;
        cout << "' does not exist!\n" << ANSI_RESET;
        return;
    }
    
    string newName;
    cout << "Enter new list name, or an empty line to cancel > ";
    getline(cin, newName);
    if (newName.empty()){
        cout << "Canceling rename.\n";
        return;
    }
    
    if (remove(list->getPath().c_str()) != 0){
        cout << ANSI_RED << "Failed to remove list!\n" << ANSI_RESET;
        return;
    }
    
    string oldName = list->name;
    list->name = newName;
    if (list->exists()){
        cout << ANSI_RED << "List already exists!\n" << ANSI_RESET;
        list->name = oldName;
    } else{
       cout << "List renamed.\n"; 
    }
    
    list->save();    
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x4f72
movq %rbx, %rdi
callq 0x5528
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x35a8
movq %rbx, %rdi
callq 0x7b5e
testb %al, %al
je 0x4963
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0xa6f4(%rip), %rdi      # 0xefd0
leaq 0x5a5d(%rip), %rsi      # 0xa340
callq 0x3290
movq 0xa6f1(%rip), %rdi      # 0xefe0
leaq 0x20(%rsp), %rsi
callq 0x30b0
cmpq $0x0, 0x28(%rsp)
je 0x49ba
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7870
movq %rsp, %r14
movq (%r14), %rdi
callq 0x3530
movl %eax, %ebp
movq %r14, %rdi
callq 0x35a8
testl %ebp, %ebp
je 0x49d2
movq 0xa69c(%rip), %rdi      # 0xefd0
leaq 0xaae5(%rip), %rsi      # 0xf420
callq 0x3270
leaq 0x59d2(%rip), %rsi      # 0xa319
movq %rax, %rdi
callq 0x3290
leaq 0xaaaa(%rip), %rsi      # 0xf400
movq %rax, %rdi
callq 0x3270
jmp 0x4a5e
movq 0xa666(%rip), %r14      # 0xefd0
leaq 0xaaaf(%rip), %rsi      # 0xf420
movq %r14, %rdi
callq 0x3270
leaq 0x5966(%rip), %rsi      # 0xa2e6
movq %rax, %rdi
callq 0x3290
addq $0x8, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3270
leaq 0x5768(%rip), %rsi      # 0xa106
movq %r14, %rdi
callq 0x3290
leaq 0xaa53(%rip), %rsi      # 0xf400
movq %rax, %rdi
callq 0x3270
jmp 0x4a68
movq 0xa60f(%rip), %rdi      # 0xefd0
leaq 0x59ab(%rip), %rsi      # 0xa373
callq 0x3290
jmp 0x4a5e
movq %rbx, %r14
addq $0x8, %r14
movq %rsp, %rdi
movq %r14, %rsi
callq 0x33b0
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x31b0
movq %rbx, %rdi
callq 0x7b5e
testb %al, %al
je 0x4a3b
movq 0xa5cc(%rip), %rdi      # 0xefd0
leaq 0xaa15(%rip), %rsi      # 0xf420
callq 0x3270
leaq 0x596f(%rip), %rsi      # 0xa386
movq %rax, %rdi
callq 0x3290
leaq 0xa9da(%rip), %rsi      # 0xf400
movq %rax, %rdi
callq 0x3270
movq %rsp, %rsi
movq %r14, %rdi
callq 0x31b0
jmp 0x4a4e
movq 0xa58e(%rip), %rdi      # 0xefd0
leaq 0x5953(%rip), %rsi      # 0xa39c
callq 0x3290
movq %rbx, %rdi
callq 0x7698
movq %rsp, %rdi
callq 0x35a8
leaq 0x20(%rsp), %rdi
callq 0x35a8
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x4a8c
jmp 0x4a8c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x35a8
jmp 0x4a8f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x4a94
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x35a8
movq %rbx, %rdi
callq 0x3510