// File: tylerkaraszewski[P]Argyle/FileReader.cpp
// Function: FileReader::FileReader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Logger&)
FileReader::FileReader(const string& path, Logger& logger) :
m_file(NULL),
m_fileBytesRead(0),
m_logger(logger)
{
  m_lengthKnown = false;
  m_done = false;
  m_httpCode = 0;
  m_contentLength = 0;
  m_bytesRead = 0;

  if (openFile(path))
  {
    m_contentType = FilenameResolver::getContentType(path);
    m_headerBuffer += "Content-Length: " + Utils::llToString(m_contentLength) + "\r\n";
    m_headerBuffer += "Content-Type: " + m_contentType + "\r\n";
    m_headerBuffer += "\r\n";
    m_httpCode = 200;
  }

  // If openFile failed, it will have set an appropriate error code.
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
movq 0x110(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xf720
movq 0x20(%rsp), %rdi
leaq 0xa08b(%rip), %rax      # 0x18d18
movq %rax, (%rdi)
movq $0x0, 0x20(%rdi)
movq $0x0, 0x28(%rdi)
addq $0x30, %rdi
movq %rdi, 0x10(%rsp)
callq 0x4570
movq 0x20(%rsp), %rdi
addq $0x50, %rdi
movq %rdi, 0x18(%rsp)
callq 0x4570
movq 0x20(%rsp), %rdi
movq 0x100(%rsp), %rax
movq %rax, 0x70(%rdi)
movb $0x0, 0x10(%rdi)
movb $0x0, 0x11(%rdi)
movl $0x0, 0x14(%rdi)
movq $0x0, 0x8(%rdi)
movq $0x0, 0x18(%rdi)
movq 0x108(%rsp), %rsi
callq 0xef50
movb %al, 0x2f(%rsp)
jmp 0xed04
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0xed11
jmp 0xef1b
movq 0x108(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0xe740
jmp 0xed28
movq 0x20(%rsp), %rdi
addq $0x30, %rdi
leaq 0xd0(%rsp), %rsi
movq %rsi, 0x8(%rsp)
callq 0x44d0
movq 0x8(%rsp), %rdi
callq 0x4788
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x70(%rsp), %rdi
callq 0x10f70
jmp 0xed62
leaq 0x464e(%rip), %rsi      # 0x133b7
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x6230
jmp 0xed7d
leaq 0x4492(%rip), %rdx      # 0x13216
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x61e0
jmp 0xed9b
movq 0x20(%rsp), %rdi
addq $0x50, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x44f0
jmp 0xedb3
leaq 0xb0(%rsp), %rdi
callq 0x4788
leaq 0x90(%rsp), %rdi
callq 0x4788
leaq 0x70(%rsp), %rdi
callq 0x4788
movq 0x20(%rsp), %rdx
addq $0x30, %rdx
leaq 0x45e1(%rip), %rsi      # 0x133c8
leaq 0x30(%rsp), %rdi
callq 0xdcf0
jmp 0xedf3
leaq 0x441c(%rip), %rdx      # 0x13216
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x61e0
jmp 0xee0b
movq 0x20(%rsp), %rdi
addq $0x50, %rdi
leaq 0x50(%rsp), %rsi
callq 0x44f0
jmp 0xee20
leaq 0x50(%rsp), %rdi
callq 0x4788
leaq 0x30(%rsp), %rdi
callq 0x4788
movq 0x20(%rsp), %rdi
addq $0x50, %rdi
leaq 0x43d2(%rip), %rsi      # 0x13216
callq 0x4390
jmp 0xee4b
movq 0x20(%rsp), %rax
movl $0xc8, 0x14(%rax)
jmp 0xef1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0xef23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0xeecf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0xeec2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x4788
leaq 0x90(%rsp), %rdi
callq 0x4788
leaq 0x70(%rsp), %rdi
callq 0x4788
jmp 0xef23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0xef0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x4788
leaq 0x30(%rsp), %rdi
callq 0x4788
jmp 0xef23
addq $0x118, %rsp            # imm = 0x118
retq
movq 0x18(%rsp), %rdi
callq 0x4788
movq 0x10(%rsp), %rdi
callq 0x4788
movq 0x20(%rsp), %rdi
callq 0xdec0
movq 0xf8(%rsp), %rdi
callq 0x46b0
nop