// File: /workspace/github_c_makefile_star2_O0/pencode-lab[P]Shoit/shoit_sender.c
// Function: sender_run_loop
static void _sender_run_loop(shoit_core_t *sender)
{
     /*                                                                                                                               
    * sender is ready, can start recv request of client(receiver)                                                                    
    */                                                                                                                               
                                                                                                                                     
    do{                                                                                                                              
        sender->runing = true;                                                                                                       
                                                                                                                                     
        /*blocking accept until client connect*/                                                                                     
        SHOIT_LOG("Start runing sender...wait the remote receiver connect.\n");
        if(!tcpserver_init(sender)){                                                                                                 
            SHOIT_LOG("tcpserver init failed.\n");                                                                                   
            break;                                                                                                                   
        }                                                                                                                            
                                                                                                                                     
        struct sockaddr_in *client =&sender->tcpClientAddr;                                                                          
        inet_ntop(AF_INET,&client->sin_addr, sender->remoteHost, sizeof(sender->remoteHost));                                        
                                                                                                                                     
        /*create data transfer thread base on udp*/                                                                                  
        pthread_t transfer_thid;                                                                                                     
        pthread_create(&transfer_thid,NULL,(void*)transfer_thread_run,(void*)sender);                                                
                                                                                                                                     
                                                                                                                                     
        /*create progress thread*/                                                                                                   
        pthread_t prog_thid;                                                                                                         
        pthread_create(&prog_thid,NULL,(void*)progress_thread_run,(void*)sender);                                                    
                                                                                                                                     
                                                                                                                                     
        /*run main control thread*/                                                                                                  
        tcpserver_run(sender);                                                                                              
                                                                                                                                     
        /*free thread*/                                                                                                              
        sem_post(&sender->dataSem);/*let us udp send data in man pthread*/                                                           
        sem_post(&sender->progSem);/*notice progress thread*/                                                                        
                                                                                                                                     
                                                                                                                                     
        /*wait thread exit*/                                                                                                         
        pthread_join(transfer_thid,NULL);                                                                                            
        pthread_join(prog_thid,NULL);                                                                                                
                                                                                                                                     
    }while(0); 


    return;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, 0x1a8(%rax)
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rdi
leaq 0x4b57(%rip), %rsi      # 0x9783
movb $0x0, %al
callq 0x3df0
movq -0x8(%rbp), %rdi
callq 0x4e50
cmpl $0x0, %eax
jne 0x4c61
jmp 0x4c43
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rdi
leaq 0x4b67(%rip), %rsi      # 0x97bc
movb $0x0, %al
callq 0x3df0
jmp 0x4d01
movq -0x8(%rbp), %rax
addq $0xb4, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movq -0x8(%rbp), %rdx
addq $0x78, %rdx
movl $0x2, %edi
movl $0x20, %ecx
callq 0x2030
movq -0x8(%rbp), %rcx
leaq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x25f(%rip), %rdx       # 0x4f00
callq 0x2340
movq -0x8(%rbp), %rcx
leaq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x317(%rip), %rdx       # 0x4fd0
callq 0x2340
movq -0x8(%rbp), %rdi
callq 0x54c0
movq -0x8(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x21f0
movq -0x8(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x21f0
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2420
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2420
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)