// File: /workspace/github_c_makefile_star2_O0/pencode-lab[P]Shoit/shoit_receiver.c
// Function: transfer_data_round_circle
static bool transfer_data_round_circle(shoit_core_t *receiver)
{
    int done = 0;
    bool needUpdate = true;
    struct timeval curTime, startTime;
    uint32_t  sendDataSize =0;

    /*init for this circle*/
    sem_wait(&receiver->dataSem);
    bool okInit = each_round_transfer_init(receiver);
    if(okInit){
        echo_to_sender_on_tcp(receiver,READY);
    }else {
        if(receiver->verbose>1)
            SHOIT_LOG("round_transfer_init failed:have't more data\n");
        return false;
    }

    shoit_control_t *tcpCrl=(shoit_control_t *)receiver->errorBitmap;
    bzero(tcpCrl,sizeof(shoit_control_t));                                                                                           
    tcpCrl->status = BITMAP;     
    while(okInit && !done && receiver->runing){                                                                                                
        gettimeofday(&startTime, NULL);                                                                                              
        blast_udp_recving(receiver);                                                                                                 
        gettimeofday(&curTime, NULL);                                                                                                
                                                                                                                                     
        /*update and return the count of errors*/                                                                                    
        uint64_t errnum=0;                                                                                                           
        if ((errnum=shoit_update_hash_table(receiver,needUpdate))== 0){/*all receiver,error =0*/                                     
            done = 1;                                                                                                                
            sendDataSize =0;                                                                                                         
        }else  
            sendDataSize = receiver->sizeofErrorBitmap;                                                                           

        tcpCrl->dataSize = htonl(sendDataSize);                                                                                      
                                                                                                                                     
        // Send back Error bitmap                                                                                                    
        int n = shoit_network_writen(receiver->tcpSockfd,receiver->errorBitmap,sizeof(shoit_control_t)+sendDataSize);                
        if(n!=sendDataSize+sizeof(shoit_control_t)){                                                                                 
            SHOIT_LOG("write bitmap to sender faild.(%s)\n",strerror(errno));                                                        
            done =1;                                                                                                                 
        }                                                                                                                            
        if(errnum==0 && receiver->iStream) {                                                                                          
            uint64_t totalSize = receiver->payloadSize*(receiver->totalNumberOfPackets-1) +receiver->lastPayloadSize; 
            if(receiver->callbacks->on_recv_data(receiver,receiver->bucket,totalSize)<0){
                SHOIT_LOG("write to receiver's toFd error:%s\n",strerror(errno));                                        
                break;                                                                                                   
            }                                                                                                            
            
        }
    }           

    if(receiver->useMmap && receiver->mapSize >0){
        munmap(receiver->bucket,receiver->mapSize);
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x2080
movq -0x10(%rbp), %rdi
callq 0x7580
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x7326
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x76e0
jmp 0x7359
movq -0x10(%rbp), %rax
cmpl $0x1, 0x5c(%rax)
jle 0x734d
jmp 0x7332
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rdi
leaq 0x29fb(%rip), %rsi      # 0x9d3f
movb $0x0, %al
callq 0x3df0
jmp 0x734d
movl $0x0, -0x4(%rbp)
jmp 0x7566
movq -0x10(%rbp), %rax
movq 0xd0(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0x1e, %edx
callq 0x21a0
movq -0x48(%rbp), %rax
movl $0x5, (%rax)
xorl %eax, %eax
cmpl $0x0, -0x40(%rbp)
movb %al, -0x61(%rbp)
je 0x73a9
xorl %eax, %eax
cmpl $0x0, -0x14(%rbp)
movb %al, -0x61(%rbp)
jne 0x73a9
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1a8(%rax)
setne %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x73b5
jmp 0x7533
leaq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2180
movq -0x10(%rbp), %rdi
callq 0x7880
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2180
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x2de0
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jne 0x7406
movl $0x1, -0x14(%rbp)
movl $0x0, -0x3c(%rbp)
jmp 0x7414
movq -0x10(%rbp), %rax
movq 0xd8(%rax), %rax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x2190
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x1a(%rax)
movq -0x10(%rbp), %rax
movl 0x6c(%rax), %edi
movq -0x10(%rbp), %rax
movq 0xd0(%rax), %rsi
movl -0x3c(%rbp), %eax
movl %eax, %edx
addq $0x1e, %rdx
callq 0x39f0
movl %eax, -0x54(%rbp)
movslq -0x54(%rbp), %rax
movl -0x3c(%rbp), %ecx
addq $0x1e, %rcx
cmpq %rcx, %rax
je 0x7491
jmp 0x745a
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rax
movq %rax, -0x70(%rbp)
callq 0x2060
movl (%rax), %edi
callq 0x2450
movq -0x70(%rbp), %rdi
movq %rax, %rdx
leaq 0x28e9(%rip), %rsi      # 0x9d6c
movb $0x0, %al
callq 0x3df0
movl $0x1, -0x14(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x752e
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1a4(%rax)
je 0x752e
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
subq $0x1, %rcx
imulq %rcx, %rax
movq -0x10(%rbp), %rcx
movl 0x30(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x1b0(%rax), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq (%rcx), %rsi
movq -0x60(%rbp), %rdx
callq *%rax
cmpq $0x0, %rax
jge 0x752c
jmp 0x74fa
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x2060
movl (%rax), %edi
callq 0x2450
movq -0x78(%rbp), %rdi
movq %rax, %rdx
leaq 0x286c(%rip), %rsi      # 0x9d8f
movb $0x0, %al
callq 0x3df0
jmp 0x7533
jmp 0x752e
jmp 0x7382
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1a0(%rax)
je 0x755f
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jbe 0x755f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x2310
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)