// File: meirdev[P]HexViewer/DataProcessing/DataProcessing.cpp
// Function: DataProcessing::process()
void DataProcessing::process()
{
    const size_t bufferSize = 4096;

    char* buffer = new char[bufferSize];

    m_file.seek(m_offset);

    m_printer << m_style.header();

    size_t totalLength = 0;

    while (!m_file.eof())
    {
        size_t readBytes = m_file.read(buffer, bufferSize);

        for (size_t i = 0; (totalLength < m_length) && (i < readBytes); ++i, ++totalLength)
        {
            printByte(buffer[i]);
        }

        if (totalLength == m_length)
        {
            break;
        }
    }

    printEnd();

    m_printer << m_style.footer();

    m_printer.flush();

    delete[] buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $0x1000, -0x10(%rbp)    # imm = 0x1000
movl $0x1000, %edi           # imm = 0x1000
callq 0x6030
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq (%rax), %rsi
movq 0x20(%rax), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x18(%rax), %rsi
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x38(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq *%rax
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0x3e92d
leaq -0x38(%rbp), %rdi
callq 0x6280
movq $0x0, -0x50(%rbp)
movq -0x98(%rbp), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
xorb $-0x1, %al
testb $0x1, %al
jne 0x3e95a
jmp 0x3ea1a
movq -0x98(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
movl $0x1000, %edx           # imm = 0x1000
callq *0x10(%rax)
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x98(%rbp), %rdx
movq -0x50(%rbp), %rcx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x99(%rbp)
jae 0x3e9aa
movq -0x60(%rbp), %rax
cmpq -0x58(%rbp), %rax
setb %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x3e9b6
jmp 0x3ea02
movq -0x98(%rbp), %rdi
movq -0x18(%rbp), %rax
movq -0x60(%rbp), %rcx
movzbl (%rax,%rcx), %esi
callq 0x3eb00
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x3e980
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6280
jmp 0x3eabe
movq -0x98(%rbp), %rcx
movq -0x50(%rbp), %rax
cmpq 0x8(%rcx), %rax
jne 0x3ea15
jmp 0x3ea1a
jmp 0x3e93e
movq -0x98(%rbp), %rdi
callq 0x3eb70
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0xb0(%rbp)
movq 0x18(%rax), %rsi
movq (%rsi), %rax
movq 0x20(%rax), %rax
leaq -0x80(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq *%rax
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0x3ea69
leaq -0x80(%rbp), %rdi
callq 0x6280
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, %rax
je 0x3eaa0
movq -0xb8(%rbp), %rdi
callq 0x6590
addq $0xc0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x6280
movq -0x40(%rbp), %rdi
callq 0x6750
nopw (%rax,%rax)