// File: 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:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movl %esi, 0x11c(%rsp)
movq %rdx, 0x110(%rsp)
movq %rcx, 0x108(%rsp)
movq 0x120(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xf720
movq 0x10(%rsp), %rdi
leaq 0x95ec(%rip), %rax      # 0x18d70
movq %rax, (%rdi)
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
callq 0x4570
movq 0x10(%rsp), %rax
movb $0x1, 0x10(%rax)
movb $0x0, 0x11(%rax)
movl 0x11c(%rsp), %ecx
movl %ecx, 0x14(%rax)
movq $0x0, 0x18(%rax)
movslq 0x11c(%rsp), %rsi
leaq 0xe8(%rsp), %rdi
callq 0x10f70
jmp 0xf7cb
movl 0x11c(%rsp), %esi
leaq 0xb8(%rsp), %rdi
callq 0xfab0
jmp 0xf7e1
leaq 0x98(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x41b0
jmp 0xf7f8
movq 0x110(%rsp), %rdi
callq 0x4670
testb $0x1, %al
jne 0xf8d2
movq 0x110(%rsp), %rdx
leaq 0x39fb(%rip), %rsi      # 0x13217
leaq 0x78(%rsp), %rdi
callq 0xdcf0
jmp 0xf828
leaq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x44f0
jmp 0xf83c
leaq 0x78(%rsp), %rdi
callq 0x4788
jmp 0xf8d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0xfa86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0xfa79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0xfa6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0xfa5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x4788
jmp 0xfa5f
leaq 0x393e(%rip), %rsi      # 0x13217
leaq 0x98(%rsp), %rdi
callq 0x4390
jmp 0xf8e8
leaq 0x98(%rsp), %rdi
callq 0x42a0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rsi
leaq 0x18(%rsp), %rdi
callq 0x10f70
jmp 0xf911
leaq 0x3a9f(%rip), %rsi      # 0x133b7
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x6230
jmp 0xf929
leaq 0x38e6(%rip), %rdx      # 0x13216
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x61e0
jmp 0xf941
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x58(%rsp), %rsi
callq 0x44f0
jmp 0xf956
leaq 0x58(%rsp), %rdi
callq 0x4788
leaq 0x38(%rsp), %rdi
callq 0x4788
leaq 0x18(%rsp), %rdi
callq 0x4788
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x3f82(%rip), %rsi      # 0x13906
callq 0x4390
jmp 0xf98b
movq 0x10(%rsp), %rdi
movq 0x108(%rsp), %rsi
addq $0x20, %rdi
callq 0x44f0
jmp 0xf9a3
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x3863(%rip), %rsi      # 0x13216
callq 0x4390
jmp 0xf9ba
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x98(%rsp), %rsi
callq 0x44f0
jmp 0xf9d2
leaq 0x98(%rsp), %rdi
callq 0x4788
leaq 0xb8(%rsp), %rdi
callq 0x4788
leaq 0xe8(%rsp), %rdi
callq 0x4788
addq $0x128, %rsp            # imm = 0x128
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0xfa55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0xfa4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x4788
leaq 0x38(%rsp), %rdi
callq 0x4788
leaq 0x18(%rsp), %rdi
callq 0x4788
leaq 0x98(%rsp), %rdi
callq 0x4788
leaq 0xb8(%rsp), %rdi
callq 0x4788
leaq 0xe8(%rsp), %rdi
callq 0x4788
movq 0x8(%rsp), %rdi
callq 0x4788
movq 0x10(%rsp), %rdi
callq 0xdec0
movq 0xe0(%rsp), %rdi
callq 0x46b0
nopw (%rax,%rax)