// File: RC2K7[P]SDisk-FileSystem/shell.cpp
// Function: Shell::type(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Shell::type(string fileName)
{
    string fileBuffer = "";
    string blockBuffer = "";

    for ( int curBlock = getFirstBlock(fileName); curBlock != 0; curBlock = this->nextBlock(fileName, curBlock)) {
        this->readBlock(fileName, curBlock, blockBuffer);
        fileBuffer += blockBuffer;
    }

    fileBuffer = fileBuffer.substr(0, fileBuffer.find_first_of('#'));

    cout << fileBuffer << endl;

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rsi, -0x108(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x3480
movq -0xf8(%rbp), %rdx
leaq 0x4e79(%rip), %rsi      # 0xa0bc
leaq -0x30(%rbp), %rdi
callq 0x3750
jmp 0x524e
leaq -0x31(%rbp), %rdi
callq 0x32e0
leaq -0x69(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x3480
movq -0x110(%rbp), %rdx
leaq 0x4e47(%rip), %rsi      # 0xa0bc
leaq -0x68(%rbp), %rdi
callq 0x3750
jmp 0x5280
leaq -0x69(%rbp), %rdi
callq 0x32e0
movq -0x108(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x3100
jmp 0x529e
movq -0x100(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7a10
movl %eax, -0x114(%rbp)
jmp 0x52b9
leaq -0x90(%rbp), %rdi
callq 0x3170
movl -0x114(%rbp), %eax
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
je 0x540f
movq -0x108(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x3100
jmp 0x52ed
movq -0x100(%rbp), %rdi
movl -0x70(%rbp), %edx
leaq -0xb0(%rbp), %rsi
leaq -0x68(%rbp), %rcx
callq 0x8310
jmp 0x5309
leaq -0xb0(%rbp), %rdi
callq 0x3170
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x33a0
jmp 0x5324
jmp 0x5326
movq -0x108(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x3100
jmp 0x533b
movq -0x100(%rbp), %rdi
movl -0x70(%rbp), %edx
leaq -0xd0(%rbp), %rsi
callq 0x8540
movl %eax, -0x118(%rbp)
jmp 0x5359
movl -0x118(%rbp), %eax
movl %eax, -0x70(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x3170
jmp 0x52ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x32e0
jmp 0x54db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x32e0
jmp 0x54d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x54c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x3170
jmp 0x54c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3170
jmp 0x54c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x3170
jmp 0x54c9
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x120(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x128(%rbp)
movl $0x23, %esi
callq 0x3190
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
movq %rax, %rcx
leaq -0xf0(%rbp), %rdi
callq 0x32b0
jmp 0x544e
leaq -0x30(%rbp), %rdi
movq %rdi, -0x138(%rbp)
leaq -0xf0(%rbp), %rsi
movq %rsi, -0x140(%rbp)
callq 0x3360
movq -0x140(%rbp), %rdi
callq 0x3170
movq -0x138(%rbp), %rsi
movq 0x8b42(%rip), %rdi      # 0xdfc8
callq 0x3230
movq %rax, -0x130(%rbp)
jmp 0x5494
movq -0x130(%rbp), %rdi
movq 0x8b16(%rip), %rsi      # 0xdfb8
callq 0x32c0
jmp 0x54a9
leaq -0x68(%rbp), %rdi
callq 0x3170
leaq -0x30(%rbp), %rdi
callq 0x3170
movl $0x1, %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
leaq -0x68(%rbp), %rdi
callq 0x3170
leaq -0x30(%rbp), %rdi
callq 0x3170
movq -0x40(%rbp), %rdi
callq 0x3470
nopw %cs:(%rax,%rax)