// File: Rjerk[P]ratabase/Server.cpp
// Function: ratabase::Server::run()
void Server::run()
{
    for (int i = 1; ; ++i) {
        connsock_ = ::accept(servsock_, nullptr, nullptr);
        if (connsock_ < 0) {
            LOG_FATAL << "Server::run: accept error";
        }

        LOG_INFO << "Connect to client " << i << "";

        int ret;
        if ((ret = fork()) < 0) {
            continue;
        } else if (ret == 0) {
            while (this->processRequest())
                ;
            LOG_INFO << "Close connection to client " << i;
            sockets::close(connsock_);
        }
    }

}

// Assembly:
subq $0x518, %rsp            # imm = 0x518
movq %rdi, 0x510(%rsp)
movq 0x510(%rsp), %rax
movq %rax, 0x50(%rsp)
movl $0x1, 0x50c(%rsp)
movq 0x50(%rsp), %rax
movl 0x4(%rax), %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x3120
movl %eax, %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x0, 0x8(%rax)
jge 0x8577
leaq 0xbb87(%rip), %rsi      # 0x1407d
leaq 0xbbfa(%rip), %rcx      # 0x140f7
leaq 0x380(%rsp), %rdi
movq %rdi, 0x40(%rsp)
movl $0x44, %edx
movl $0x5, %r8d
callq 0x11e00
movq 0x40(%rsp), %rdi
callq 0x121a0
movq %rax, 0x48(%rsp)
jmp 0x852b
movq 0x48(%rsp), %rdi
addq $0x10, %rdi
leaq 0xbbc0(%rip), %rsi      # 0x140fb
callq 0x3390
jmp 0x8542
leaq 0x380(%rsp), %rdi
callq 0x12060
jmp 0x8577
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0x380(%rsp), %rdi
callq 0x12060
jmp 0x873e
callq 0x12170
cmpl $0x2, %eax
jg 0x863d
leaq 0xbaf1(%rip), %rsi      # 0x1407d
leaq 0xbb64(%rip), %rcx      # 0x140f7
leaq 0x1e8(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movl $0x47, %edx
movl $0x2, %r8d
callq 0x11e00
movq 0x30(%rsp), %rdi
callq 0x121a0
movq %rax, 0x38(%rsp)
jmp 0x85c1
movq 0x38(%rsp), %rdi
addq $0x10, %rdi
leaq 0xbb44(%rip), %rsi      # 0x14115
callq 0x3390
movq %rax, 0x28(%rsp)
jmp 0x85dd
movq 0x28(%rsp), %rdi
movl 0x50c(%rsp), %esi
callq 0x3570
movq %rax, 0x20(%rsp)
jmp 0x85f5
movq 0x20(%rsp), %rdi
leaq 0xbd37(%rip), %rsi      # 0x14338
callq 0x3390
jmp 0x8608
leaq 0x1e8(%rsp), %rdi
callq 0x12060
jmp 0x863d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0x1e8(%rsp), %rdi
callq 0x12060
jmp 0x873e
callq 0x3100
movl %eax, 0x1e4(%rsp)
cmpl $0x0, %eax
jge 0x8653
jmp 0x8728
cmpl $0x0, 0x1e4(%rsp)
jne 0x8724
jmp 0x8663
movq 0x50(%rsp), %rdi
callq 0x8750
testb $0x1, %al
jne 0x8673
jmp 0x8675
jmp 0x8663
callq 0x12170
cmpl $0x2, %eax
jg 0x8717
leaq 0xb9f3(%rip), %rsi      # 0x1407d
leaq 0xba66(%rip), %rcx      # 0x140f7
leaq 0x58(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movl $0x4f, %edx
movl $0x2, %r8d
callq 0x11e00
movq 0x10(%rsp), %rdi
callq 0x121a0
movq %rax, 0x18(%rsp)
jmp 0x86bc
movq 0x18(%rsp), %rdi
addq $0x10, %rdi
leaq 0xba5c(%rip), %rsi      # 0x14128
callq 0x3390
movq %rax, 0x8(%rsp)
jmp 0x86d8
movq 0x8(%rsp), %rdi
movl 0x50c(%rsp), %esi
callq 0x3570
jmp 0x86eb
leaq 0x58(%rsp), %rdi
callq 0x12060
jmp 0x8717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x12060
jmp 0x873e
movq 0x50(%rsp), %rax
movl 0x8(%rax), %edi
callq 0x12f30
jmp 0x8726
jmp 0x8728
movl 0x50c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x50c(%rsp)
jmp 0x84c7
movq 0x378(%rsp), %rdi
callq 0x3590
nopl (%rax,%rax)