// File: /workspace/github_c_makefile_star2_O0/VeeeectorPan[P]MyNetdisk/SourceFile/client_login.c
// Function: client_login
int client_login(int client_fd)
{
    MYSQL* connect;
    connect_mysql(&connect);
    int length;
    int ret;
    char user_name[32];
    char user_passwd[32];
    while(1)
    {
        ret = recv(client_fd,&length,sizeof(int),0);
        DISCON_CHECK(ret,-1,client_fd);
        ret = recv_client_all(client_fd,user_name,length);
        DISCON_CHECK(ret,-1,client_fd);
        ret = recv(client_fd,&length,sizeof(int),0);
        DISCON_CHECK(ret,-1,client_fd);
        ret = recv_client_all(client_fd,user_passwd,length);
        DISCON_CHECK(ret,-1,client_fd);
        ret = user_name_avaiable(user_name,connect);
        if(ret == 1)
        {
            int ctl_num = USER_NAME_NOTEX;
            ret = send(client_fd,&ctl_num,sizeof(int),MSG_NOSIGNAL);
            DISCON_CHECK(ret,-1,client_fd);
            continue;
        }
        if(is_match(user_name,user_passwd,connect) != 0)
        {
            int ctl_num = PASSWD_MISMATCHED;
            ret = send(client_fd,&ctl_num,sizeof(int),MSG_NOSIGNAL);
            DISCON_CHECK(ret,-1,client_fd);
            continue;
        }
        else
            break;
    }
    int ctl_num = LOGIN_SUCCESS;
    ret = send(client_fd,&ctl_num,sizeof(int),MSG_NOSIGNAL);
    DISCON_CHECK(ret,-1,client_fd);
    char mysql_oper[256];
    int user_id = get_user_id(mysql_oper,user_name,connect);
    ret = send(client_fd,&user_id,sizeof(int),MSG_NOSIGNAL);
    DISCON_CHECK(ret,-1,client_fd);
    int file_id = get_file_id(mysql_oper,user_id,connect);
    ret = send(client_fd,&file_id,sizeof(int),MSG_NOSIGNAL);
    DISCON_CHECK(ret,-1,client_fd);
    mysql_close(connect);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movl %edi, -0x8(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x3c20
movl -0x8(%rbp), %edi
leaq -0x14(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20b0
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2977
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
movl -0x8(%rbp), %edi
leaq -0x40(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x5cb0
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x29a3
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
movl -0x8(%rbp), %edi
leaq -0x14(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20b0
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x29d3
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
movl -0x8(%rbp), %edi
leaq -0x60(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x5cb0
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x29ff
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x65c0
movl %eax, -0x18(%rbp)
cmpl $0x1, -0x18(%rbp)
jne 0x2a54
movl $0x2, -0x64(%rbp)
movl -0x8(%rbp), %edi
leaq -0x64(%rbp), %rsi
movl $0x4, %edx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2a4f
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
jmp 0x2947
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x42b0
cmpl $0x0, %eax
je 0x2aa9
movl $0x3, -0x68(%rbp)
movl -0x8(%rbp), %edi
leaq -0x68(%rbp), %rsi
movl $0x4, %edx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2aa4
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
jmp 0x2947
jmp 0x2aab
movl $0x1, -0x6c(%rbp)
movl -0x8(%rbp), %edi
leaq -0x6c(%rbp), %rsi
movl $0x4, %edx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2ae5
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
leaq -0x170(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x41a0
movl %eax, -0x174(%rbp)
movl -0x8(%rbp), %edi
leaq -0x174(%rbp), %rsi
movl $0x4, %edx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2b32
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
leaq -0x170(%rbp), %rdi
movl -0x174(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x4010
movl %eax, -0x178(%rbp)
movl -0x8(%rbp), %edi
leaq -0x178(%rbp), %rsi
movl $0x4, %edx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2b81
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b91
movq -0x10(%rbp), %rdi
callq 0x2260
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopl (%rax)