// File: /workspace/github_cpp_makefile_star2_O3/QZzcoder[P]LiveChat/server.cpp
// Function: oneLoop()
void oneLoop(){
    while(1){
        char recv_buff[255];
        int sock = bq.take();
        if(sock == -404){
            break;
        }else if(sock == socket_fd){
            cout<<getTime()<<"User sign up：";
            int client_fd = accept(socket_fd,(struct sockaddr*)&client,&len);
            if (client_fd == -1)
            {
                cout << "accept错误\n" << endl;
                exit(-1);
            }
            char signMsg[255];

            ssize_t recv_size = read(client_fd,signMsg,255);
            vector<string> vec = splitString(signMsg,'@');
            ::memset(signMsg,0,255);

            if(vec.size() != 2 ||!userCheck(vec[0],vec[1])){//登录失败
                send(client_fd,"N",1,0);
                cout<<" fail\n";
                close(client_fd);
            }else{
                cout<<vec[0]<<endl;
                cout<<"old msg to "<<vec[0]<<endl;
                vector<string> oldMsg = getOldMsg(vec[0]);
                for(string s:oldMsg){
                    cout<<"    "<<s;
                    send(client_fd,s.c_str(),s.size(),0);
                }
                clientSelectSet.insert(client_fd);
                name2sock[vec[0]] = client_fd;
            }
        }else if(clientSelectSet.count(sock) == 1){
            int activeClient = sock;
            string oriName;
            for(auto it:name2sock){
                if(it.second == activeClient){
                    oriName = it.first;
                    break;
                }
            }
            ssize_t recv_size = read(activeClient,recv_buff,255);
            if(recv_size<=0){//客户端退出
                updateTime(oriName);
                clientSelectSet.erase(name2sock[oriName]);
                name2sock.erase(oriName);
                continue;
            }
            vector<string> msg = splitString(recv_buff,'>');
            if(msg.size() != 0){
                storeMessage(oriName,msg[0],msg[1]);
                msg[1] = oriName + ":" + msg[1];
                send(name2sock[msg[0]],msg[1].c_str(),msg[1].size(),0);
            }
            cout<<getTime();
            ::printf("message:%s",recv_buff);
            ::memset(recv_buff,0,sizeof(recv_buff));
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
leaq 0x655e(%rip), %rdi      # 0xb2a8
callq 0x610a
cmpl $0xfffffe6c, %eax       # imm = 0xFFFFFE6C
jne 0x4d68
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r12d
leaq -0x40(%rbp), %r13
leaq -0x2b0(%rbp), %rbx
movq 0x625b(%rip), %r14      # 0xafd8
cmpl 0x65cc(%rip), %r12d     # 0xb350
jne 0x5087
movq %rbx, %rdi
callq 0x77f1
movq -0x2b0(%rbp), %rsi
movq -0x2a8(%rbp), %rdx
movq %r14, %rdi
callq 0x3360
movl $0xf, %edx
movq %rax, %rdi
leaq 0x33a1(%rip), %rsi      # 0x8158
callq 0x3360
movq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rax
cmpq %rax, %rdi
leaq -0x1a8(%rbp), %r15
leaq -0x88(%rbp), %r12
je 0x4de2
callq 0x32b0
movl 0x6568(%rip), %edi      # 0xb350
leaq 0x6565(%rip), %rsi      # 0xb354
leaq 0x66b2(%rip), %rdx      # 0xb4a8
callq 0x30d0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
je 0x5575
movl $0xff, %edx
movl %eax, %edi
movq %rbx, %rsi
callq 0x33d0
leaq -0x198(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq %rbx, %rdi
callq 0x3110
leaq (%rax,%rbp), %rdx
addq $-0x2b0, %rdx           # imm = 0xFD50
movq %r15, %rdi
movq %rbx, %rsi
callq 0x68a0
movq %r12, %rdi
movq %r15, %rsi
movl $0x40, %edx
callq 0x7a6b
movq -0x1a8(%rbp), %rdi
leaq -0x198(%rbp), %rax
cmpq %rax, %rdi
je 0x4e6a
callq 0x32b0
movl $0xff, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31b0
movq -0x88(%rbp), %rax
movq -0x80(%rbp), %rcx
subq %rax, %rcx
cmpq $0x40, %rcx
jne 0x514f
leaq -0xf8(%rbp), %rcx
movq %rcx, -0x108(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x108(%rbp), %rdi
callq 0x6688
movq -0x88(%rbp), %rax
leaq -0x178(%rbp), %rcx
movq %rcx, -0x188(%rbp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %r15
movq %r15, %rdi
callq 0x6688
leaq -0x108(%rbp), %rdi
movq %r15, %rsi
callq 0x473f
movl %eax, %r15d
movq -0x188(%rbp), %rdi
leaq -0x178(%rbp), %rax
cmpq %rax, %rdi
je 0x4f0e
callq 0x32b0
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x4f26
callq 0x32b0
testb %r15b, %r15b
je 0x514f
movq -0x88(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x3360
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31f0
movl $0xb, %edx
movq %r14, %rdi
leaq 0x3201(%rip), %rsi      # 0x817f
callq 0x3360
movq -0x88(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x3360
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31f0
movq -0x88(%rbp), %rax
leaq -0x158(%rbp), %rcx
movq %rcx, -0x168(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x168(%rbp), %r15
movq %r15, %rdi
callq 0x6688
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
callq 0x37bc
movq -0x168(%rbp), %rdi
leaq -0x158(%rbp), %rax
cmpq %rax, %rdi
je 0x5015
callq 0x32b0
movq -0x68(%rbp), %r15
movq -0x60(%rbp), %r12
cmpq %r12, %r15
je 0x5183
movq %r13, -0x50(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x6688
movl $0x4, %edx
movq %r14, %rdi
leaq 0x313f(%rip), %rsi      # 0x818b
callq 0x3360
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x3360
movl -0x2c(%rbp), %edi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
xorl %ecx, %ecx
callq 0x3160
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x5081
callq 0x32b0
addq $0x20, %r15
jmp 0x501d
movq 0x63ca(%rip), %rax      # 0xb458
testq %rax, %rax
je 0x51c5
leaq 0x63b2(%rip), %rcx      # 0xb450
xorl %edx, %edx
cmpl %r12d, 0x20(%rax)
setl %dl
cmovgeq %rax, %rcx
movq 0x10(%rax,%rdx,8), %rax
testq %rax, %rax
jne 0x509e
leaq 0x6394(%rip), %rax      # 0xb450
cmpq %rax, %rcx
je 0x51c5
cmpl 0x20(%rcx), %r12d
jl 0x51c5
movq %r13, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
movq 0x631a(%rip), %r15      # 0xb400
leaq 0x6303(%rip), %rax      # 0xb3f0
cmpq %rax, %r15
je 0x5208
leaq -0x2a0(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x6688
movl 0x40(%r15), %eax
movl %eax, -0x290(%rbp)
cmpl %r12d, %eax
je 0x51e4
movq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rax
cmpq %rax, %rdi
je 0x5142
callq 0x32b0
movq %r15, %rdi
callq 0x3200
movq %rax, %r15
jmp 0x50e6
movl -0x2c(%rbp), %edi
movl $0x1, %edx
leaq 0x3018(%rip), %rsi      # 0x8176
xorl %ecx, %ecx
callq 0x3160
movl $0x6, %edx
movq %r14, %rdi
leaq 0x3004(%rip), %rsi      # 0x8178
callq 0x3360
movl -0x2c(%rbp), %edi
callq 0x34e0
jmp 0x51bd
leaq 0x62be(%rip), %rdi      # 0xb448
leaq -0x2c(%rbp), %rsi
callq 0x6d32
movl -0x2c(%rbp), %r15d
movq -0x88(%rbp), %rsi
leaq 0x6243(%rip), %rdi      # 0xb3e8
callq 0x6186
movl %r15d, (%rax)
leaq -0x68(%rbp), %rdi
callq 0x60b2
leaq -0x88(%rbp), %r12
movq %r12, %rdi
callq 0x60b2
leaq 0x60dc(%rip), %rdi      # 0xb2a8
callq 0x610a
movl %eax, %r12d
cmpl $0xfffffe6c, %eax       # imm = 0xFFFFFE6C
jne 0x4d7d
jmp 0x4d56
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x31a0
movq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rax
cmpq %rax, %rdi
je 0x5208
callq 0x32b0
movl $0xff, %edx
movl %r12d, %edi
leaq -0x3b0(%rbp), %r12
movq %r12, %rsi
callq 0x33d0
testq %rax, %rax
jle 0x53e8
leaq -0x138(%rbp), %rax
movq %rax, -0x148(%rbp)
movq %r12, %rdi
callq 0x3110
leaq (%rax,%rbp), %rdx
addq $-0x3b0, %rdx           # imm = 0xFC50
leaq -0x148(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x68a0
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
movl $0x3e, %edx
callq 0x7a6b
movq -0x148(%rbp), %rdi
leaq -0x138(%rbp), %rax
cmpq %rax, %rdi
je 0x5284
callq 0x32b0
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
je 0x54ff
leaq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x6688
movq -0x68(%rbp), %rax
leaq -0x98(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x6688
movq -0x68(%rbp), %rax
leaq -0x118(%rbp), %rcx
movq %rcx, -0x128(%rbp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %r15
movq %r15, %rdi
callq 0x6688
leaq -0xc8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
movq %r15, %rdx
callq 0x3dfb
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x5339
callq 0x32b0
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x5351
callq 0x32b0
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x5369
callq 0x32b0
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %r15
movq %r15, %rdi
callq 0x6688
movq %r15, %rdi
leaq 0x2e88(%rip), %rsi      # 0x8220
callq 0x34d0
movq -0x68(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq %r15, %rdi
callq 0x30c0
leaq -0x2a0(%rbp), %r15
movq %r15, -0x2b0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5483
movq %rdx, -0x2b0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x2a0(%rbp)
jmp 0x548a
leaq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x6688
leaq -0xe8(%rbp), %rdi
callq 0x43c8
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x5431
callq 0x32b0
leaq 0x5fb0(%rip), %rdi      # 0xb3e8
leaq -0x50(%rbp), %rsi
callq 0x6186
leaq 0x6000(%rip), %rdi      # 0xb448
movq %rax, %rsi
callq 0x71c6
leaq 0x5ff1(%rip), %rdi      # 0xb448
movq %rax, %rsi
callq 0x7248
leaq 0x5f82(%rip), %rdi      # 0xb3e8
leaq -0x50(%rbp), %rsi
callq 0x7302
leaq 0x5f72(%rip), %rdi      # 0xb3e8
movq %rax, %rsi
callq 0x73be
jmp 0x555e
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x2a8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x68(%rbp), %rdi
addq $0x20, %rdi
movq %rbx, %rsi
callq 0x33a0
movq -0x2b0(%rbp), %rdi
cmpq %r15, %rdi
je 0x54c5
callq 0x32b0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x54da
callq 0x32b0
movq -0x68(%rbp), %rsi
leaq 0x5f03(%rip), %rdi      # 0xb3e8
callq 0x6186
movl (%rax), %edi
movq -0x68(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
xorl %ecx, %ecx
callq 0x3160
movq %rbx, %rdi
callq 0x77f1
movq -0x2b0(%rbp), %rsi
movq -0x2a8(%rbp), %rdx
movq %r14, %rdi
callq 0x3360
movq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rax
cmpq %rax, %rdi
je 0x5535
callq 0x32b0
leaq 0x2c54(%rip), %rdi      # 0x8190
movq %r12, %rsi
xorl %eax, %eax
callq 0x3050
movl $0xff, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x31b0
leaq -0x68(%rbp), %rdi
callq 0x60b2
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x51c5
callq 0x32b0
jmp 0x51c5
movq 0x5a5c(%rip), %rdi      # 0xafd8
leaq 0x2be5(%rip), %rsi      # 0x8168
callq 0x32e0
movq %rax, %rdi
callq 0x3140
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3390
movq %rax, %rbx
movq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rax
jmp 0x565a
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
jmp 0x565a
jmp 0x55c8
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
jmp 0x563b
jmp 0x566f
movq %rax, %rbx
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x55fd
callq 0x32b0
jmp 0x55fd
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x561a
callq 0x32b0
jmp 0x561a
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
jmp 0x563b
movq %rax, %rbx
movq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rax
cmpq %rax, %rdi
je 0x5672
callq 0x32b0
jmp 0x5672
jmp 0x566f
movq %rax, %rbx
movq -0x148(%rbp), %rdi
leaq -0x138(%rbp), %rax
cmpq %rax, %rdi
je 0x56ee
callq 0x32b0
jmp 0x56ee
jmp 0x56eb
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x60b2
jmp 0x56ee
movq %rax, %rbx
movq -0x168(%rbp), %rdi
leaq -0x158(%rbp), %rax
jmp 0x56c5
jmp 0x571b
jmp 0x5716
movq %rax, %rbx
movq -0x188(%rbp), %rdi
leaq -0x178(%rbp), %rax
cmpq %rax, %rdi
je 0x56b7
callq 0x32b0
jmp 0x56b7
movq %rax, %rbx
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x573a
callq 0x32b0
jmp 0x573a
jmp 0x56eb
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
leaq -0x198(%rbp), %rax
jmp 0x570a
movq %rax, %rbx
jmp 0x5746
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
jne 0x570f
jmp 0x5746
movq %rax, %rbx
movq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rax
cmpq %rax, %rdi
je 0x5746
callq 0x32b0
jmp 0x5746
movq %rax, %rbx
jmp 0x5731
movq %rax, %rbx
jmp 0x573a
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x5731
callq 0x32b0
leaq -0x68(%rbp), %rdi
callq 0x60b2
leaq -0x88(%rbp), %rdi
callq 0x60b2
movq %rbx, %rdi
callq 0x3480