// File: /workspace/github_cpp_makefile_star2_O1/romkatv[P]hcproxy/src/acceptor.cc
// Function: hcproxy::Acceptor::Accept()
int Acceptor::Accept() {
  while (true) {
    struct sockaddr addr = {};
    socklen_t addrlen = sizeof(addr);
    int conn = accept4(fd_, &addr, &addrlen, SOCK_NONBLOCK);
    if (conn >= 0) {
      CHECK(addrlen == sizeof(addr));
      CHECK(addr.sa_family == AF_INET);
      LOG(INFO) << "[" << conn << "] accepted connection from " << IpPort(addr);
      SetSockOpt(conn, IPPROTO_TCP, TCP_NODELAY);
      return conn;
    }
    LOG(ERROR) << "accept4() failed: " << Errno();
    CHECK(errno == EMFILE || errno == ENFILE || errno == ENOBUFS || errno == ENOMEM) << Errno();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r13
leaq 0x40(%rsp), %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movl $0x10, 0xc(%rsp)
movl (%rbx), %edi
movq %r14, %rsi
leaq 0xc(%rsp), %rdx
movl $0x800, %ecx            # imm = 0x800
callq 0x15650
movl %eax, %r15d
testl %eax, %eax
js 0x19c72
cmpl $0x10, 0xc(%rsp)
jne 0x19cf1
cmpw $0x2, 0x30(%rsp)
jne 0x19d3f
movq %r13, %rdi
leaq 0xb574a(%rip), %rsi     # 0xcf340
movl $0x4a, %edx
xorl %ecx, %ecx
callq 0x2019c
movq 0x28(%rsp), %rdi
movl $0x1, %edx
leaq 0xb552f(%rip), %rsi     # 0xcf142
callq 0x8bab0
movq 0x28(%rsp), %rdi
movl %r15d, %esi
callq 0x8c380
movq 0x28(%rsp), %rdi
movl $0x1b, %edx
leaq 0xb57f7(%rip), %rsi     # 0xcf42d
callq 0x8bab0
movq %rbp, %rdi
movq %r14, %rsi
callq 0x1beac
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x1bfa9
movq %r13, %rdi
callq 0x19688
movl %r15d, %edi
movl $0x6, %esi
movl $0x1, %edx
callq 0x19a81
movl %r15d, %r12d
jmp 0x19cd6
movq %r13, %rdi
leaq 0xb56c4(%rip), %rsi     # 0xcf340
movl $0x4e, %edx
movl $0x2, %ecx
callq 0x2019c
movq 0x28(%rsp), %rdi
movl $0x12, %edx
leaq 0xb57ad(%rip), %rsi     # 0xcf449
callq 0x8bab0
movl 0x10(%rsp), %esi
movq 0x28(%rsp), %rdi
callq 0x2023b
movq %r13, %rdi
callq 0x19e28
callq 0x15640
movl (%rax), %eax
cmpl $0x18, %eax
ja 0x19ccd
movl $0x1801000, %ecx        # imm = 0x1801000
btl %eax, %ecx
jb 0x19cd6
cmpl $0x69, %eax
jne 0x19d8a
testl %r15d, %r15d
js 0x19ba6
movl %r12d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb5648(%rip), %rsi     # 0xcf340
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movl $0x48, %edx
movl $0x3, %ecx
callq 0x2019c
movq 0x18(%rbx), %rdi
leaq 0xb56e1(%rip), %rsi     # 0xcf3fb
movl $0x17, %edx
callq 0x8bab0
movq 0x28(%rsp), %rdi
leaq 0xba5db(%rip), %rsi     # 0xd430b
movl $0x2, %edx
callq 0x8bab0
jmp 0x19de3
leaq 0xb55fa(%rip), %rsi     # 0xcf340
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movl $0x49, %edx
movl $0x3, %ecx
callq 0x2019c
movq 0x18(%rbx), %rdi
leaq 0xb56ab(%rip), %rsi     # 0xcf413
movl $0x19, %edx
callq 0x8bab0
movq 0x28(%rsp), %rdi
leaq 0xba58d(%rip), %rsi     # 0xd430b
movl $0x2, %edx
callq 0x8bab0
jmp 0x19de3
leaq 0xb55af(%rip), %rsi     # 0xcf340
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movl $0x4f, %edx
movl $0x3, %ecx
callq 0x2019c
movq 0x18(%rbx), %rdi
leaq 0xb56a9(%rip), %rsi     # 0xcf45c
movl $0x49, %edx
callq 0x8bab0
movq 0x28(%rsp), %rdi
leaq 0xba542(%rip), %rsi     # 0xd430b
movl $0x2, %edx
callq 0x8bab0
leaq 0x10(%rsp), %rdi
callq 0x19e13
jmp 0x19de3
jmp 0x19de3
jmp 0x19de3
leaq 0x10(%rsp), %rdi
callq 0x18aaa
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x19e28
jmp 0x19e0b
jmp 0x19dfe
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x19688
movq %rbx, %rdi
callq 0xcc900