// File: /workspace/github_c_makefile_star2_O0/VeeeectorPan[P]MyNetdisk/SourceFile/factory_init.c
// Function: thread_func
void* thread_func(void* p)
{
    factory_t *p_fact = (factory_t*)p;
    struct Queue_node* node = NULL;
    int client_fd = 0;
    int ctl_no;
    int epoll_fd = p_fact->epoll_fd;
    while(1)
    {
        pthread_mutex_lock(&p_fact->mutex);
        if(p_fact->que.que_size == 0)
        {
            pthread_cond_wait(&p_fact->cond,&p_fact->mutex);
        }
        int ret = que_pop(&p_fact->que,&node);
        pthread_mutex_unlock(&p_fact->mutex);
        if(ret == 0)
        {
            client_fd = node->client_fd;
            ctl_no = node->ctl_no;
            printf("client_fd = %d, ctl_No = %d\n",client_fd,ctl_no);
            free(node);
            switch(ctl_no)
            {
            case CTL_REGISTER:
                puts("sign up!");
                ret = client_register(client_fd);
                break;
            case CTL_LOGIN:
                ret = client_login(client_fd);
                break;
            case CTL_LS:
                ret = client_ls(client_fd);
                break;
            case CTL_CD:
                ret = client_cd(client_fd);
                break;
            case CTL_PWD:
                ret = client_pwd(client_fd);
                break;
            case CTL_PUT:
                ret = client_put(client_fd);
                break;
            case CTL_GET:
                ret = client_get(client_fd);
                break;
            case CTL_RM:
                ret = client_rm(client_fd);
                break;
            case CTL_MKDIR:
                ret = client_mkdir(client_fd);
                break;
            }
            if(ret != -1 && ctl_no != CTL_GET && ctl_no != CTL_PUT)
                add_fd_to_epoll(epoll_fd,client_fd,EPOLLIN);
        }
    }
    pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
callq 0x22c0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jne 0x3e19
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
movq -0x10(%rbp), %rsi
addq $0x38, %rsi
callq 0x22f0
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x18(%rbp), %rsi
callq 0x5bc0
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
callq 0x2170
cmpl $0x0, -0x28(%rbp)
jne 0x3f3f
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
leaq 0x3634(%rip), %rdi      # 0x7498
xorl %eax, %eax
callq 0x2040
movq -0x18(%rbp), %rdi
callq 0x2220
movl -0x20(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x9, %eax
ja 0x3f1b
movq -0x30(%rbp), %rax
leaq 0x35b9(%rip), %rcx      # 0x744c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3612(%rip), %rdi      # 0x74b5
callq 0x2300
movl -0x1c(%rbp), %edi
callq 0x3730
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x2930
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x2ba0
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x2540
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x3720
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x3050
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x27a0
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x3ad0
movl %eax, -0x28(%rbp)
jmp 0x3f1b
movl -0x1c(%rbp), %edi
callq 0x2e00
movl %eax, -0x28(%rbp)
cmpl $-0x1, -0x28(%rbp)
je 0x3f3d
cmpl $0x5, -0x20(%rbp)
je 0x3f3d
cmpl $0x4, -0x20(%rbp)
je 0x3f3d
movl -0x24(%rbp), %edi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
callq 0x2490
jmp 0x3f3f
jmp 0x3ded
nopw %cs:(%rax,%rax)
nop