// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq -0x30(%rbp), %r13
movq $0x0, (%r13)
movl 0x8(%rdi), %eax
movl %eax, -0x34(%rbp)
leaq 0x38(%rdi), %r12
leaq 0x20(%rdi), %rax
movq %rax, -0x48(%rbp)
leaq 0x60(%rdi), %rax
movq %rax, -0x40(%rbp)
movq %r12, %rdi
callq 0x22a0
cmpl $0x0, 0x24(%r14)
jne 0x368c
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x22d0
movq -0x48(%rbp), %rdi
movq %r13, %rsi
callq 0x4798
movl %eax, %ebx
movq %r12, %rdi
callq 0x2160
testl %ebx, %ebx
jne 0x3671
movq %r14, %r13
movq -0x30(%rbp), %rax
movl (%rax), %r15d
movl 0x4(%rax), %r14d
xorl %ebx, %ebx
leaq 0x1dc3(%rip), %rdi      # 0x5480
movl %r15d, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x2040
movq -0x30(%rbp), %rdi
callq 0x2210
leal -0x1(%r14), %eax
cmpl $0x9, %eax
ja 0x3752
leaq 0x1d51(%rip), %rcx      # 0x5434
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r15d, %edi
callq 0x29a8
jmp 0x3750
movl %r15d, %edi
callq 0x31d0
jmp 0x3750
movl %r15d, %edi
callq 0x343c
jmp 0x3750
movl %r15d, %edi
callq 0x2528
jmp 0x3750
movl %r15d, %edi
callq 0x2b48
jmp 0x3750
leaq 0x1d78(%rip), %rdi      # 0x549d
callq 0x22e0
movl %r15d, %edi
callq 0x31d8
jmp 0x3750
movl %r15d, %edi
callq 0x2cd8
jmp 0x3750
movl %r15d, %edi
callq 0x26b8
jmp 0x3750
movl %r15d, %edi
callq 0x27f0
movl %eax, %ebx
addl $-0x6, %r14d
cmpl $-0x3, %r14d
movq %r13, %r14
leaq -0x30(%rbp), %r13
ja 0x3671
cmpl $-0x1, %ebx
je 0x3671
movl -0x34(%rbp), %edi
movl %r15d, %esi
movl $0x1, %edx
callq 0x24ac
jmp 0x3671
nopl (%rax)