// File: /workspace/github_cpp_makefile_star2_O1/QZzcoder[P]LiveChat/client.cpp
// Function: main
int main()
{
    string name;
    cout<<"输入 用户名@密码:";
    cin>>name;
    int socket_fd = getSocket(8888,"127.0.0.1",false);
    write(socket_fd,name.c_str(),name.size());
    fd_set fds;
    char recv_buff[255];
    set<int> SelectSet,cinSelectSet;
    SelectSet.insert(socket_fd);
    cinSelectSet.insert(STDIN_FILENO);
    while(1){
        if(mySelect(fds,SelectSet,0) == socket_fd){
            ssize_t recv_size = read(socket_fd,recv_buff,255);
            if(recv_size<=0){
                cout<<"服务器关闭"<<endl;
                break;
            }
            if(recv_buff[0] == 'N'){
                cout<<"用户名或密码错误"<<endl;
                break;
            }
            printf("%s",recv_buff);
            memset(recv_buff,0,sizeof(recv_buff));
        }
        if(mySelect(fds,cinSelectSet,0) == STDIN_FILENO){
            ssize_t recv_size = read(STDIN_FILENO,recv_buff,255);
            if(send(socket_fd,recv_buff,sizeof(recv_buff),0)<=0){
                cout<<"write error\n";
                exit(1);
            }
            memset(recv_buff,0,sizeof(recv_buff));
        }
    }

    close(socket_fd);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
movq 0x3b25(%rip), %rdi      # 0x5fd0
leaq 0x1b6e(%rip), %rsi      # 0x4020
movl $0x18, %edx
callq 0x2230
movq 0x3b1d(%rip), %rdi      # 0x5fe0
leaq -0x50(%rbp), %rsi
callq 0x2260
leaq -0x68(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b5e(%rip), %rsi      # 0x4039
leaq 0x1b60(%rip), %rdx      # 0x4042
leaq -0x78(%rbp), %rdi
callq 0x29ca
leaq -0x78(%rbp), %rsi
movl $0x22b8, %edi           # imm = 0x22B8
xorl %edx, %edx
callq 0x2cea
movl %eax, %ebx
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x250b
callq 0x21a0
movl %ebx, -0x2c(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movl %ebx, %edi
callq 0x2090
leaq -0xd0(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq -0xa0(%rbp), %rax
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq -0xd8(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x2a64
leaq -0x54(%rbp), %rsi
movl $0x0, (%rsi)
leaq -0xa8(%rbp), %rdi
callq 0x2b8c
leaq -0x138(%rbp), %r14
leaq -0x2c0(%rbp), %r12
leaq -0x108(%rbp), %rbx
movq %r14, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x27ce
movq %r12, %r13
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2dcb
movl %eax, %r15d
movl -0x2c(%rbp), %r12d
movq %r14, %rdi
callq 0x29b2
cmpl %r12d, %r15d
jne 0x2610
movl -0x2c(%rbp), %edi
movl $0xff, %edx
leaq -0x240(%rbp), %rsi
callq 0x2270
testq %rax, %rax
jle 0x268c
cmpb $0x4e, -0x240(%rbp)
je 0x269a
leaq 0x1a7c(%rip), %rdi      # 0x406c
leaq -0x240(%rbp), %r15
movq %r15, %rsi
xorl %eax, %eax
callq 0x2040
movl $0xff, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2100
movq %rbx, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x27ce
movq %r13, %r12
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2dcb
movl %eax, %r15d
movq %rbx, %rdi
callq 0x29b2
testl %r15d, %r15d
jne 0x258c
movl $0xff, %edx
xorl %edi, %edi
leaq -0x240(%rbp), %r15
movq %r15, %rsi
callq 0x2270
movl -0x2c(%rbp), %edi
movl $0xff, %edx
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x20e0
testq %rax, %rax
jle 0x2726
movl $0xff, %edx
leaq -0x240(%rbp), %rdi
xorl %esi, %esi
callq 0x2100
jmp 0x258c
movl $0xf, %edx
leaq 0x19ab(%rip), %rsi      # 0x4043
jmp 0x26a6
movl $0x18, %edx
leaq 0x19ad(%rip), %rsi      # 0x4053
movq 0x3923(%rip), %rbx      # 0x5fd0
movq %rbx, %rdi
leaq -0x40(%rbp), %r15
callq 0x2230
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x38f9(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movl -0x2c(%rbp), %edi
callq 0x22f0
leaq -0xa8(%rbp), %rdi
callq 0x29b2
leaq -0xd8(%rbp), %rdi
callq 0x29b2
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x2712
callq 0x21a0
xorl %eax, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38a3(%rip), %rdi      # 0x5fd0
leaq 0x193b(%rip), %rsi      # 0x406f
callq 0x21d0
movl $0x1, %edi
callq 0x2250
jmp 0x278b
jmp 0x275e
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x27aa
callq 0x21a0
jmp 0x27aa
jmp 0x275e
jmp 0x2763
movq %rax, %rbx
jmp 0x27aa
movq %rax, %rbx
jmp 0x2792
jmp 0x278b
jmp 0x278b
jmp 0x278b
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
jmp 0x2784
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
callq 0x29b2
jmp 0x278e
movq %rax, %rbx
leaq -0x40(%rbp), %r15
leaq -0xa8(%rbp), %rdi
callq 0x29b2
leaq -0xd8(%rbp), %rdi
callq 0x29b2
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x27b8
callq 0x21a0
movq %rbx, %rdi
callq 0x22c0