// File: /workspace/github_c_makefile_star2_O0/VeeeectorPan[P]MyNetdisk/clientSrc/login.c
// Function: login
int login(int sock_fd)
{
    char user_name[32];
    char user_passwd[32];
    int ctl_num = CTL_LOGIN;
    send(sock_fd,&ctl_num,sizeof(int),0);
    while(1)
    {
        rewind(stdin);
        memset(user_name,0,sizeof(user_name));
        memset(user_name,0,sizeof(user_passwd));
        printf("user name: ");
        scanf("%s",user_name);
        rewind(stdin);
        printf("password: ");
        system("stty raw -echo");
        scanf("%s",user_passwd);
        system("stty -raw echo");
        printf("\n");
        user_name[31] = '\0';
        user_passwd[31] = '\0';
        int len = strlen(user_name);
        send(sock_fd,&len,sizeof(int),0);
        send(sock_fd,user_name,len,0);
        len = strlen(user_passwd);
        send(sock_fd,&len,sizeof(int),0);
        send(sock_fd,user_passwd,len,0);
        recv(sock_fd,&ctl_num,sizeof(int),0);
        switch(ctl_num)
        {
        case PASSWD_MISMATCHED:
            puts("incorrect password or user name");
            return -1;
        case USER_NAME_NOTEX:
            puts("user name not exist");
            return -1;
        case LOGIN_SUCCESS:
            return 0;
        default:
            puts("unknown error");
            return -1;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl %edi, -0x8(%rbp)
movl $0xa, -0x54(%rbp)
movl -0x8(%rbp), %edi
leaq -0x54(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20d0
movq 0x4e09(%rip), %rax      # 0x7fd8
movq %rax, -0x98(%rbp)
movq (%rax), %rdi
callq 0x2050
xorps %xmm0, %xmm0
movaps %xmm0, -0x20(%rbp)
movaps %xmm0, -0x30(%rbp)
movaps %xmm0, -0x20(%rbp)
movaps %xmm0, -0x30(%rbp)
leaq 0x2ebf(%rip), %rdi      # 0x60b7
xorl %eax, %eax
movl %eax, -0x60(%rbp)
movb %al, -0x81(%rbp)
callq 0x2030
movb -0x81(%rbp), %al
leaq 0x2e9f(%rip), %rdi      # 0x60b4
movq %rdi, -0x90(%rbp)
leaq -0x30(%rbp), %rsi
movq %rsi, -0x80(%rbp)
callq 0x2180
movq -0x98(%rbp), %rax
movq (%rax), %rdi
callq 0x2050
movb -0x81(%rbp), %al
leaq 0x2e7e(%rip), %rdi      # 0x60c3
callq 0x2030
leaq 0x2e7d(%rip), %rdi      # 0x60ce
callq 0x2140
movq -0x90(%rbp), %rdi
movb -0x81(%rbp), %al
leaq -0x50(%rbp), %rsi
movq %rsi, -0x70(%rbp)
callq 0x2180
leaq 0x2e66(%rip), %rdi      # 0x60dd
callq 0x2140
movb -0x81(%rbp), %al
leaq 0x2d89(%rip), %rdi      # 0x6012
callq 0x2030
movq -0x80(%rbp), %rdi
movb $0x0, -0x11(%rbp)
movb $0x0, -0x31(%rbp)
callq 0x2090
movl -0x60(%rbp), %ecx
movl %eax, -0x58(%rbp)
movl -0x8(%rbp), %edi
leaq -0x58(%rbp), %rsi
movq %rsi, -0x78(%rbp)
movl $0x4, %edx
movq %rdx, -0x68(%rbp)
callq 0x20d0
movq -0x80(%rbp), %rsi
movl -0x60(%rbp), %ecx
movl -0x8(%rbp), %edi
movslq -0x58(%rbp), %rdx
callq 0x20d0
movq -0x70(%rbp), %rdi
callq 0x2090
movq -0x78(%rbp), %rsi
movq -0x68(%rbp), %rdx
movl -0x60(%rbp), %ecx
movl %eax, -0x58(%rbp)
movl -0x8(%rbp), %edi
callq 0x20d0
movq -0x70(%rbp), %rsi
movl -0x60(%rbp), %ecx
movl -0x8(%rbp), %edi
movslq -0x58(%rbp), %rdx
callq 0x20d0
movq -0x68(%rbp), %rdx
movl -0x60(%rbp), %ecx
movl -0x8(%rbp), %edi
leaq -0x54(%rbp), %rsi
callq 0x2080
movl -0x54(%rbp), %eax
movl %eax, -0x5c(%rbp)
subl $0x1, %eax
je 0x3361
jmp 0x3323
movl -0x5c(%rbp), %eax
subl $0x2, %eax
je 0x334c
jmp 0x332d
movl -0x5c(%rbp), %eax
subl $0x3, %eax
jne 0x336a
jmp 0x3337
leaq 0x2dae(%rip), %rdi      # 0x60ec
callq 0x2250
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x337d
leaq 0x2db9(%rip), %rdi      # 0x610c
callq 0x2250
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x337d
movl $0x0, -0x4(%rbp)
jmp 0x337d
leaq 0x2daf(%rip), %rdi      # 0x6120
callq 0x2250
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)