// File: /workspace/github_cpp_makefile_star2_O1/RC2K7[P]SDisk-FileSystem/shell.cpp
// Function: Shell::copy(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Shell::copy(string src, string dest)
{
    if (this->getFirstBlock(src) == -1) {
        cout << "Could Not Find Source File!" << endl;
        return 0;
    } else if (this->getFirstBlock(dest) >= 0) {
        cout << "Destination File Already Exists!" << endl;
        return 0;
    }

    if (this->newFile(dest) == 0) {
        cout << "Could Not Create File" << endl;
        return 0;
    }

    string buffer = "";
    for (int curBlock = this->getFirstBlock(src); curBlock != 0; curBlock = this->nextBlock(src, curBlock)) {
        this->readBlock(src, curBlock, buffer);
        this->addBlock(dest, buffer);
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq -0x138(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %r12
movq %r12, %rdi
callq 0x41ce
movq %r15, %rdi
movq %r12, %rsi
callq 0x55f4
movl %eax, %r12d
movq -0x148(%rbp), %rdi
cmpq %r13, %rdi
je 0x3c44
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %r12d
je 0x3cb1
leaq -0x118(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %r12
movq %r12, %rdi
callq 0x41ce
movq %r15, %rdi
movq %r12, %rsi
callq 0x55f4
movl %eax, %r12d
movq -0x128(%rbp), %rdi
cmpq %r13, %rdi
je 0x3c97
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x21c0
testl %r12d, %r12d
js 0x3d07
movq 0x632d(%rip), %rbx      # 0x9fd0
leaq 0x344c(%rip), %rsi      # 0x70f6
movl $0x20, %edx
jmp 0x3cc4
movq 0x6318(%rip), %rbx      # 0x9fd0
leaq 0x341b(%rip), %rsi      # 0x70da
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x21f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xf8(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x108(%rbp), %r12
movq %r12, %rdi
callq 0x41ce
movq %r15, %rdi
movq %r12, %rsi
callq 0x5496
movl %eax, %r12d
movq -0x108(%rbp), %rdi
cmpq %r13, %rdi
je 0x3d54
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x21c0
testl %r12d, %r12d
je 0x3dc3
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x3354(%rip), %rdx      # 0x70bc
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
callq 0x2644
leaq -0xd8(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x41ce
leaq -0xe8(%rbp), %rsi
movq %r15, %rdi
callq 0x55f4
movl %eax, %r12d
movq -0xe8(%rbp), %rdi
cmpq %r13, %rdi
je 0x3e6c
movq -0xd8(%rbp), %rsi
jmp 0x3e64
movq 0x6206(%rip), %rbx      # 0x9fd0
leaq 0x3346(%rip), %rsi      # 0x7117
movl $0x15, %edx
jmp 0x3cc4
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r13, %rdi
je 0x4054
movq -0xd8(%rbp), %rsi
jmp 0x4047
jmp 0x4051
movq %rax, %rbx
jmp 0x406d
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r13, %rdi
je 0x406d
movq -0xf8(%rbp), %rsi
jmp 0x4065
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r13, %rdi
je 0x406d
movq -0x118(%rbp), %rsi
jmp 0x4065
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r13, %rdi
je 0x406d
movq -0x138(%rbp), %rsi
jmp 0x4065
incq %rsi
callq 0x21c0
testl %r12d, %r12d
je 0x3fb1
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x41ce
movq %r15, %rdi
leaq -0xa8(%rbp), %rsi
movl %r12d, %edx
leaq -0x48(%rbp), %rcx
callq 0x5c5e
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x3ed1
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x41ce
leaq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %r13
movq %r13, %rdi
callq 0x41ce
movq %r15, %rdi
leaq -0x88(%rbp), %rsi
movq %r13, %rdx
callq 0x5826
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x3f4e
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x3f6a
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x41ce
movq %r15, %rdi
leaq -0x68(%rbp), %rsi
movl %r12d, %edx
callq 0x5e20
movl %eax, %r12d
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x3e6c
movq -0x58(%rbp), %rsi
jmp 0x3e64
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x3fca
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
movl $0x1, %eax
jmp 0x3cf5
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x4054
movq -0x98(%rbp), %rsi
jmp 0x4047
movq %rax, %rbx
jmp 0x4033
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x4054
movq -0x58(%rbp), %rsi
jmp 0x4047
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x4033
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x4054
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x4054
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x406d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2300