// File: /workspace/github_c_makefile_star2_O0/VeeeectorPan[P]MyNetdisk/SourceFile/client_mkdir.c
// Function: client_mkdir
int client_mkdir(int client_fd)
{
    MYSQL* connect;
    connect_mysql(&connect);
    int file_id;
    int ret = recv(client_fd,&file_id,sizeof(int),0);
    DISCON_CHECK(ret,0,client_fd);
    int user_id;
    ret = recv(client_fd,&user_id,sizeof(int),0);
    DISCON_CHECK(ret,0,client_fd);
    char file_name[32] = {0};
    int len;
    ret = recv(client_fd,&len,sizeof(int),0);
    DISCON_CHECK(ret,0,client_fd);
    ret = recv_client_all(client_fd,file_name,len);
    DISCON_CHECK(ret,-1,client_fd);
    char mysql_oper[256];
    sprintf(mysql_oper,"select * from File where user_id=%d and parent_id=%d and file_name='%s'",user_id,file_id
            ,file_name);
    unsigned int queryRet = mysql_query(connect,mysql_oper);
    if(queryRet)
    {
        printf("Mysql query error: %s\n",mysql_error(connect));
        return -1;
    }
    MYSQL_RES* res;
    res = mysql_store_result(connect);
    if(mysql_num_rows(res) == 0)
    {
        int flag = FILE_NAME_AVAIABLE;
        ret = send(client_fd,&flag,sizeof(int),MSG_NOSIGNAL);
        DISCON_CHECK(ret,-1,client_fd);
    }
    else
    {
        int flag= FILE_NAME_NO_AVAIABLE;
        ret = send(client_fd,&flag,sizeof(int),MSG_NOSIGNAL);
        DISCON_CHECK(ret,-1,client_fd);
        return 0;
    }
    mysql_free_result(res);
    sprintf(mysql_oper,"insert into File(parent_id,file_name,user_id,file_type) values(%d,'%s',%d,'d');"
            ,file_id,file_name,user_id);
    insert_to_mysql(mysql_oper,connect);
    mysql_close(connect);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
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 $0x0, -0x18(%rbp)
jne 0x2e47
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x303d
movl -0x8(%rbp), %edi
leaq -0x1c(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20b0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x2e77
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x303d
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2140
movl -0x8(%rbp), %edi
leaq -0x44(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x20b0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x2eb7
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x303d
movl -0x8(%rbp), %edi
leaq -0x40(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0x5cb0
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2ee3
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x303d
leaq -0x150(%rbp), %rdi
movl -0x1c(%rbp), %edx
movl -0x14(%rbp), %ecx
leaq -0x40(%rbp), %r8
leaq 0x41d2(%rip), %rsi      # 0x70cd
movb $0x0, %al
callq 0x2070
movq -0x10(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x2150
movl %eax, -0x154(%rbp)
cmpl $0x0, -0x154(%rbp)
je 0x2f47
movq -0x10(%rbp), %rdi
callq 0x20c0
movq %rax, %rsi
leaq 0x41e1(%rip), %rdi      # 0x7115
movb $0x0, %al
callq 0x2040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x303d
movq -0x10(%rbp), %rdi
callq 0x2130
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rdi
callq 0x21a0
cmpq $0x0, %rax
jne 0x2fab
movl $0x1, -0x164(%rbp)
movl -0x8(%rbp), %edi
leaq -0x164(%rbp), %rsi
movl $0x4, %edx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2fa9
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x303d
jmp 0x2ff1
movl $0x0, -0x168(%rbp)
movl -0x8(%rbp), %edi
leaq -0x168(%rbp), %rsi
movl $0x4, %edx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x2fe8
movl -0x8(%rbp), %edi
callq 0x2380
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x303d
movl $0x0, -0x4(%rbp)
jmp 0x303d
movq -0x160(%rbp), %rdi
callq 0x21f0
leaq -0x150(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq -0x40(%rbp), %rcx
movl -0x1c(%rbp), %r8d
leaq 0x4116(%rip), %rsi      # 0x712c
movb $0x0, %al
callq 0x2070
leaq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4250
movq -0x10(%rbp), %rdi
callq 0x2260
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopl (%rax)