// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Server::_accept()
void Server::_accept() {
    while (true) {
        struct sockaddr_in peer_addr;
        socklen_t peer_addr_len = sizeof(peer_addr);
        int fd = accept(_fd, (struct sockaddr *)&peer_addr, &peer_addr_len);
        if(fd < 0) {
            if(log & 1) std::cout << ltime() << "warning: accept error\n";
            continue;
        }
        if(fd >= MAX_CONNECTS) {
            std::cout << "socket fd (" << fd << ") >= " << MAX_CONNECTS << std::endl;
            THROW("socket fd error");
        }
        unblock_socket(fd);

        if(!_valid_ip(peer_addr.sin_addr.s_addr)) {
            close(fd);
            if(log & 8) std::cout << ltime() << "Client filtered\n";
            continue;
        };

        if(connections[fd]) THROW("Connection place is not empty");
        Connect* conn = new Connect(this, fd);
        connections[fd] = conn;
        conn->link();

        if(fd > max_fd) max_fd = fd;
        if(log & 16) std::cout << ltime() << "connect " << fd << " " << (void*)conn << std::endl;

        loops[active_loop]->accept(conn);
        stat_connect++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq -0x3c(%rbp), %r13
leaq -0x2c(%rbp), %r15
movq 0xeca1(%rip), %r12      # 0x1dfd0
movl $0x10, -0x2c(%rbp)
movl (%rbx), %edi
movq %r13, %rsi
movq %r15, %rdx
callq 0x80e0
testl %eax, %eax
js 0xf3a3
movl %eax, %r14d
cmpl $0x4000, %eax           # imm = 0x4000
jae 0xf553
movl %r14d, %edi
callq 0xeee0
movl -0x38(%rbp), %esi
movq %rbx, %rdi
callq 0xf2b6
testb %al, %al
jne 0xf432
movl %r14d, %edi
callq 0x8500
testb $0x8, 0x20(%rbx)
je 0xf32f
callq 0x163f5
testq %rax, %rax
je 0xf400
movq %rax, %r14
movq %rax, %rdi
callq 0x8130
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0xf419
testb $0x1, 0x20(%rbx)
je 0xf32f
callq 0x163f5
testq %rax, %rax
je 0xf3ce
movq %rax, %r14
movq %rax, %rdi
callq 0x8130
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0xf3e7
movq (%r12), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0x16, %edx
movq %r12, %rdi
leaq 0x8ead(%rip), %rsi      # 0x182a3
callq 0x8350
jmp 0xf32f
movq (%r12), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0x10, %edx
movq %r12, %rdi
leaq 0x8ecb(%rip), %rsi      # 0x182f3
callq 0x8350
jmp 0xf32f
movl %r14d, %r15d
cmpq $0x0, 0x50(%rbx,%r15,8)
jne 0xf5f8
movl $0x1e8, %edi            # imm = 0x1E8
callq 0xed4c
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0x12efe
movq %r13, 0x50(%rbx,%r15,8)
incl 0x8(%r13)
cmpl 0x8(%rbx), %r14d
jle 0xf46f
movl %r14d, 0x8(%rbx)
testb $0x10, 0x20(%rbx)
je 0xf530
callq 0x163f5
testq %rax, %rax
je 0xf4a5
movq %rax, %r15
movq %rax, %rdi
callq 0x8130
movq 0xeb3b(%rip), %r12      # 0x1dfd0
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0xf4c5
movq 0xeb24(%rip), %r12      # 0x1dfd0
movq (%r12), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0x8, %edx
movq %r12, %rdi
leaq 0x7bd6(%rip), %rsi      # 0x170aa
callq 0x8350
movq %r12, %rdi
movl %r14d, %esi
callq 0x8490
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x81b3(%rip), %rsi      # 0x176a9
callq 0x8350
movq %r14, %rdi
movq %r13, %rsi
callq 0x8250
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x81f0
movq 0x20050(%rbx), %rax
movslq 0x4(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
movq %r13, %rsi
callq 0xf664
incq 0x20080(%rbx)
jmp 0xf320
movq 0xea76(%rip), %rbx      # 0x1dfd0
leaq 0x8d59(%rip), %rsi      # 0x182ba
movl $0xb, %edx
movq %rbx, %rdi
callq 0x8350
movq %rbx, %rdi
movl %r14d, %esi
callq 0x8490
movq %rax, %rbx
leaq 0x8d43(%rip), %rsi      # 0x182c6
movl $0x5, %edx
movq %rax, %rdi
callq 0x8350
movq %rbx, %rdi
movl $0x4000, %esi           # imm = 0x4000
callq 0x8490
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x81f0
movl $0x30, %edi
callq 0x8170
movq %rax, %r14
leaq 0x8cf1(%rip), %rsi      # 0x182cc
leaq 0x8c10(%rip), %rdx      # 0x181f2
leaq 0x8cf3(%rip), %r8       # 0x182dc
movq %rax, %rdi
movl $0x51, %ecx
callq 0xcd04
jmp 0xf627
movl $0x30, %edi
callq 0x8170
movq %rax, %r14
leaq 0x8cf8(%rip), %rsi      # 0x18304
leaq 0x8bdf(%rip), %rdx      # 0x181f2
leaq 0x8cc2(%rip), %r8       # 0x182dc
movq %rax, %rdi
movl $0x5b, %ecx
callq 0xcd04
leaq 0xe6ea(%rip), %rsi      # 0x1dd18
leaq -0x2325(%rip), %rdx     # 0xd310
movq %r14, %rdi
callq 0x8480
jmp 0xf651
movq %rax, %rbx
movl $0x1e8, %esi            # imm = 0x1E8
movq %r13, %rdi
callq 0x8320
jmp 0xf65c
movq %rax, %rbx
movq %r14, %rdi
callq 0x8220
movq %rbx, %rdi
callq 0x84a0