// File: romkatv[P]hcproxy/src/parser.cc
// Function: hcproxy::(anonymous namespace)::ParseEventHandler::Read()
std::optional<std::string_view> Read() {
    CHECK(size_ < content_.size());
    while (true) {
      int ret = read(fd(), content_.data() + size_, content_.size() - size_);
      if (ret < 0) {
        if (errno == EAGAIN || errno == EWOULDBLOCK) return std::nullopt;
        LOG(WARN) << "[" << fd() << "] error reading request: " << Errno();
        return "";
      }
      // Verify that the request starts with kConnectPrefix.
      if (size_ < kConnectPrefix.size()) {
        size_t n = std::min<size_t>(ret, kConnectPrefix.size() - size_);
        if (memcmp(content_.data() + size_, kConnectPrefix.data() + size_, n) != 0) {
          LOG(WARN) << "[" << fd() << "] invalid request prefix";
          return "";
        }
      }
      size_ += ret;
      std::string_view req(content_.data(), size_);
      if (EndsWith(req, "\r\n\r\n")) {
        size_t start = kConnectPrefix.size();
        std::string_view host_port = req.substr(start, req.find_first_of(" \r", start) - start);
        if (host_port.empty()) {
          LOG(WARN) << "[" << fd() << "] empty host:port in the request";
        } else {
          LOG(INFO) << "[" << fd() << "] CONNECT " << host_port;
        }
        return host_port;
      }
      if (ret == 0) {
        LOG(WARN) << "[" << fd() << "] incomplete request";
        return "";
      }
      if (size_ == content_.size()) {
        LOG(WARN) << "[" << fd() << "] request too big";
        return "";
      }
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
movq %rdi, -0x1b8(%rbp)
movq %rdi, -0x1b0(%rbp)
movq %rsi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
movq 0x70(%rdi), %rax
movq %rax, -0x1a0(%rbp)
addq $0x58, %rdi
callq 0x1bfc0
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
movb $0x0, -0x29(%rbp)
cmpq %rcx, %rax
jae 0x1a111
jmp 0x1a18a
leaq 0xca045(%rip), %rsi     # 0xe415d
leaq -0x28(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
movl $0x4c, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x1c8(%rbp), %rdi
movb $0x1, -0x29(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xca0b5(%rip), %rsi     # 0xe4201
callq 0x1bfe0
movq %rax, -0x1c0(%rbp)
jmp 0x1a15a
movq -0x1c0(%rbp), %rdi
leaq 0xcf223(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x1d0(%rbp)
jmp 0x1a176
movq -0x1d0(%rbp), %rsi
leaq -0x3d(%rbp), %rdi
callq 0x194f0
jmp 0x1a188
jmp 0x1a18a
testb $0x1, -0x29(%rbp)
jne 0x1a192
jmp 0x1a1b6
leaq -0x28(%rbp), %rdi
callq 0x19500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x1a247
jmp 0x1a250
jmp 0x1a1b8
movq -0x1a8(%rbp), %rdi
callq 0x1bb70
movq -0x1a8(%rbp), %rdi
movl %eax, -0x1dc(%rbp)
addq $0x58, %rdi
callq 0x1c010
movq -0x1a8(%rbp), %rdi
addq 0x70(%rdi), %rax
movq %rax, -0x1d8(%rbp)
addq $0x58, %rdi
callq 0x1bfc0
movl -0x1dc(%rbp), %edi
movq -0x1d8(%rbp), %rsi
movq %rax, %rdx
movq -0x1a8(%rbp), %rax
subq 0x70(%rax), %rdx
callq 0x15250
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jge 0x1a347
callq 0x15640
cmpl $0xb, (%rax)
je 0x1a236
callq 0x15640
cmpl $0xb, (%rax)
jne 0x1a255
movq -0x1b8(%rbp), %rdi
callq 0x1c030
jmp 0x1a9dd
leaq -0x28(%rbp), %rdi
callq 0x19500
jmp 0x1a9ed
leaq 0xc9f01(%rip), %rsi     # 0xe415d
leaq -0x68(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
movl $0x51, %edx
movl $0x1, %ecx
callq 0x1bb40
movq -0x1f0(%rbp), %rdi
callq 0x194e0
movq %rax, %rdi
leaq 0xc9f54(%rip), %rsi     # 0xe41e0
callq 0x1bb10
movq %rax, -0x1e8(%rbp)
jmp 0x1a29a
movq -0x1a8(%rbp), %rdi
callq 0x1bb70
movq -0x1e8(%rbp), %rdi
movl %eax, -0x6c(%rbp)
leaq -0x6c(%rbp), %rsi
callq 0x1bad0
movq %rax, -0x1f8(%rbp)
jmp 0x1a2c2
movq -0x1f8(%rbp), %rdi
leaq 0xc9f49(%rip), %rsi     # 0xe4219
callq 0x1c090
movq %rax, -0x200(%rbp)
jmp 0x1a2de
callq 0x1c0c0
jmp 0x1a2e5
movq -0x200(%rbp), %rdi
callq 0x1c050
movq %rax, -0x208(%rbp)
jmp 0x1a2fa
movq -0x208(%rbp), %rsi
leaq -0x6f(%rbp), %rdi
callq 0x194f0
jmp 0x1a30c
leaq -0x68(%rbp), %rdi
callq 0x1bbb0
movq -0x1b8(%rbp), %rdi
leaq 0xca98d(%rip), %rsi     # 0xe4cb0
callq 0x1c0d0
jmp 0x1a9dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x1bbb0
jmp 0x1a9ed
movq -0x1a8(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x210(%rbp)
leaq 0x10f188(%rip), %rdi    # 0x1294e8
callq 0x1c100
movq %rax, %rcx
movq -0x210(%rbp), %rax
cmpq %rcx, %rax
jae 0x1a4f4
movslq -0x44(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq 0x10f161(%rip), %rdi    # 0x1294e8
callq 0x1c100
movq -0x1a8(%rbp), %rcx
subq 0x70(%rcx), %rax
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x1b4d0
movq -0x1a8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x78(%rbp)
addq $0x58, %rdi
callq 0x1c010
movq -0x1a8(%rbp), %rcx
addq 0x70(%rcx), %rax
movq %rax, -0x218(%rbp)
leaq 0x10f10a(%rip), %rdi    # 0x1294e8
callq 0x1c120
movq -0x218(%rbp), %rdi
movq %rax, %rsi
movq -0x1a8(%rbp), %rax
addq 0x70(%rax), %rsi
movq -0x78(%rbp), %rdx
callq 0x15730
cmpl $0x0, %eax
je 0x1a4f2
leaq 0xc9d4c(%rip), %rsi     # 0xe415d
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x228(%rbp)
movl $0x58, %edx
movl $0x1, %ecx
callq 0x1bb40
movq -0x228(%rbp), %rdi
callq 0x194e0
movq %rax, %rdi
leaq 0xc9d9c(%rip), %rsi     # 0xe41e0
callq 0x1bb10
movq %rax, -0x220(%rbp)
jmp 0x1a452
movq -0x1a8(%rbp), %rdi
callq 0x1bb70
movq -0x220(%rbp), %rdi
movl %eax, -0xac(%rbp)
leaq -0xac(%rbp), %rsi
callq 0x1bad0
movq %rax, -0x230(%rbp)
jmp 0x1a480
movq -0x230(%rbp), %rdi
leaq 0xc9da5(%rip), %rsi     # 0xe4233
callq 0x1c140
movq %rax, -0x238(%rbp)
jmp 0x1a49c
movq -0x238(%rbp), %rsi
leaq -0xad(%rbp), %rdi
callq 0x194f0
jmp 0x1a4b1
leaq -0xa8(%rbp), %rdi
callq 0x1bbb0
movq -0x1b8(%rbp), %rdi
leaq 0xca7e5(%rip), %rsi     # 0xe4cb0
callq 0x1c0d0
jmp 0x1a9dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x1bbb0
jmp 0x1a9ed
jmp 0x1a4f4
movq -0x1a8(%rbp), %rdi
movslq -0x44(%rbp), %rax
addq 0x70(%rdi), %rax
movq %rax, 0x70(%rdi)
addq $0x58, %rdi
callq 0x1c010
movq %rax, %rsi
movq -0x1a8(%rbp), %rax
movq 0x70(%rax), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x1c170
movq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq 0xcade0(%rip), %rsi     # 0xe5334
callq 0x1bbf0
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq -0xd8(%rbp), %rcx
callq 0x1aa00
testb $0x1, %al
jne 0x1a583
jmp 0x1a7d6
leaq 0x10ef5e(%rip), %rdi    # 0x1294e8
callq 0x1c100
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0xe8(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
leaq 0xc9c93(%rip), %rsi     # 0xe424c
callq 0x1c230
movq -0x240(%rbp), %rsi
movq %rax, %rdx
subq -0xe8(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x1c1a0
movq %rax, -0xf8(%rbp)
movq %rdx, -0xf0(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x1c290
testb $0x1, %al
jne 0x1a5fe
jmp 0x1a6d3
leaq 0xc9b58(%rip), %rsi     # 0xe415d
leaq -0x118(%rbp), %rdi
movq %rdi, -0x250(%rbp)
movl $0x62, %edx
movl $0x1, %ecx
callq 0x1bb40
movq -0x250(%rbp), %rdi
callq 0x194e0
movq %rax, %rdi
leaq 0xc9ba8(%rip), %rsi     # 0xe41e0
callq 0x1bb10
movq %rax, -0x248(%rbp)
jmp 0x1a646
movq -0x1a8(%rbp), %rdi
callq 0x1bb70
movq -0x248(%rbp), %rdi
movl %eax, -0x11c(%rbp)
leaq -0x11c(%rbp), %rsi
callq 0x1bad0
movq %rax, -0x258(%rbp)
jmp 0x1a674
movq -0x258(%rbp), %rdi
leaq 0xc9bcd(%rip), %rsi     # 0xe424f
callq 0x1c2b0
movq %rax, -0x260(%rbp)
jmp 0x1a690
movq -0x260(%rbp), %rsi
leaq -0x11d(%rbp), %rdi
callq 0x194f0
jmp 0x1a6a5
leaq -0x118(%rbp), %rdi
callq 0x1bbb0
jmp 0x1a7be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x1bbb0
jmp 0x1a9ed
leaq 0xc9a83(%rip), %rsi     # 0xe415d
leaq -0x140(%rbp), %rdi
movq %rdi, -0x270(%rbp)
movl $0x64, %edx
xorl %ecx, %ecx
callq 0x1c360
movq -0x270(%rbp), %rdi
callq 0x194e0
movq %rax, %rdi
leaq 0xc9ad6(%rip), %rsi     # 0xe41e0
callq 0x1bb10
movq %rax, -0x268(%rbp)
jmp 0x1a718
movq -0x1a8(%rbp), %rdi
callq 0x1bb70
movq -0x268(%rbp), %rdi
movl %eax, -0x144(%rbp)
leaq -0x144(%rbp), %rsi
callq 0x1bad0
movq %rax, -0x278(%rbp)
jmp 0x1a746
movq -0x278(%rbp), %rdi
leaq 0xc9b1c(%rip), %rsi     # 0xe4270
callq 0x1c330
movq %rax, -0x280(%rbp)
jmp 0x1a762
movq -0x280(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x1c2e0
movq %rax, -0x288(%rbp)
jmp 0x1a77e
movq -0x288(%rbp), %rsi
leaq -0x145(%rbp), %rdi
callq 0x194f0
jmp 0x1a793
leaq -0x140(%rbp), %rdi
callq 0x1c390
jmp 0x1a7be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x1c390
jmp 0x1a9ed
movq -0x1b8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x1c3d0
jmp 0x1a9dd
cmpl $0x0, -0x44(%rbp)
jne 0x1a8c8
leaq 0xc9976(%rip), %rsi     # 0xe415d
leaq -0x168(%rbp), %rdi
movq %rdi, -0x298(%rbp)
movl $0x69, %edx
movl $0x1, %ecx
callq 0x1bb40
movq -0x298(%rbp), %rdi
callq 0x194e0
movq %rax, %rdi
leaq 0xc99c6(%rip), %rsi     # 0xe41e0
callq 0x1bb10
movq %rax, -0x290(%rbp)
jmp 0x1a828
movq -0x1a8(%rbp), %rdi
callq 0x1bb70
movq -0x290(%rbp), %rdi
movl %eax, -0x16c(%rbp)
leaq -0x16c(%rbp), %rsi
callq 0x1bad0
movq %rax, -0x2a0(%rbp)
jmp 0x1a856
movq -0x2a0(%rbp), %rdi
leaq 0xc9a17(%rip), %rsi     # 0xe427b
callq 0x1c400
movq %rax, -0x2a8(%rbp)
jmp 0x1a872
movq -0x2a8(%rbp), %rsi
leaq -0x16d(%rbp), %rdi
callq 0x194f0
jmp 0x1a887
leaq -0x168(%rbp), %rdi
callq 0x1bbb0
movq -0x1b8(%rbp), %rdi
leaq 0xca40f(%rip), %rsi     # 0xe4cb0
callq 0x1c0d0
jmp 0x1a9dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x1bbb0
jmp 0x1a9ed
movq -0x1a8(%rbp), %rdi
movq 0x70(%rdi), %rax
movq %rax, -0x2b0(%rbp)
addq $0x58, %rdi
callq 0x1bfc0
movq %rax, %rcx
movq -0x2b0(%rbp), %rax
cmpq %rcx, %rax
jne 0x1a9d8
leaq 0xc9860(%rip), %rsi     # 0xe415d
leaq -0x190(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
movl $0x6d, %edx
movl $0x1, %ecx
callq 0x1bb40
movq -0x2c0(%rbp), %rdi
callq 0x194e0
movq %rax, %rdi
leaq 0xc98b0(%rip), %rsi     # 0xe41e0
callq 0x1bb10
movq %rax, -0x2b8(%rbp)
jmp 0x1a93e
movq -0x1a8(%rbp), %rdi
callq 0x1bb70
movq -0x2b8(%rbp), %rdi
movl %eax, -0x194(%rbp)
leaq -0x194(%rbp), %rsi
callq 0x1bad0
movq %rax, -0x2c8(%rbp)
jmp 0x1a96c
movq -0x2c8(%rbp), %rdi
leaq 0xc9916(%rip), %rsi     # 0xe4290
callq 0x1c430
movq %rax, -0x2d0(%rbp)
jmp 0x1a988
movq -0x2d0(%rbp), %rsi
leaq -0x195(%rbp), %rdi
callq 0x194f0
jmp 0x1a99d
leaq -0x190(%rbp), %rdi
callq 0x1bbb0
movq -0x1b8(%rbp), %rdi
leaq 0xca2f9(%rip), %rsi     # 0xe4cb0
callq 0x1c0d0
jmp 0x1a9dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x1bbb0
jmp 0x1a9ed
jmp 0x1a1b8
movq -0x1b0(%rbp), %rax
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0xe1080
nopw %cs:(%rax,%rax)