// File: /workspace/github_c_makefile_star2_O0/VeeeectorPan[P]MyNetdisk/clientSrc/sign_up.c
// Function: sign_up
int sign_up(int sock_fd)
{
    int ctl_num = CTL_REGISTER;
    send(sock_fd,&ctl_num,sizeof(int),0);

    int ret;
    char user_name[32];
    while(1)
    {
        rewind(stdin);
        memset(user_name,0,sizeof(user_name));
        printf("user name: ");
        ret = scanf("%s",user_name);
        if(ret == -1)
            exit(0);
        user_name[31] = '\0';
        int len = strlen(user_name);
        if(len < 5)
        {
            puts("user name too short!");
            continue;
        }
        send(sock_fd,&len,sizeof(int),0);
        send(sock_fd,user_name,len,0);
        recv(sock_fd,&ctl_num,sizeof(int),0);
        if(ctl_num == USER_NAME_NO_AVAIABLE)
        {
            puts("user name has been used!");
            continue;
        }
        else
            break;
    }
    char user_passwd[32];
    while(1)
    {
        rewind(stdin);
        memset(user_passwd,0,sizeof(user_name));
        printf("password: ");
        system("stty raw -echo");
        ret = scanf("%s",user_passwd);
        system("stty -raw echo");
        printf("\n");
        if(ret == -1)
            exit(0);
        user_passwd[31] = '\0';
        int len = strlen(user_passwd);
        if(len < 5)
        {
            puts("password too short!");
            continue;
        }
        send(sock_fd,&len,sizeof(int),0);
        send(sock_fd,user_passwd,len,0);
        break;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0x4(%rbp)
movl $0x9, -0x8(%rbp)
movl -0x4(%rbp), %edi
leaq -0x8(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20d0
movq 0x2e7c(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x2050
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x20f0
leaq 0xf3c(%rip), %rdi       # 0x60b7
movb $0x0, %al
callq 0x2030
leaq -0x30(%rbp), %rsi
leaq 0xf27(%rip), %rdi       # 0x60b4
movb $0x0, %al
callq 0x2180
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x51a4
xorl %edi, %edi
callq 0x21b0
movb $0x0, -0x11(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2090
movl %eax, -0x34(%rbp)
cmpl $0x5, -0x34(%rbp)
jge 0x51c8
leaq 0x1039(%rip), %rdi      # 0x61fa
callq 0x2250
jmp 0x5155
movl -0x4(%rbp), %edi
leaq -0x34(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20d0
movl -0x4(%rbp), %edi
leaq -0x30(%rbp), %rsi
movslq -0x34(%rbp), %rdx
xorl %ecx, %ecx
callq 0x20d0
movl -0x4(%rbp), %edi
leaq -0x8(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x2080
cmpl $0x0, -0x8(%rbp)
jne 0x5217
leaq 0x1002(%rip), %rdi      # 0x620f
callq 0x2250
jmp 0x5155
jmp 0x5219
jmp 0x521b
movq 0x2db6(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x2050
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x20f0
leaq 0xe82(%rip), %rdi       # 0x60c3
movb $0x0, %al
callq 0x2030
leaq 0xe7f(%rip), %rdi       # 0x60ce
callq 0x2140
leaq -0x60(%rbp), %rsi
leaq 0xe55(%rip), %rdi       # 0x60b4
movb $0x0, %al
callq 0x2180
movl %eax, -0xc(%rbp)
leaq 0xe6d(%rip), %rdi       # 0x60dd
callq 0x2140
leaq 0xd96(%rip), %rdi       # 0x6012
movb $0x0, %al
callq 0x2030
cmpl $-0x1, -0xc(%rbp)
jne 0x5290
xorl %edi, %edi
callq 0x21b0
movb $0x0, -0x41(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2090
movl %eax, -0x64(%rbp)
cmpl $0x5, -0x64(%rbp)
jge 0x52b7
leaq 0xf7b(%rip), %rdi       # 0x6228
callq 0x2250
jmp 0x521b
movl -0x4(%rbp), %edi
leaq -0x64(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20d0
movl -0x4(%rbp), %edi
leaq -0x60(%rbp), %rsi
movslq -0x64(%rbp), %rdx
xorl %ecx, %ecx
callq 0x20d0
xorl %eax, %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop