LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/MiscUtils.cpp
// Function: ut1::getFileType(std::filesystem::__cxx11::path const&, bool)
FileType getFileType(const std::filesystem::path& entry, bool followSymlinks)
{
    // First check for symlink.
    // is_symlink() never follows symlinks, while all other is_*() functions follow symlinks.
    if (std::filesystem::is_symlink(entry))
    {
        // Report broken symlinks as symlink, even when following symlinks.
        if ((!followSymlinks) || (!std::filesystem::exists(entry)))
        {
            return FT_SYMLINK;
        }
    }
    if (std::filesystem::is_regular_file(entry))
    {
        return FT_REGULAR;
    }
    else if (std::filesystem::is_directory(entry))
    {
        return FT_DIR;
    }
    else if (std::filesystem::is_fifo(entry))
    {
        return FT_FIFO;
    }
    else if (std::filesystem::is_block_file(entry))
    {
        return FT_BLOCK;
    }
    else if (std::filesystem::is_character_file(entry))
    {
        return FT_CHAR;
    }
    else if (std::filesystem::is_socket(entry))
    {
        return FT_SOCKET;
    }
    else
    {
        return FT_NON_EXISTING;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
callq 0xa073
testb %al, %al
je 0x9d72
pushq $0x2
popq %rbp
testb %r14b, %r14b
je 0x9dbf
movq %rbx, %rdi
callq 0xa080
testb %al, %al
je 0x9dbf
movq %rbx, %rdi
callq 0xa09b
xorl %ebp, %ebp
testb %al, %al
jne 0x9dbf
movq %rbx, %rdi
callq 0xa0a8
testb %al, %al
je 0x9d90
pushq $0x1
jmp 0x9dbe
movq %rbx, %rdi
callq 0xa0b5
testb %al, %al
je 0x9da0
pushq $0x3
jmp 0x9dbe
movq %rbx, %rdi
callq 0xa0c2
testb %al, %al
je 0x9db0
pushq $0x4
jmp 0x9dbe
movq %rbx, %rdi
callq 0xa0cf
testb %al, %al
je 0x9dc6
pushq $0x5
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
callq 0xa0dc
movzbl %al, %ebp
xorl $0x7, %ebp
jmp 0x9dbf
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/MiscUtils.cpp
// Function: ut1::getFileTypeStr[abi:cxx11](ut1::FileType)
std::string getFileTypeStr(FileType fileType)
{
    switch (fileType)
    {
    case FT_REGULAR: return "file";
    case FT_DIR: return "dir";
    case FT_SYMLINK: return "symlink";
    case FT_FIFO: return "fifo";
    case FT_BLOCK: return "block-device";
    case FT_CHAR: return "char-device";
    case FT_SOCKET: return "socket";
    case FT_NON_EXISTING: return "non-existing";
    }
    return "unknown-file-type";
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x7, %esi
ja 0x9e86
movl %esi, %eax
leaq 0x115eb(%rip), %rcx     # 0x1b3f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x12d1d(%rip), %rsi     # 0x1cb3a
leaq 0xf(%rsp), %rdx
jmp 0x9e92
leaq 0x116f3(%rip), %rsi     # 0x1b51e
leaq 0xb(%rsp), %rdx
jmp 0x9e92
leaq 0x12d11(%rip), %rsi     # 0x1cb4a
leaq 0xd(%rsp), %rdx
jmp 0x9e92
leaq 0x116d2(%rip), %rsi     # 0x1b519
leaq 0xc(%rsp), %rdx
jmp 0x9e92
leaq 0x116e9(%rip), %rsi     # 0x1b53e
leaq 0x8(%rsp), %rdx
jmp 0x9e92
leaq 0x12cf9(%rip), %rsi     # 0x1cb5c
leaq 0xe(%rsp), %rdx
jmp 0x9e92
leaq 0x116ba(%rip), %rsi     # 0x1b52b
leaq 0xa(%rsp), %rdx
jmp 0x9e92
leaq 0x116b8(%rip), %rsi     # 0x1b537
leaq 0x9(%rsp), %rdx
jmp 0x9e92
leaq 0x116be(%rip), %rsi     # 0x1b54b
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x760a
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/MiscUtils.cpp
// Function: ut1::setLastWriteTime(std::filesystem::__cxx11::directory_entry const&, std::chrono::time_point<std::filesystem::__file_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>>, bool)
void setLastWriteTime(const std::filesystem::directory_entry& entry, std::filesystem::file_time_type newTime, bool followSymlinks)
{
    auto sec = std::chrono::time_point_cast<std::chrono::seconds>(newTime);
    auto nsec = std::chrono::time_point_cast<std::chrono::nanoseconds>(newTime) - std::chrono::time_point_cast<std::chrono::nanoseconds>(sec);

    struct timespec t[2];
    t[0].tv_sec = 0;
    t[0].tv_nsec = UTIME_OMIT;
    t[1].tv_sec = sec.time_since_epoch().count();
    t[1].tv_nsec = nsec.count();

    utimensat(AT_FDCWD, entry.path().c_str(), t, followSymlinks ? 0 : AT_SYMLINK_NOFOLLOW);
}

// Assembly:
subq $0x28, %rsp
movl %edx, %ecx
movl $0x3b9aca00, %r8d       # imm = 0x3B9ACA00
movq %rsi, %rax
cqto
idivq %r8
imulq $-0x3b9aca00, %rax, %r8 # imm = 0xC4653600
movq %rsp, %rdx
andq $0x0, (%rdx)
addq %rsi, %r8
movq $0x3ffffffe, 0x8(%rdx)  # imm = 0x3FFFFFFE
movq %rax, 0x10(%rdx)
movq %r8, 0x18(%rdx)
movq (%rdi), %rsi
xorb $0x1, %cl
movzbl %cl, %ecx
shll $0x8, %ecx
pushq $-0x64
popq %rdi
callq 0x5270
addq $0x28, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/streplace.cpp
// Function: Streplace::applyAllRules(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long*)
std::string applyAllRules(const std::string& input, size_t* numMatchesOut = nullptr)
    {
        std::string r = input;
        size_t numMatches = 0;
        for (Rule& rule: rules)
        {
            numMatches += applyRule(r, rule);
        }
        if (numMatchesOut)
        {
            *numMatchesOut = numMatches;
        }
        return r;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rdx, %rsi
callq 0x55d0
movq 0x18(%r15), %r12
movq 0x20(%r15), %rbp
xorl %r13d, %r13d
cmpq %rbp, %r12
je 0xd08f
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xd88a
addq %rax, %r13
addq $0x48, %r12
jmp 0xd073
testq %r14, %r14
je 0xd097
movq %r13, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x51f0
movq %r14, %rdi
callq 0x5730
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/streplace.cpp
// Function: Streplace::processDirectory(std::filesystem::__cxx11::directory_entry const&)
void processDirectory(const std::filesystem::directory_entry& directoryEntry)
    {
        if (recursive && (!skipDir(directoryEntry.path())))
        {
            if (verbose >= 2)
            {
                std::cout << "Processing dir " << directoryEntry.path().string() << ".\n";
            }

            // Note: Take a copy of each directory_entry intentionally,
            // because we will potentially modify it (rename) in processDirectoryEntry.
            for (std::filesystem::directory_entry entry: std::filesystem::directory_iterator(directoryEntry))
            {
                processDirectoryEntry(entry);
            }

            numDirsProcessed++;
        }
        else
        {
            std::cout << "Ignoring dir " << directoryEntry.path().string() << ".\n";
            numIgnored++;
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, (%rdi)
jne 0xd578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a42e
testb %al, %al
je 0xd5ca
movq 0x1da31(%rip), %rdi     # 0x2afb0
leaq 0xf559(%rip), %rsi      # 0x1cadf
callq 0x5400
movq %rax, %r15
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xd030
movq %r15, %rdi
movq %r12, %rsi
callq 0x53c0
leaq 0xe35d(%rip), %rsi      # 0x1b90d
movq %rax, %rdi
callq 0x5400
leaq 0x20(%rsp), %rdi
callq 0x51f0
pushq $0x78
popq %rax
jmp 0xd6dd
cmpl $0x2, 0x4(%rbx)
jb 0xd61a
movq 0x1d9d9(%rip), %rdi     # 0x2afb0
leaq 0xf4f1(%rip), %rsi      # 0x1cacf
callq 0x5400
movq %rax, %r15
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xd030
movq %r15, %rdi
movq %r12, %rsi
callq 0x53c0
leaq 0xe305(%rip), %rsi      # 0x1b90d
movq %rax, %rdi
callq 0x5400
leaq 0x20(%rsp), %rdi
callq 0x51f0
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1a4a2
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x1a54c
leaq 0x8(%rsp), %r14
leaq 0x68(%rsp), %rdi
movaps -0x8(%rdi), %xmm0
movaps %xmm0, -0x8(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rdi)
callq 0x19cac
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x1a54c
leaq 0x58(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r15)
leaq 0x78(%rsp), %rdi
callq 0x19cac
movq %rsp, %r12
leaq 0x20(%rsp), %r13
movq 0x8(%rsp), %rax
cmpq 0x58(%rsp), %rax
je 0xd6be
movq %r12, %rdi
callq 0x5770
movq %r13, %rdi
movq %rax, %rsi
callq 0xb9da
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb9f8
movq %r13, %rdi
callq 0xb92c
movq %r12, %rdi
callq 0x5150
jmp 0xd682
movq %r15, %rdi
callq 0x19cac
movq %r14, %rdi
callq 0x19cac
leaq 0x18(%rsp), %rdi
callq 0x19cac
movl $0xa8, %eax
incq (%rbx,%rax)
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0xd6f4
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x51f0
jmp 0xd731
jmp 0xd714
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb92c
jmp 0xd717
movq %rax, %rbx
movq %r15, %rdi
callq 0x19cac
movq %r14, %rdi
callq 0x19cac
leaq 0x18(%rsp), %rdi
callq 0x19cac
movq %rbx, %rdi
callq 0x5730
nop
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/streplace.cpp
// Function: Streplace::applyRule(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, Rule&)
uint64_t applyRule(std::string& s, Rule& rule)
    {
        size_t numMatches = 0;

        s = ut1::regex_replace(s, std::regex(rule.lhs), [&](const std::smatch& match)
            { return replaceMatch(match, rule, numMatches); });

        rule.numMatches += numMatches;
        return numMatches;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x20(%rsp), %r13
andq $0x0, (%r13)
leaq 0x40(%rsp), %r12
pushq $0x10
popq %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0xdb1a
movq %r15, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %r13, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xd943
leaq 0x60(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x5500
movq %r15, %rdi
callq 0x51f0
leaq 0x40(%rsp), %rdi
callq 0xdb7c
movq 0x20(%rsp), %rax
addq %rax, 0x40(%rbx)
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xdb7c
movq %rbx, %rdi
callq 0x5730
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/streplace.cpp
// Function: Streplace::skipDir(std::filesystem::__cxx11::path const&)
bool skipDir(const std::filesystem::path& dir)
    {
        if (all)
        {
            return false;
        }

        if (dir.filename() == ".git")
        {
            return true;
        }

        return false;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
cmpb $0x0, 0x2(%rdi)
je 0x1a441
xorl %ebx, %ebx
jmp 0x1a482
movq %rsp, %rdi
callq 0xcfbe
leaq 0x269d(%rip), %rsi      # 0x1caed
leaq 0x28(%rsp), %rdi
pushq $0x2
popq %rdx
callq 0x1a4b8
movq %rsp, %r14
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1a4ab
movl %eax, %ebx
movq %r15, %rdi
callq 0xb92c
movq %r14, %rdi
callq 0xb92c
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb92c
movq %rbx, %rdi
callq 0x5730
nop
// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/streplace.cpp
// Function: Streplace::getFileTypeStr(std::filesystem::__cxx11::directory_entry const&)
std::string getFileTypeStr(const std::filesystem::directory_entry& directoryEntry)
    {
        if ((!followLinks) && directoryEntry.is_symlink())
        {
            return "symlink";
        }
        else if (directoryEntry.is_regular_file())
        {
            return "file";
        }
        else if (directoryEntry.is_directory())
        {
            return "directory";
        }
        else if (directoryEntry.is_block_file())
        {
            return "block device";
        }
        else if (directoryEntry.is_character_file())
        {
            return "characters device";
        }
        else if (directoryEntry.is_fifo())
        {
            return "fifo";
        }
        else if (directoryEntry.is_socket())
        {
            return "socket";
        }
        else
        {
            // Will never get here.
            return "unknown file type";
        }
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
cmpb $0x0, 0x1(%rsi)
jne 0x1a5ad
movq %r14, %rdi
callq 0x9ff8
testb %al, %al
je 0x1a5ad
leaq 0x25a7(%rip), %rsi      # 0x1cb4a
leaq 0x7(%rsp), %rdx
jmp 0x1a656
movq %r14, %rdi
callq 0xa020
testb %al, %al
je 0x1a5ca
leaq 0x257a(%rip), %rsi      # 0x1cb3a
leaq 0x6(%rsp), %rdx
jmp 0x1a656
movq %r14, %rdi
callq 0xa02e
testb %al, %al
je 0x1a5e4
leaq 0x251f(%rip), %rsi      # 0x1cafc
leaq 0x5(%rsp), %rdx
jmp 0x1a656
movq %r14, %rdi
callq 0xa04a
testb %al, %al
je 0x1a5fe
leaq 0x250f(%rip), %rsi      # 0x1cb06
leaq 0x4(%rsp), %rdx
jmp 0x1a656
movq %r14, %rdi
callq 0xa058
testb %al, %al
je 0x1a618
leaq 0x2502(%rip), %rsi      # 0x1cb13
leaq 0x3(%rsp), %rdx
jmp 0x1a656
movq %r14, %rdi
callq 0xa03c
testb %al, %al
je 0x1a632
leaq 0xeee(%rip), %rsi       # 0x1b519
leaq 0x2(%rsp), %rdx
jmp 0x1a656
movq %r14, %rdi
callq 0xa066
testb %al, %al
je 0x1a64c
leaq 0xef2(%rip), %rsi       # 0x1b537
leaq 0x1(%rsp), %rdx
jmp 0x1a656
leaq 0x24d2(%rip), %rsi      # 0x1cb25
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x760a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Server.cpp
// Function: Server::initSocketList()
void Server::initSocketList()
{
  m_socketCount = 1;
  free(m_sockets);
  m_sockets = (struct pollfd*)malloc(sizeof(struct pollfd) * m_socketCount);
  if (m_sockets == 0)
  {
    m_logger.logError("InitSocketList malloc error: Out of Memory");
    exit(1);
  }
  m_sockets[0].fd = m_mainSocket;
  m_sockets[0].events = POLLIN;
  m_sockets[0].revents = 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0x1, 0x10(%rdi)
movq 0x8(%rdi), %rdi
callq 0x3350
movslq 0x10(%rbx), %rdi
shlq $0x3, %rdi
callq 0x33b0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x3feb
movl (%rbx), %ecx
movl %ecx, (%rax)
movl $0x1, 0x4(%rax)
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq 0x58(%rbx), %rbx
leaq 0x5082(%rip), %rsi      # 0x9078
leaq 0x8(%rsp), %r14
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x438c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x80f6
leaq 0x8(%rsp), %rdi
callq 0x35d8
pushq $0x1
popq %rdi
callq 0x3370
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Server.cpp
// Function: Server::watchSocket(int)
void Server::watchSocket(int socket)
{
  if (socket < 0)
  {
    // not a real socket, do nothing.
    return;
  }


  m_socketCount++;
  m_sockets = (struct pollfd*)realloc(m_sockets, sizeof(struct pollfd) * m_socketCount);
  if (m_sockets == 0)
  {
    // Try and log the error and close the socket. Maybe someone will free some RAM.
    // In all likelihood, we're hosed if we even get here, though.
    m_logger.logError("InitSocketList realloc error: Out of Memory");
    shutdown(socket, SHUT_RDWR);
    close(socket);
    return;
  }
  m_sockets[m_socketCount - 1].fd = socket;
  m_sockets[m_socketCount - 1].events = POLLIN;
  m_sockets[m_socketCount - 1].revents = 0;
  m_connections[socket] = new Connection(socket, m_logger, m_config);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl %esi, 0xc(%rsp)
testl %esi, %esi
js 0x421e
movl %esi, %ebx
movq %rdi, %r14
movslq 0x10(%rdi), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x10(%rdi)
movq 0x8(%rdi), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x34e0
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x41dc
movslq 0x10(%r14), %rcx
movl %ebx, -0x8(%rax,%rcx,8)
movl $0x1, -0x4(%rax,%rcx,8)
movl $0x80, %edi
callq 0x32c0
movq %rax, %r15
movq 0x58(%r14), %rdx
movq 0x60(%r14), %rcx
movq %rax, %rdi
movl %ebx, %esi
callq 0x4a28
addq $0x18, %r14
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x433e
movq %r15, (%rax)
jmp 0x421e
movq 0x58(%r14), %r14
leaq 0x4ebc(%rip), %rsi      # 0x90a3
leaq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x438c
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x80f6
leaq 0x10(%rsp), %rdi
callq 0x35d8
pushq $0x2
popq %rsi
movl %ebx, %edi
callq 0x33c0
movl %ebx, %edi
callq 0x35a0
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x35d8
jmp 0x424c
movq %rax, %rbx
jmp 0x424c
movq %rax, %rbx
movl $0x80, %esi
movq %r15, %rdi
callq 0x32d0
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Server.cpp
// Function: Server::~Server()
Server::~Server()
{
  vector<int> socketsToUnwatch;
  for (int i = 0; i < m_socketCount; ++i)
  {
    socketsToUnwatch.push_back(m_sockets[i].fd);
  }
  unwatchSockets(socketsToUnwatch);
  free(m_sockets);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rsp, %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
xorl %r15d, %r15d
xorl %r12d, %r12d
movslq 0x10(%rbx), %rax
cmpq %rax, %r12
jge 0x429e
movq 0x8(%rbx), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x4320
incq %r12
addq $0x8, %r15
jmp 0x427d
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x403a
movq 0x8(%rbx), %rdi
callq 0x3350
movq %rsp, %rdi
callq 0x442a
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x43d2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x42d4
movq %rax, %rdi
callq 0x43c7
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/main.cpp
// Function: main
int main(int argc, char *argv[])
{
  signal(SIGPIPE, SIG_IGN);
  signal(SIGINT, sigHandler);
  signal(SIGTERM, sigHandler);

  if (daemon(0, 0) == -1)
  {
    return 5; // No logfiles yet.
  }

  Config config(configPath);
  Logger logger(config);
  logger.open();
  
  server = new Server(80, logger, config);
  if (!server->bindPort())
  {
    return 1;
  }
  if (!logger.open())
  {
    return 2;
  }
  else if (!setUser(config.getString(Config::S_KEY_RUN_AS_USERNAME).c_str(), logger))
  {
    return 3;
  }
  else if (!server->start())
  {
    return 4;
  }
  //@TODO: Set user back to root so Server destructor can clean up effectively (may not be nessecary?).
  delete server;
  server = NULL;
  logger.close();
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
pushq $0xd
popq %rdi
pushq $0x1
popq %rsi
callq 0x3340
leaq -0x368(%rip), %r14      # 0x5260
pushq $0x2
popq %rbx
movl %ebx, %edi
movq %r14, %rsi
callq 0x3340
pushq $0xf
popq %rdi
movq %r14, %rsi
callq 0x3340
xorl %edi, %edi
xorl %esi, %esi
callq 0x3360
cmpl $-0x1, %eax
je 0x56eb
movq 0x8d07(%rip), %rsi      # 0xe300
leaq 0x18(%rsp), %rdi
movq %rsp, %rdx
callq 0x438c
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x82cc
leaq 0x18(%rsp), %rdi
callq 0x35d8
movq %rsp, %rdi
leaq 0x38(%rsp), %rsi
callq 0x7ef0
movq %rsp, %rdi
callq 0x7efc
pushq $0x68
popq %rdi
callq 0x32c0
movq %rax, %r14
pushq $0x50
popq %rsi
movq %rsp, %rdx
leaq 0x38(%rsp), %rcx
movq %rax, %rdi
callq 0x38fc
movq %r14, 0x8cbf(%rip)      # 0xe318
movq %r14, %rdi
callq 0x3946
testb %al, %al
je 0x56f0
movq %rsp, %rdi
callq 0x7efc
testb %al, %al
je 0x56f3
leaq 0x8d84(%rip), %rdx      # 0xe400
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x8808
movq 0x18(%rsp), %rdi
movq %rsp, %rsi
callq 0x5271
movl %eax, %ebx
leaq 0x18(%rsp), %rdi
callq 0x35d8
testb %bl, %bl
je 0x570a
movq 0x8c69(%rip), %rdi      # 0xe318
callq 0x3baa
testb %al, %al
je 0x570e
movq 0x8c59(%rip), %rbx      # 0xe318
testq %rbx, %rbx
je 0x56cc
movq %rbx, %rdi
callq 0x425a
pushq $0x68
popq %rsi
movq %rbx, %rdi
callq 0x32d0
andq $0x0, 0x8c39(%rip)      # 0xe318
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x7fa6
jmp 0x56f3
pushq $0x5
popq %rbx
jmp 0x56fd
pushq $0x1
popq %rbx
leaq 0x38(%rsp), %rdi
callq 0x575c
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
pushq $0x3
jmp 0x56f2
pushq $0x4
jmp 0x56f2
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x35d8
jmp 0x574a
jmp 0x5747
movq %rax, %rbx
pushq $0x68
popq %rsi
movq %r14, %rdi
callq 0x32d0
jmp 0x574a
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x35d8
jmp 0x5754
movq %rax, %rbx
jmp 0x5754
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x575c
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/HttpRequest.cpp
// Function: HttpRequest::getHeader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
string HttpRequest::getHeader(const string& headerName) const
{
  string lcHeader = headerName;
  toLower(lcHeader);
  HeaderMap::const_iterator it = m_headers.find(lcHeader);
  if (it == m_headers.end())
  {
    return "";
  }
  else
  {
    return it->second;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x33d0
movq %r15, %rdi
callq 0x5e68
leaq 0x70(%r14), %rdi
movq %r15, %rsi
callq 0x61c0
addq $0x78, %r14
cmpq %r14, %rax
je 0x5f0d
addq $0x40, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x33d0
jmp 0x5f21
leaq 0x324c(%rip), %rsi      # 0x9160
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
callq 0x438c
leaq 0x10(%rsp), %rdi
callq 0x35d8
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x5f3a
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/HttpResponse.cpp
// Function: HttpResponse::unescapeUri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
string HttpResponse::unescapeUri(const string& escapedUri)
{
  string unescaped;
  if (escapedUri.size() == 0)
  {
    return unescaped;
  }
  for (size_t i = 0; i < escapedUri.size(); i++)
  {
    if (escapedUri[i] == '%')
    {
      if (escapedUri.size() >= (i + 3))
      {
        string escapedChar = escapedUri.substr(i + 1, 2);
        long value = strtol(escapedChar.c_str(), NULL, 16);
        unescaped += static_cast<unsigned char>(value);
        i += 2; // skip the encoded block now.
      }
      else
      {
        return unescaped; // Error, return what we've got.
      }
    }
    else
    {
      unescaped += escapedUri[i];
    }
  }
  return unescaped;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x69c3
movq %rsi, %r14
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
pushq $0x2
popq %r12
pushq $0x10
popq %rbp
cmpq %rax, %r13
jae 0x69c3
movq (%r14), %rcx
movb (%rcx,%r13), %cl
cmpb $0x25, %cl
jne 0x69af
leaq 0x3(%r13), %rcx
cmpq %rcx, %rax
jb 0x69c3
leaq 0x1(%r13), %rdx
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x32e0
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x33f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3250
addq $0x2, %r13
movq %r15, %rdi
callq 0x35d8
jmp 0x69ba
movsbl %cl, %esi
movq %rbx, %rdi
callq 0x3250
incq %r13
movq 0x8(%r14), %rax
jmp 0x695c
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x35d8
jmp 0x69e9
jmp 0x69e6
movq %rax, %r14
movq %rbx, %rdi
callq 0x35d8
movq %r14, %rdi
callq 0x3510
nop
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/HttpResponse.cpp
// Function: HttpResponse::pathLooksSafe(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool HttpResponse::pathLooksSafe(const string& path)
{
  if (path.size() == 0)
  {
    return false;
  }
  if (path[0] != '/')
  {
    return false;
  }
  if (path.find("/../") != path.npos)
  {
    return false;
  }
  for (size_t i = 0; i < path.size(); ++i)
  {
    if ((path[i] < 32) || (path[i] > 126))
    {
      return false;
    }
  }
  return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x6a89
movq %rdi, %r14
movq (%rdi), %rax
cmpb $0x2f, (%rax)
jne 0x6a89
leaq 0x288a(%rip), %rsi      # 0x92dd
xorl %ebx, %ebx
movq %r14, %rdi
xorl %edx, %edx
callq 0x35c0
cmpq $-0x1, %rax
jne 0x6a8b
movq (%r14), %rax
movq 0x8(%r14), %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
sete %bl
je 0x6a8b
movb (%rax,%rdx), %sil
addb $-0x7f, %sil
incq %rdx
cmpb $-0x60, %sil
ja 0x6a6e
jmp 0x6a8b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/HttpResponse.cpp
// Function: HttpResponse::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned long)
size_t HttpResponse::read(string& buffer, const size_t maxBytesToRead)
{
  size_t remaining = maxBytesToRead;
  if (!m_headerBuffer.empty())
  {
    string temp = m_headerBuffer.substr(0, maxBytesToRead);
    buffer.append(temp);
    remaining -= temp.size();
    if (remaining == 0)
    {
      return temp.size();
    }
  }
  return m_reader->read(buffer, remaining);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpq $0x0, 0x40(%rdi)
je 0x6b0b
leaq 0x38(%r15), %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x32e0
movq %r14, %rdi
movq %r12, %rsi
callq 0x3590
leaq 0x8(%rsp), %rdi
movq 0x8(%rdi), %r12
callq 0x35d8
subq %r12, %rbx
je 0x6b1e
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x10(%rax)
movq %rax, %r12
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/FilenameResolver.cpp
// Function: FilenameResolver::resolveDir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Config const&, long*)
string FilenameResolver::resolveDir(const string& dirPath, const Config& config, time_t* mtime)
{
  string temp;
  string rPath = dirPath;
  rPath = resolve(dirPath + "/main.html", config, temp, mtime);
  if (!rPath.empty())
  {
    return rPath;
  }

  return findNewestInDir(dirPath, config);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rsp, %rdi
callq 0x33d0
leaq 0x24ff(%rip), %rdx      # 0x9315
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x7320
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rcx
movq %r14, %rdx
movq %r12, %r8
callq 0x6c24
movq %rsp, %r12
leaq 0x60(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x3380
movq %r13, %rdi
callq 0x35d8
leaq 0x20(%rsp), %rdi
callq 0x35d8
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x6e8f
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
leaq 0x10(%rsp), %rcx
movq -0x10(%rcx), %rsi
cmpq %rcx, %rsi
je 0x6e9f
movq %rsi, (%rbx)
movq 0x10(%rsp), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x6ea5
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6f12
jmp 0x6eb8
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, 0x8(%rbx)
movq %rcx, (%rsp)
andq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rsp, %rdi
callq 0x35d8
leaq 0x40(%rsp), %rdi
callq 0x35d8
movq %rbx, %rax
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x6eef
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x35d8
jmp 0x6ef2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x35d8
jmp 0x6eff
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x69b3(%rip), %rax      # 0xdd20
movq %rax, (%rdi)
leaq 0x40(%rdi), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movq %rax, 0x30(%rdi)
andq $0x0, 0x38(%rdi)
xorl %eax, %eax
movb %al, 0x40(%rdi)
leaq 0x60(%rdi), %rcx
movq %rcx, 0x50(%rdi)
andq $0x0, 0x58(%rdi)
movb %al, 0x60(%rdi)
movq %rdx, 0x70(%rdi)
andw $0x0, 0x10(%rdi)
movq %rsi, %r12
andl $0x0, 0x14(%rdi)
leaq 0x30(%rdi), %r14
andq $0x0, 0x8(%rdi)
leaq 0x50(%rdi), %r15
andq $0x0, 0x18(%rdi)
callq 0x752e
testb %al, %al
je 0x74b3
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x7104
leaq 0x8(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x3380
movq %r12, %rdi
callq 0x35d8
movq 0x8(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x8104
leaq 0x1fd5(%rip), %rsi      # 0x93d7
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x42fb
leaq 0x1e1e(%rip), %rdx      # 0x9236
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x42dc
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x3590
leaq 0x8(%rsp), %rdi
callq 0x35d8
leaq 0x28(%rsp), %rdi
callq 0x35d8
leaq 0x48(%rsp), %rdi
callq 0x35d8
leaq 0x1f8f(%rip), %rsi      # 0x93e8
leaq 0x28(%rsp), %rdi
movq %r14, %rdx
callq 0x6b93
leaq 0x1dc9(%rip), %rdx      # 0x9236
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x42dc
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x3590
leaq 0x8(%rsp), %rdi
callq 0x35d8
leaq 0x28(%rsp), %rdi
callq 0x35d8
leaq 0x1d92(%rip), %rsi      # 0x9236
movq %r15, %rdi
callq 0x3560
movl $0xc8, 0x14(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r12
leaq 0x8(%rsp), %rdi
callq 0x35d8
jmp 0x74d1
movq %rax, %r12
leaq 0x28(%rsp), %rdi
jmp 0x7500
jmp 0x750b
movq %rax, %r12
leaq 0x8(%rsp), %rdi
callq 0x35d8
jmp 0x74ec
movq %rax, %r12
leaq 0x28(%rsp), %rdi
callq 0x35d8
jmp 0x74fb
movq %rax, %r12
leaq 0x48(%rsp), %rdi
callq 0x35d8
jmp 0x750e
jmp 0x750b
jmp 0x750b
movq %rax, %r12
movq %r15, %rdi
callq 0x35d8
movq %r14, %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x6c1e
movq %r12, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3290
cmpl $-0x1, %eax
je 0x759f
movq (%r14), %rdi
leaq 0x1fc6(%rip), %rsi      # 0x9527
callq 0x3330
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x7583
movq 0xb8(%rsp), %rax
movq %rax, 0x8(%rbx)
movb $0x1, 0x10(%rbx)
movb $0x1, %al
jmp 0x75a8
callq 0x3040
movslq (%rax), %rsi
cmpq $0x2, %rsi
je 0x759f
cmpl $0xd, %esi
jne 0x75b7
movl $0x193, 0x14(%rbx)      # imm = 0x193
jmp 0x75a6
movl $0x194, 0x14(%rbx)      # imm = 0x194
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r15
movq 0x70(%rbx), %r14
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0x8104
leaq 0x1e25(%rip), %rsi      # 0x93f7
leaq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0x42fb
leaq 0x1a48(%rip), %rdx      # 0x902e
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x42dc
movl (%r15), %edi
callq 0x3110
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %rax, %rdx
callq 0x42dc
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x80f6
leaq 0x48(%rsp), %rdi
callq 0x35d8
leaq 0x28(%rsp), %rdi
callq 0x35d8
leaq 0x8(%rsp), %rdi
callq 0x35d8
leaq 0x68(%rsp), %rdi
callq 0x35d8
movl $0x1f4, 0x14(%rbx)      # imm = 0x1F4
jmp 0x75a6
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x35d8
jmp 0x7662
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x35d8
jmp 0x7671
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35d8
jmp 0x7680
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/FileReader.cpp
// Function: FileReader::readFromInternalBufferString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned long)
size_t FileReader::readFromInternalBufferString(string& internalBuffer, string& externalBuffer, const size_t maxBytes)
{
  int bytesRead = 0;
  if (internalBuffer.size() != 0)
  {
    string temp = internalBuffer.substr(0, maxBytes);
    bytesRead = temp.size();
    internalBuffer = internalBuffer.substr(bytesRead);
    externalBuffer += temp;
  }
  return bytesRead;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpq $0x0, 0x8(%rsi)
je 0x78db
movq %rdx, %r14
movq %rsi, %r15
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x32e0
movslq 0x8(%rbx), %rbx
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x32e0
leaq 0x28(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3380
movq %r12, %rdi
callq 0x35d8
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3590
leaq 0x8(%rsp), %rdi
callq 0x35d8
jmp 0x78dd
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x78ee
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
nop
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/FileReader.cpp
// Function: FileReader::~FileReader()
FileReader::~FileReader()
{
  if (m_file)
  {
    if (fclose(m_file))
    {
      m_logger.logError("FileReader fclose error(" + Utils::llToString(errno) + "): " + strerror(errno));
    }
    m_file = NULL;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
leaq 0x6406(%rip), %rax      # 0xdd20
movq %rax, (%rdi)
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x79ca
callq 0x32b0
testl %eax, %eax
je 0x79c5
movq 0x70(%rbx), %r14
callq 0x3040
movq %rax, %r15
movslq (%rax), %rsi
movq %rsp, %rdi
callq 0x8104
leaq 0x1ad2(%rip), %rsi      # 0x9427
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x42fb
leaq 0x16c5(%rip), %rdx      # 0x902e
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x42dc
movl (%r15), %edi
callq 0x3110
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %rax, %rdx
callq 0x42dc
leaq 0x60(%rsp), %rsi
movq %r14, %rdi
callq 0x80f6
leaq 0x60(%rsp), %rdi
callq 0x35d8
leaq 0x40(%rsp), %rdi
callq 0x35d8
leaq 0x20(%rsp), %rdi
callq 0x35d8
movq %rsp, %rdi
callq 0x35d8
andq $0x0, 0x20(%rbx)
leaq 0x50(%rbx), %rdi
callq 0x35d8
leaq 0x30(%rbx), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x6c1e
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x43c7
nop
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/ErrorReader.cpp
// Function: ErrorReader::ErrorReader(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
ErrorReader::ErrorReader(int httpErrorCode, const std::string& extraMsg, const std::string& extraHeaders)
{
  m_lengthKnown = true;
  m_done = false;
  m_httpCode = httpErrorCode;
  m_bytesRead = 0;
  
  string num = Utils::llToString(httpErrorCode);
  string msg = getErrorMessage(httpErrorCode);
  string extMsg = msg;
  if (!extraMsg.empty())
  {
    extMsg += "\n" + extraMsg;
  }
  extMsg += "\n";
  m_contentLength = extMsg.size();
  m_dataBuffer += "Content-Length: " + Utils::llToString(m_contentLength) + "\r\n";
  m_dataBuffer += "Content-Type: text/plain\r\n";
  m_dataBuffer += extraHeaders;
  m_dataBuffer += "\r\n";
  m_dataBuffer += extMsg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x6347(%rip), %rax      # 0xdd78
movq %rax, (%rdi)
leaq 0x30(%rdi), %rax
movq %rax, 0x20(%rdi)
andq $0x0, 0x28(%rdi)
leaq 0x20(%rdi), %r14
movb $0x0, 0x30(%rdi)
movw $0x1, 0x10(%rdi)
movl %esi, 0x14(%rdi)
andq $0x0, 0x18(%rdi)
movslq %esi, %rsi
leaq 0xa0(%rsp), %rdi
callq 0x8104
leaq 0x80(%rsp), %rdi
movl %ebp, %esi
callq 0x7c1c
leaq 0x20(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x33d0
cmpq $0x0, 0x8(%r12)
je 0x7ab7
leaq 0x17a0(%rip), %rsi      # 0x9237
movq %rsp, %rdi
movq %r12, %rdx
callq 0x6b93
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x3590
movq %rsp, %rdi
callq 0x35d8
leaq 0x1779(%rip), %rsi      # 0x9237
leaq 0x20(%rsp), %rdi
callq 0x3560
movq 0x28(%rsp), %rsi
movq %rsi, 0x8(%rbx)
leaq 0x40(%rsp), %rdi
callq 0x8104
leaq 0x18f5(%rip), %rsi      # 0x93d7
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x42fb
leaq 0x173e(%rip), %rdx      # 0x9236
movq %rsp, %rdi
leaq 0x60(%rsp), %rsi
callq 0x42dc
movq %rsp, %rsi
movq %r14, %rdi
callq 0x3590
movq %rsp, %rdi
callq 0x35d8
leaq 0x60(%rsp), %rdi
callq 0x35d8
leaq 0x40(%rsp), %rdi
callq 0x35d8
leaq 0x19ab(%rip), %rsi      # 0x94de
movq %r14, %rdi
callq 0x3560
movq %r14, %rdi
movq %r15, %rsi
callq 0x3590
leaq 0x16e9(%rip), %rsi      # 0x9236
movq %r14, %rdi
callq 0x3560
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x3590
leaq 0x20(%rsp), %rdi
callq 0x35d8
leaq 0x80(%rsp), %rdi
callq 0x35d8
leaq 0xa0(%rsp), %rdi
callq 0x35d8
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %rsp, %rdi
jmp 0x7bc4
jmp 0x7bdc
movq %rax, %r15
movq %rsp, %rdi
callq 0x35d8
jmp 0x7bb0
movq %rax, %r15
leaq 0x60(%rsp), %rdi
callq 0x35d8
jmp 0x7bbf
movq %rax, %r15
leaq 0x40(%rsp), %rdi
callq 0x35d8
jmp 0x7bdf
jmp 0x7bdc
movq %rax, %r15
jmp 0x7be9
movq %rax, %r15
jmp 0x7bf6
movq %rax, %r15
jmp 0x7c03
movq %rax, %r15
leaq 0x20(%rsp), %rdi
callq 0x35d8
leaq 0x80(%rsp), %rdi
callq 0x35d8
leaq 0xa0(%rsp), %rdi
callq 0x35d8
movq %r14, %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x6c1e
movq %r15, %rdi
callq 0x3510
nop
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/ErrorReader.cpp
// Function: ErrorReader::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned long)
size_t ErrorReader::read(std::string& buffer, const size_t maxBytesToRead)
{
  if (maxBytesToRead < m_dataBuffer.size())
  {
    buffer.append(m_dataBuffer.substr(0, maxBytesToRead));
    m_dataBuffer = m_dataBuffer.substr(maxBytesToRead);
    m_bytesRead += maxBytesToRead;
    return maxBytesToRead;
  }
  int size = m_dataBuffer.size();
  buffer.append(m_dataBuffer);
  m_dataBuffer.clear();
  m_done = true;
  m_bytesRead += size;
  return size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x20(%rdi), %r15
movq 0x28(%rdi), %r13
cmpq %rdx, %r13
jbe 0x7e72
movq %rdx, %r14
movq %rsp, %r13
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x32e0
movq %r12, %rdi
movq %r13, %rsi
callq 0x3590
movq %rsp, %rdi
callq 0x35d8
movq %rsp, %r12
pushq $-0x1
popq %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x32e0
movq %r15, %rdi
movq %r12, %rsi
callq 0x3380
movq %r12, %rdi
callq 0x35d8
jmp 0x7e90
movq %r12, %rdi
movq %r15, %rsi
callq 0x3590
andq $0x0, 0x28(%rbx)
movq 0x20(%rbx), %rax
movb $0x0, (%rax)
movb $0x1, 0x11(%rbx)
movslq %r13d, %r14
addq %r14, 0x18(%rbx)
movq %r14, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Logger.cpp
// Function: Logger::open()
bool Logger::open()
{
  string accessFilePath = m_config.getString(Config::S_KEY_ACCESS_FILE_PATH);
  string errorFilePath = m_config.getString(Config::S_KEY_ERROR_FILE_PATH);

  close();
  FILE* access = fopen(accessFilePath.c_str(), "a");
  if (access == NULL)
  {
    return false;
  }
  FILE* error = fopen(errorFilePath.c_str(), "a");
  if (error == NULL)
  {
    return false;
  }
  m_accessFile = access;
  m_errorFile = error;
  return true;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x64b0(%rip), %rdx      # 0xe3c0
leaq 0x8(%rsp), %rdi
callq 0x8808
movq (%rbx), %rsi
leaq 0x64bc(%rip), %rdx      # 0xe3e0
leaq 0x28(%rsp), %rdi
callq 0x8808
movq %rbx, %rdi
callq 0x7fa6
movq 0x8(%rsp), %rdi
leaq 0x17c8(%rip), %rsi      # 0x970a
callq 0x3330
testq %rax, %rax
je 0x7f71
movq %rax, %r14
movq 0x28(%rsp), %rdi
leaq 0x17af(%rip), %rsi      # 0x970a
callq 0x3330
testq %rax, %rax
je 0x7f71
movq %r14, 0x8(%rbx)
movq %rax, 0x10(%rbx)
movb $0x1, %bl
jmp 0x7f73
xorl %ebx, %ebx
leaq 0x28(%rsp), %rdi
callq 0x35d8
leaq 0x8(%rsp), %rdi
callq 0x35d8
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Logger.cpp
// Function: Logger::close()
void Logger::close()
{
  if (m_accessFile != NULL)
  {
    fclose(m_accessFile);
    m_accessFile = NULL;
  }
  if (m_errorFile != NULL)
  {
    fclose(m_errorFile);
    m_errorFile = NULL;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x7fbd
callq 0x32b0
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x7fd0
callq 0x32b0
andq $0x0, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Logger.cpp
// Function: Logger::log(_IO_FILE*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Logger::log(FILE* file, const string& msg)
{
  if (file != NULL)
  {
    string logline = Utils::llToString(time(NULL)) + "\t" + msg + "\n";
    size_t bytesWritten = fwrite(logline.c_str(), 1, logline.size(), file);
    if (bytesWritten != logline.size())
    {
      // This wont actually go anywhere.
      printf("Log writing error %d (%s).\n", errno, strerror(errno));
    }
    else
    {
      fflush(file); // Can take this out for performance reasons if required.
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
testq %rsi, %rsi
je 0x80b6
movq %rdx, %r14
movq %rsi, %rbx
xorl %edi, %edi
callq 0x32a0
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x8104
leaq 0x1148(%rip), %rdx      # 0x915f
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x42dc
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %r14, %rdx
callq 0x510d
leaq 0x11fa(%rip), %rdx      # 0x9237
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x42dc
leaq 0x40(%rsp), %rdi
callq 0x35d8
leaq 0x20(%rsp), %rdi
callq 0x35d8
leaq 0x60(%rsp), %rdi
callq 0x35d8
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0x3580
cmpq 0x8(%rsp), %rax
jne 0x808d
movq %rbx, %rdi
callq 0x3320
jmp 0x80ae
callq 0x3040
movl (%rax), %ebx
movl %ebx, %edi
callq 0x3110
leaq 0x166a(%rip), %rdi      # 0x970c
movl %ebx, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3050
movq %rsp, %rdi
callq 0x35d8
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x35d8
jmp 0x80d5
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x35d8
jmp 0x80e4
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x35d8
movq %rbx, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Utils.cpp
// Function: Utils::llToString[abi:cxx11](long long)
string Utils::llToString(long long i)
{
  string s;
  char str[32] = {0};
  size_t strLen = snprintf(str, 31, "%lli", i);
  s.append(str, strLen);
  return s;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rcx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
leaq 0x15f1(%rip), %rdx      # 0x9728
pushq $0x1f
popq %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x34a0
movslq %eax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3070
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x35d8
movq %r14, %rdi
callq 0x3510
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Utils.cpp
// Function: Utils::UriEscape(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
string Utils::UriEscape(const string& in)
{
  string out;
  for (size_t i = 0; i < in.size(); i++)
  {
    char current = in[i];
    if (
         ((current >= 65) && (current <= 90)) || // A-Z
         ((current >= 97) && (current <= 122)) || // a-z
         ((current >= 48) && (current <= 57)) || // 0-9
         (current == '$') || 
         (current == '&') || 
         (current == '+') || 
         (current == ',') || 
         (current == '/') || 
         (current == ':') || 
         (current == ';') || 
         (current == '=') || 
         (current == '?') || 
         (current == '@') || 
         (current == '-') || 
         (current == '_') || 
         (current == '.') || 
         (current == '+') || 
         (current == '!') || 
         (current == '*') || 
         (current == '(') || 
         (current == ')') ||
         (current == '\'')
       )
    {
      out += current;
    }
    else
    {
      char str[4] = {0};
      snprintf(str, 4, "%%%02hhx", current);
      out += str;
    }
  }
  return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movq %rsi, %r14
movb $0x0, 0x10(%rdi)
leaq 0x4(%rsp), %r12
pushq $0x4
popq %r13
movabsq $0x40000000d6007fe9, %rbp # imm = 0x40000000D6007FE9
xorl %r15d, %r15d
cmpq 0x8(%r14), %r15
jae 0x8212
movq (%r14), %rax
movb (%rax,%r15), %al
movsbl %al, %ecx
leal -0x30(%rax), %edx
cmpb $0xa, %dl
jb 0x81dd
movl %eax, %edx
andb $-0x21, %dl
addb $-0x41, %dl
cmpb $0x1a, %dl
jb 0x81dd
movzbl %al, %eax
addl $-0x21, %eax
cmpl $0x3e, %eax
ja 0x81ec
btq %rax, %rbp
jae 0x81ec
movq %rbx, %rdi
movl %ecx, %esi
callq 0x3250
incq %r15
jmp 0x81a7
andl $0x0, 0x4(%rsp)
movq %r12, %rdi
movq %r13, %rsi
leaq 0x152f(%rip), %rdx      # 0x972d
xorl %eax, %eax
callq 0x34a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3560
jmp 0x81e7
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8226
movq %rax, %r14
movq %rbx, %rdi
callq 0x35d8
movq %r14, %rdi
callq 0x3510
nop
// File: /workspace/github_cpp_makefile_star2_O2/tylerkaraszewski[P]Argyle/Utils.cpp
// Function: Utils::getHttpDate[abi:cxx11](long)
string Utils::getHttpDate(time_t secondsSinceEpoch)
{
  char buffer[30] = {0};
  struct tm* date = gmtime(&secondsSinceEpoch);
  strftime(buffer, 30,  "%a, %d %b %Y %T %Z", date);
  return buffer;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
movq %rsi, (%rdi)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r14
movups %xmm0, 0xe(%r14)
movaps %xmm0, (%r14)
callq 0x3260
leaq 0x1493(%rip), %rdx      # 0x9736
pushq $0x1e
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
callq 0x3220
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x438c
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
retq