// File: /workspace/github_cpp_makefile_star2_O1/tylerkaraszewski[P]Argyle/FileReader.cpp
// Function: FileReader::openFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool FileReader::openFile(const string& fullPath)
{

  // Look up this file's size.
  struct stat fileStat;
  if(stat(fullPath.c_str(), &fileStat) == -1)
  {
    m_httpCode = 404;
    return false;
  }

  // If we *can* find this file's info, then we need to open the actual file.
  m_file = fopen(fullPath.c_str(), "r");
  if (m_file == NULL)
  {
    if (errno == EACCES)
    {
      m_httpCode = 403;
      return false;
    }
    else if (errno == ENOENT)
    {
      m_httpCode = 404;
      return false;
    }
    else
    {
      m_logger.logError("FileReader fopen error(" + Utils::llToString(errno) + "): " + strerror(errno));
      m_httpCode = 500;
      return false;
    }
  }
  
  m_contentLength = fileStat.st_size;
  m_lengthKnown = true;

  // Now we're ready to start reading.
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3250
cmpl $-0x1, %eax
je 0x982f
movq (%r14), %rdi
leaq 0x2d2f(%rip), %rsi      # 0xc51f
callq 0x3310
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x9812
movq 0xb8(%rsp), %rax
movq %rax, 0x8(%rbx)
movb $0x1, 0x10(%rbx)
movb $0x1, %al
jmp 0x9838
callq 0x3040
movq %rax, %r15
movl (%rax), %eax
cmpl $0x2, %eax
je 0x982f
cmpl $0xd, %eax
jne 0x984a
movl $0x193, 0x14(%rbx)      # imm = 0x193
jmp 0x9836
movl $0x194, 0x14(%rbx)      # imm = 0x194
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x70(%rbx), %r14
movslq (%r15), %rsi
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0xac34
leaq 0x2b8b(%rip), %rcx      # 0xc3f0
movl $0x17, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32e0
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x989e
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x98a6
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x2765(%rip), %rsi      # 0xc02e
callq 0x3560
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x98f5
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x98fc
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %r12
movq %rdx, 0x8(%r12)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl (%r15), %edi
callq 0x3120
movq %r12, %rdi
movq %rax, %rsi
callq 0x3560
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9953
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x995a
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
callq 0xac26
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x9995
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x99ac
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x99c3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99de
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3290
movl $0x1f4, 0x14(%rbx)      # imm = 0x1F4
jmp 0x9836
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x9a09
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x9a09
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x9a25
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x9a25
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x9a41
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x9a41
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9a5c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3520