// File: /workspace/github_cpp_makefile_star2_O3/RC2K7[P]SDisk-FileSystem/shell.cpp
// Function: Shell::append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Shell::append(string fileName)
{
    if (getFirstBlock(fileName) == -1) {
        cout << "Could Not Find File" << endl;
        return 0;
    }

    int lastBlock;
    for (lastBlock = this->getFirstBlock(fileName); lastBlock != 0 && this->nextBlock(fileName, lastBlock) != 0; lastBlock = nextBlock(fileName, lastBlock)) ;

    string totalBuffer;
    if (lastBlock != 0) {
        this->readBlock(fileName, lastBlock, totalBuffer);
        this->delBlock(fileName, lastBlock);
        totalBuffer = totalBuffer.substr(0, totalBuffer.find_first_of('#'));
    }

    string buffer;
    cout << "Enter Data:" << endl;
    getline(cin, buffer);
    totalBuffer += buffer;

    vector<string> blocks = block(totalBuffer, this->getBlockSize());

    for (int i = 0; i < blocks.size(); i++)
        this->addBlock(fileName, blocks[i]);

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r13
movq %rdi, %r12
leaq -0x1a8(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x1b8(%rbp), %r14
movq %r14, %rdi
callq 0x4218
movq %r12, -0x30(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x560e
movl %eax, %r14d
movq -0x1b8(%rbp), %rdi
cmpq %r15, %rdi
je 0x30e1
movq -0x1a8(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %r14d
je 0x3239
leaq -0x188(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x198(%rbp), %r14
movq %r14, %rdi
callq 0x4218
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x560e
movl %eax, %r15d
movq -0x198(%rbp), %rdi
cmpq %r12, %rdi
je 0x313b
movq -0x188(%rbp), %rsi
incq %rsi
callq 0x21c0
testl %r15d, %r15d
movq %r13, -0x60(%rbp)
je 0x3221
leaq -0xc8(%rbp), %r12
leaq -0x168(%rbp), %r14
movq %r14, %rbx
movq %r12, -0xd8(%rbp)
movq (%r13), %rsi
movl %r15d, %r14d
movq %r13, %r15
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
movq %r12, %r13
callq 0x4218
movq -0x30(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
movl %r14d, %r12d
movl %r14d, %edx
callq 0x5e42
movl %eax, %r14d
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x31b4
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21c0
testl %r14d, %r14d
movq %r15, %r13
je 0x3282
movq %rbx, %r14
movq %rbx, -0x178(%rbp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x178(%rbp), %rbx
movq %rbx, %rdi
callq 0x4218
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x5e42
movl %eax, %r15d
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x3211
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x21c0
testl %r15d, %r15d
leaq -0xc8(%rbp), %r12
jne 0x3156
leaq -0x70(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
jmp 0x3388
movq 0x6d90(%rip), %rbx      # 0x9fd0
leaq 0x3ee6(%rip), %rsi      # 0x712d
movl $0x13, %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
jmp 0x35a1
leaq -0x70(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
leaq -0x148(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rdi
callq 0x4218
leaq -0x158(%rbp), %rsi
leaq -0x80(%rbp), %rcx
movq -0x30(%rbp), %rdi
movl %r12d, %edx
callq 0x5c80
movq -0x158(%rbp), %rdi
cmpq %r14, %rdi
je 0x32e9
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x128(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x60(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x138(%rbp), %rdi
callq 0x4218
leaq -0x138(%rbp), %rsi
movq -0x30(%rbp), %rdi
movl %r12d, %edx
callq 0x5b26
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
je 0x333c
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x80(%rbp), %r14
movq %r14, %rdi
movl $0x23, %esi
xorl %edx, %edx
callq 0x2240
leaq -0x58(%rbp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x21e0
leaq -0x80(%rbp), %rdi
leaq -0x58(%rbp), %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3388
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x6c2e(%rip), %r14      # 0x9fd0
leaq 0x3d98(%rip), %rsi      # 0x7141
movl $0xb, %edx
movq %r14, %rdi
movq %rbx, -0x38(%rbp)
callq 0x21f0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq 0x6bf8(%rip), %rdi      # 0x9fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq 0x6bf4(%rip), %rdi      # 0x9fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq 0x6bd9(%rip), %rdi      # 0x9fe0
leaq -0x58(%rbp), %rsi
callq 0x2320
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x2090
leaq -0x108(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x4218
movq -0x30(%rbp), %rdi
callq 0x6602
leaq -0x98(%rbp), %rdi
leaq -0x118(%rbp), %rsi
movl %eax, %edx
callq 0x537e
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x347c
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x90(%rbp), %rax
cmpq -0x98(%rbp), %rax
je 0x3561
movl $0x8, %r14d
leaq -0xe8(%rbp), %r13
xorl %ebx, %ebx
leaq -0xb8(%rbp), %r15
leaq -0xf8(%rbp), %r12
leaq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x4218
movq -0x98(%rbp), %rax
movq %r13, -0xf8(%rbp)
movq -0x8(%rax,%r14), %rsi
movq (%rax,%r14), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4218
movq -0x30(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x5858
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x351d
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x353f
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x90(%rbp), %rax
subq -0x98(%rbp), %rax
incq %rbx
sarq $0x5, %rax
addq $0x20, %r14
cmpq %rbx, %rax
ja 0x34ad
leaq -0x98(%rbp), %rdi
callq 0x25da
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3586
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x80(%rbp), %rdi
cmpq -0x38(%rbp), %rdi
je 0x359c
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21c0
movl $0x1, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x35fb
movq %rbx, -0x38(%rbp)
movq %rax, %rbx
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
je 0x3720
movq -0x128(%rbp), %rsi
jmp 0x3718
movq %rbx, -0x38(%rbp)
movq %rax, %rbx
movq -0x158(%rbp), %rdi
cmpq %r14, %rdi
je 0x3720
movq -0x148(%rbp), %rsi
jmp 0x3718
movq %rbx, -0x38(%rbp)
movq %rax, %rbx
jmp 0x3720
jmp 0x366e
movq %rax, %rbx
movq -0x198(%rbp), %rdi
cmpq %r12, %rdi
je 0x3736
movq -0x188(%rbp), %rsi
jmp 0x372e
movq %rax, %rbx
movq -0x1b8(%rbp), %rdi
cmpq %r15, %rdi
je 0x3736
movq -0x1a8(%rbp), %rsi
jmp 0x372e
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x3707
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3707
movq %rax, %rbx
jmp 0x3707
movq %rax, %rbx
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x3736
movq -0x168(%rbp), %rsi
jmp 0x372e
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x3736
movq -0xc8(%rbp), %rsi
jmp 0x372e
movq %rax, %rbx
jmp 0x36fb
movq %rax, %rbx
jmp 0x36d9
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x36d9
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x36fb
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x98(%rbp), %rdi
callq 0x25da
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3720
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x80(%rbp), %rdi
cmpq -0x38(%rbp), %rdi
je 0x3736
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2300