// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
leaq 0x10(%rsp), %rbp
pushq $0x4e
popq %r15
pushq $0x2
popq %r13
leaq 0xb5a87(%rip), %r12     # 0xcf434
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movl $0x10, 0xc(%rsp)
movl (%r14), %edi
leaq 0x30(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movl $0x800, %ecx            # imm = 0x800
callq 0x15650
testl %eax, %eax
jns 0x19a73
movq %rbp, %rdi
leaq 0xb5945(%rip), %rsi     # 0xcf32b
movl %r15d, %edx
movl %r13d, %ecx
callq 0x1f4c8
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x8b1d0
movq %rbp, %rdi
callq 0x19465
movq %rbp, %rdi
callq 0x19bc6
callq 0x15640
movl (%rax), %eax
cmpl $0x18, %eax
ja 0x19a24
movl $0x1801000, %ecx        # imm = 0x1801000
btl %eax, %ecx
jb 0x199ad
cmpl $0x69, %eax
je 0x199ad
leaq 0xb58fb(%rip), %rsi     # 0xcf32b
leaq 0x10(%rsp), %rbx
pushq $0x4f
popq %rdx
pushq $0x3
popq %rcx
movq %rbx, %rdi
callq 0x1f4c8
movq 0x18(%rbx), %rdi
leaq 0xb59f9(%rip), %rsi     # 0xcf447
callq 0x8b1d0
movq 0x28(%rsp), %rdi
leaq 0xba86c(%rip), %rsi     # 0xd42cb
callq 0x8b1d0
leaq 0x10(%rsp), %rdi
callq 0x19465
jmp 0x19ba7
cmpl $0x10, 0xc(%rsp)
jne 0x19b18
cmpw $0x2, 0x30(%rsp)
jne 0x19b55
movl %eax, %ebx
leaq 0xb5898(%rip), %rsi     # 0xcf32b
leaq 0x10(%rsp), %r14
pushq $0x4a
popq %rdx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x1f4c8
movq 0x18(%r14), %rdi
leaq 0xb5693(%rip), %rsi     # 0xcf143
callq 0x8b1d0
movq 0x28(%rsp), %rdi
movl %ebx, %esi
callq 0x8b570
movq 0x28(%rsp), %rdi
leaq 0xb594b(%rip), %rsi     # 0xcf418
callq 0x8b1d0
leaq 0x40(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1b93c
movq 0x28(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x1ba1d
leaq 0x10(%rsp), %rdi
callq 0x19502
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
movl %ebx, %edi
callq 0x198aa
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb580c(%rip), %rsi     # 0xcf32b
leaq 0x10(%rsp), %rbx
pushq $0x48
popq %rdx
pushq $0x3
popq %rcx
movq %rbx, %rdi
callq 0x1f4c8
movq 0x18(%rbx), %rdi
leaq 0xb58a9(%rip), %rsi     # 0xcf3e6
callq 0x8b1d0
movq 0x28(%rsp), %rdi
leaq 0xba77d(%rip), %rsi     # 0xd42cb
callq 0x8b1d0
jmp 0x19ba7
leaq 0xb57cf(%rip), %rsi     # 0xcf32b
leaq 0x10(%rsp), %rbx
pushq $0x49
popq %rdx
pushq $0x3
popq %rcx
movq %rbx, %rdi
callq 0x1f4c8
movq 0x18(%rbx), %rdi
leaq 0xb5884(%rip), %rsi     # 0xcf3fe
callq 0x8b1d0
movq 0x28(%rsp), %rdi
leaq 0xba740(%rip), %rsi     # 0xd42cb
callq 0x8b1d0
jmp 0x19ba7
jmp 0x19ba7
jmp 0x19ba7
jmp 0x19b98
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x19502
jmp 0x19bbe
leaq 0x10(%rsp), %rdi
callq 0x189a6
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x19bc6
movq %rbx, %rdi
callq 0xcc660