// File: /workspace/github_cpp_makefile_star2_O1/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 $0x188, %rsp            # imm = 0x188
movq %rsi, %rbx
movq %rdi, %r12
leaq -0x198(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rsi), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x1a8(%rbp), %r15
movq %r15, %rdi
callq 0x41ce
movq %r12, -0x30(%rbp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x55f4
movl %eax, %r15d
movq -0x1a8(%rbp), %rdi
cmpq %r14, %rdi
je 0x30d9
movq -0x198(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpl $-0x1, %r15d
je 0x3522
leaq -0x178(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %r15
movq %r15, %rdi
callq 0x41ce
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x55f4
movl %eax, %r15d
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
je 0x3131
movq -0x178(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x158(%rbp), %r14
leaq -0x168(%rbp), %r12
testl %r15d, %r15d
je 0x3182
leaq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %r13
movq %r13, %rdi
callq 0x41ce
movq -0x30(%rbp), %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x5e20
testl %eax, %eax
setne %r13b
jmp 0x3185
xorl %r13d, %r13d
testl %r15d, %r15d
je 0x31ac
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x31ac
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x21c0
testb %r13b, %r13b
je 0x3200
movq %r14, -0x168(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x41ce
movq -0x30(%rbp), %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x5e20
movl %eax, %r15d
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x313f
movq -0x158(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x313f
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
testl %r15d, %r15d
je 0x330a
leaq -0x138(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x41ce
leaq -0x148(%rbp), %rsi
leaq -0x70(%rbp), %rcx
movq -0x30(%rbp), %rdi
movl %r15d, %edx
callq 0x5c5e
movq -0x148(%rbp), %rdi
cmpq %r14, %rdi
je 0x326f
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x118(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %rdi
callq 0x41ce
leaq -0x128(%rbp), %rsi
movq -0x30(%rbp), %rdi
movl %r15d, %edx
callq 0x5b02
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x32be
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x70(%rbp), %r15
movq %r15, %rdi
movl $0x23, %esi
xorl %edx, %edx
callq 0x2240
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x21e0
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x2220
movq (%r15), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x330a
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x6cac(%rip), %r15      # 0x9fd0
leaq 0x3e16(%rip), %rsi      # 0x7141
movl $0xb, %edx
movq %r15, %rdi
callq 0x21f0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq 0x6c7a(%rip), %rdi      # 0x9fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq 0x6c76(%rip), %rdi      # 0x9fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq 0x6c5b(%rip), %rdi      # 0x9fe0
leaq -0x50(%rbp), %rsi
callq 0x2320
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0x2090
leaq -0xf8(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x108(%rbp), %rdi
callq 0x41ce
movq -0x30(%rbp), %rdi
callq 0x660e
leaq -0x88(%rbp), %rdi
leaq -0x108(%rbp), %rsi
movl %eax, %edx
callq 0x5342
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x33fa
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x80(%rbp), %rax
cmpq -0x88(%rbp), %rax
je 0x34dd
movl $0x8, %r13d
xorl %r14d, %r14d
leaq -0xc8(%rbp), %r15
leaq -0xa8(%rbp), %r12
leaq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x41ce
movq -0x88(%rbp), %rax
leaq -0x98(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
movq -0x8(%rax,%r13), %rsi
movq (%rax,%r13), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x41ce
movq -0x30(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x5826
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x349c
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x34be
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x80(%rbp), %rax
subq -0x88(%rbp), %rax
incq %r14
sarq $0x5, %rax
addq $0x20, %r13
cmpq %r14, %rax
ja 0x3422
leaq -0x88(%rbp), %rdi
callq 0x25da
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3502
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x351b
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21c0
movl $0x1, %eax
jmp 0x3566
movq 0x6aa7(%rip), %rbx      # 0x9fd0
leaq 0x3bfd(%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
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x35d9
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x369b
movq -0x118(%rbp), %rsi
jmp 0x3693
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r14, %rdi
je 0x369b
movq -0x138(%rbp), %rsi
jmp 0x3693
jmp 0x3620
movq %rax, %rbx
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
je 0x36eb
movq -0x178(%rbp), %rsi
jmp 0x36e3
movq %rax, %rbx
jmp 0x369b
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
cmpq %r14, %rdi
je 0x36eb
movq -0x198(%rbp), %rsi
jmp 0x36e3
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x3682
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3682
movq %rax, %rbx
jmp 0x3682
movq %rax, %rbx
jmp 0x3676
movq %rax, %rbx
jmp 0x3654
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x3654
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x3676
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x88(%rbp), %rdi
callq 0x25da
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x369b
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x36eb
movq -0x60(%rbp), %rsi
jmp 0x36e3
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x36eb
movq -0xd8(%rbp), %rsi
jmp 0x36e3
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x36eb
movq -0x158(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2300
nop