// File: /workspace/github_cpp_makefile_star2_O2/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), %r15
leaq -0x2c(%rbp), %r14
movl $0x10, -0x2c(%rbp)
movl (%rbx), %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa0d0
testl %eax, %eax
js 0x10084
movl %eax, %r13d
cmpl $0x4000, %eax           # imm = 0x4000
jae 0x10169
movl %r13d, %edi
callq 0xfc90
movl -0x38(%rbp), %esi
movq %rbx, %rdi
callq 0xff90
testb %al, %al
jne 0x100b2
movl %r13d, %edi
callq 0xa4c0
testb $0x8, 0x20(%rbx)
je 0x10014
callq 0x16a89
movq 0xff65(%rip), %rdi      # 0x1ffd0
movq %rax, %rsi
callq 0xa2e0
movq %rax, %rdi
leaq 0x927a(%rip), %rsi      # 0x192f7
callq 0xa2e0
jmp 0x10014
testb $0x1, 0x20(%rbx)
je 0x10014
callq 0x16a89
movq 0xff3a(%rip), %rdi      # 0x1ffd0
movq %rax, %rsi
callq 0xa2e0
movq %rax, %rdi
leaq 0x91ff(%rip), %rsi      # 0x192a7
callq 0xa2e0
jmp 0x10014
movl %r13d, %r14d
cmpq $0x0, 0x50(%rbx,%r14,8)
jne 0x101d8
movl $0x1e8, %edi            # imm = 0x1E8
callq 0xfb38
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x1302c
movq %r12, 0x50(%rbx,%r14,8)
incl 0x8(%r12)
cmpl 0x8(%rbx), %r13d
jle 0x100f0
movl %r13d, 0x8(%rbx)
testb $0x10, 0x20(%rbx)
je 0x10146
callq 0x16a89
movq 0xfece(%rip), %rdi      # 0x1ffd0
movq %rax, %rsi
callq 0xa2e0
movq %rax, %rdi
leaq 0x7f96(%rip), %rsi      # 0x180aa
callq 0xa2e0
movq %rax, %rdi
movl %r13d, %esi
callq 0xa460
movq %rax, %rdi
leaq 0x857e(%rip), %rsi      # 0x186ac
callq 0xa2e0
movq %rax, %rdi
movq %r12, %rsi
callq 0xa230
movq %rax, %rdi
callq 0xa160
movq 0x20050(%rbx), %rax
movslq 0x4(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
movq %r12, %rsi
callq 0x10240
incq 0x20080(%rbx)
jmp 0x10010
movq 0xfe60(%rip), %rdi      # 0x1ffd0
leaq 0x9147(%rip), %rsi      # 0x192be
callq 0xa2e0
movq %rax, %rdi
movl %r13d, %esi
callq 0xa460
leaq 0x913c(%rip), %rsi      # 0x192ca
movq %rax, %rdi
callq 0xa2e0
movq %rax, %rdi
movl $0x4000, %esi           # imm = 0x4000
callq 0xa460
movq %rax, %rdi
callq 0xa160
pushq $0x30
popq %rdi
callq 0xa170
movq %rax, %r14
leaq 0x9113(%rip), %rsi      # 0x192d0
leaq 0x9032(%rip), %rdx      # 0x191f6
leaq 0x9115(%rip), %r8       # 0x192e0
pushq $0x51
popq %rcx
movq %rax, %rdi
callq 0xe15c
jmp 0x10203
pushq $0x30
popq %rdi
callq 0xa170
movq %rax, %r14
leaq 0x911e(%rip), %rsi      # 0x19308
leaq 0x9005(%rip), %rdx      # 0x191f6
leaq 0x90e8(%rip), %r8       # 0x192e0
pushq $0x5b
popq %rcx
movq %rax, %rdi
callq 0xe15c
leaq 0xfb0e(%rip), %rsi      # 0x1fd18
leaq -0x1cfb(%rip), %rdx     # 0xe516
movq %r14, %rdi
callq 0xa450
jmp 0x1022d
movq %rax, %rbx
movl $0x1e8, %esi            # imm = 0x1E8
movq %r12, %rdi
callq 0xa300
jmp 0x10238
movq %rax, %rbx
movq %r14, %rdi
callq 0xa200
movq %rbx, %rdi
callq 0xa470