// File: /workspace/github_cpp_makefile_star2_O3/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 0x4218
movq %r15, %rdi
movq %r12, %rsi
callq 0x560e
movl %eax, %r12d
movq -0x148(%rbp), %rdi
cmpq %r13, %rdi
je 0x3c8e
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %r12d
je 0x3cfb
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 0x4218
movq %r15, %rdi
movq %r12, %rsi
callq 0x560e
movl %eax, %r12d
movq -0x128(%rbp), %rdi
cmpq %r13, %rdi
je 0x3ce1
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x21c0
testl %r12d, %r12d
js 0x3d51
movq 0x62e3(%rip), %rbx      # 0x9fd0
leaq 0x3402(%rip), %rsi      # 0x70f6
movl $0x20, %edx
jmp 0x3d0e
movq 0x62ce(%rip), %rbx      # 0x9fd0
leaq 0x33d1(%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 0x4218
movq %r15, %rdi
movq %r12, %rsi
callq 0x54cc
movl %eax, %r12d
movq -0x108(%rbp), %rdi
cmpq %r13, %rdi
je 0x3d9e
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x21c0
testl %r12d, %r12d
je 0x3e0d
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x330a(%rip), %rdx      # 0x70bc
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
callq 0x2648
leaq -0xd8(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x4218
leaq -0xe8(%rbp), %rsi
movq %r15, %rdi
callq 0x560e
movl %eax, %r12d
movq -0xe8(%rbp), %rdi
cmpq %r13, %rdi
je 0x3eb6
movq -0xd8(%rbp), %rsi
jmp 0x3eae
movq 0x61bc(%rip), %rbx      # 0x9fd0
leaq 0x32fc(%rip), %rsi      # 0x7117
movl $0x15, %edx
jmp 0x3d0e
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r13, %rdi
je 0x409e
movq -0xd8(%rbp), %rsi
jmp 0x4091
jmp 0x409b
movq %rax, %rbx
jmp 0x40b7
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r13, %rdi
je 0x40b7
movq -0xf8(%rbp), %rsi
jmp 0x40af
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r13, %rdi
je 0x40b7
movq -0x118(%rbp), %rsi
jmp 0x40af
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r13, %rdi
je 0x40b7
movq -0x138(%rbp), %rsi
jmp 0x40af
incq %rsi
callq 0x21c0
testl %r12d, %r12d
je 0x3ffb
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x4218
movq %r15, %rdi
leaq -0xa8(%rbp), %rsi
movl %r12d, %edx
leaq -0x48(%rbp), %rcx
callq 0x5c80
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x3f1b
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 0x4218
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 0x4218
movq %r15, %rdi
leaq -0x88(%rbp), %rsi
movq %r13, %rdx
callq 0x5858
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x3f98
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x3fb4
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 0x4218
movq %r15, %rdi
leaq -0x68(%rbp), %rsi
movl %r12d, %edx
callq 0x5e42
movl %eax, %r12d
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x3eb6
movq -0x58(%rbp), %rsi
jmp 0x3eae
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4014
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
movl $0x1, %eax
jmp 0x3d3f
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x409e
movq -0x98(%rbp), %rsi
jmp 0x4091
movq %rax, %rbx
jmp 0x407d
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x409e
movq -0x58(%rbp), %rsi
jmp 0x4091
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x407d
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x409e
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x409e
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x40b7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2300