// File: /workspace/github_cpp_makefile_star2_O3/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 0x97be
movq (%r14), %rdi
leaq 0x2d9f(%rip), %rsi      # 0xc51f
callq 0x3310
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x97a2
movq 0xb8(%rsp), %rax
movq %rax, 0x8(%rbx)
movb $0x1, 0x10(%rbx)
movb $0x1, %al
jmp 0x97c7
callq 0x3040
movslq (%rax), %rsi
cmpq $0x2, %rsi
je 0x97be
cmpl $0xd, %esi
jne 0x97d9
movl $0x193, 0x14(%rbx)      # imm = 0x193
jmp 0x97c5
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 %rax, %r15
movq 0x70(%rbx), %r14
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0xabbc
leaq 0x2bfc(%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 0x982d
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x9835
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 0x27d6(%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 0x9884
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x988b
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 0x98e2
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x98e9
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 0xabae
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x9924
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x993b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x9952
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x996d
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3290
movl $0x1f4, 0x14(%rbx)      # imm = 0x1F4
jmp 0x97c5
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x9998
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x9998
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x99b4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x99b4
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x99d0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x99d0
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99eb
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3520
nop