// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_sender.c
// Function: transfer_thread_run
static void transfer_thread_run(void *argv)
{
    shoit_core_t *sender = (shoit_core_t *)argv; 
    int done = 0;

    if(sender->runing){
        if(!connect_udp_server(sender)){
            SHOIT_LOG("connect udp server failed.\n");
            return;
        }
    }
    sem_wait(&sender->dataSem); /*be wakeup:CONNECT signal*/

    /*
    *here,you can send many bucket data in many round
    *if sendfile and mmap ,only one bucket
    */
    while(!done && sender->runing){
        if(transfer_data_round_circle(sender) == false) break; /*no more*/
    }


    /*send notice to remote:i will close*/
    echo_to_receiver_on_tcp(sender,CLOSE);
    sender->runing=false;

    pthread_exit(0);
   
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x1a8(%rdi)
je 0x417d
cmpl $0x2, 0x5c(%rbx)
jl 0x4136
movq 0xe8(%rbx), %rdi
movl 0x98(%rbx), %r9d
movl 0xa0(%rbx), %ecx
leaq 0x78(%rbx), %r8
leaq 0x264b(%rip), %rsi      # 0x6773
leaq 0x266e(%rip), %rdx      # 0x679d
xorl %eax, %eax
callq 0x34b1
leaq 0xa4(%rbx), %rdi
movl 0x98(%rbx), %ecx
movl 0xa0(%rbx), %esi
leaq 0x78(%rbx), %rdx
callq 0x2dba
movl %eax, 0x68(%rbx)
cmpl $-0x1, %eax
jne 0x417d
movq 0xe8(%rbx), %rdi
leaq 0x25ef(%rip), %rsi      # 0x6757
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x34b1
leaq 0x120(%rbx), %rdi
movq %rdi, 0x8(%rsp)
callq 0x2080
leaq 0xa4(%rbx), %rax
movq %rax, 0x28(%rsp)
cmpl $0x0, 0x1a8(%rbx)
je 0x45f5
cmpl $0x2, 0x5c(%rbx)
jl 0x41c9
movq 0xe8(%rbx), %rdi
leaq 0x25f5(%rip), %rsi      # 0x67b0
leaq 0x25f9(%rip), %rdx      # 0x67bb
xorl %eax, %eax
callq 0x34b1
cmpl $0x0, 0x1a0(%rbx)
je 0x422f
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x45da
movq 0x8(%rbx), %rcx
cmpq %rax, %rcx
movq %rax, %r14
cmovbq %rcx, %r14
movq 0x10(%rbx), %r9
subq %rax, %r9
movq %r9, %rax
xorl %edx, %edx
divq %rcx
subq %rdx, %r9
movl 0xf8(%rbx), %r8d
xorl %edi, %edi
movq %r14, %rsi
pushq $0x1
popq %rcx
movl %ecx, %edx
callq 0x20f0
movq %rax, (%rbx)
testq %rax, %rax
je 0x45b3
movq %r14, 0x8(%rbx)
movq %r14, 0x20(%rbx)
subq %r14, 0x18(%rbx)
jmp 0x4281
movl 0xf8(%rbx), %edi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
callq 0x3206
testq %rax, %rax
je 0x45da
cmpq 0x8(%rbx), %rax
je 0x4281
movq %rax, 0x8(%rbx)
movl 0x2c(%rbx), %ecx
xorl %edx, %edx
divq %rcx
xorl %esi, %esi
testq %rdx, %rdx
cmovel %ecx, %edx
setne %sil
addq %rax, %rsi
movq %rsi, 0x38(%rbx)
movl %edx, 0x30(%rbx)
shrq $0x3, %rsi
addq $0x2, %rsi
movq %rsi, 0xd8(%rbx)
movq %rbx, %rdi
callq 0x39a4
movq %rbx, %rdi
pushq $0x2
popq %rsi
callq 0x495d
movq 0x8(%rsp), %rdi
callq 0x2080
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
cmpl $0x0, 0x1a8(%rbx)
je 0x419a
cmpl $0x2, 0x5c(%rbx)
jl 0x42d2
movq 0xe8(%rbx), %rdi
leaq 0x2527(%rip), %rsi      # 0x67f2
xorl %eax, %eax
callq 0x34b1
movl 0x34(%rbx), %edi
callq 0x22e0
movq %rax, %r12
xorl %r15d, %r15d
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
movq 0x38(%rsp), %rbp
movq 0x40(%rsp), %r14
movq %r12, %rax
addq $0xc, %rax
movq %rax, 0x30(%rsp)
xorl %eax, %eax
movq %r12, 0x10(%rsp)
testl %eax, %eax
jne 0x447b
cmpl $0x0, 0x1a8(%rbx)
movq 0x10(%rsp), %r12
je 0x447b
movl 0x34(%rbx), %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x2190
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %r13
subq %rbp, %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
subq %r14, %r13
addq %rax, %r13
movl 0x58(%rbx), %eax
movq %r15, %rcx
imulq %rax, %rcx
cmpq %rcx, %r13
jae 0x43c1
leaq 0x18(%rsp), %r12
movl %eax, %eax
imulq %r15, %rax
cmpq %rax, %r13
jae 0x4311
xorl %eax, %eax
callq 0x32e1
movq %rax, %rsi
movl 0x58(%rbx), %ecx
shll $0x3, %ecx
movq %r13, %rax
xorl %edx, %edx
divq %rcx
addq %rax, %rsi
movq %rbx, %rdi
callq 0x28f3
movq %r12, %rdi
xorl %esi, %esi
callq 0x2170
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %r13
subq %rbp, %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
subq %r14, %r13
addq %rax, %r13
movl 0x58(%rbx), %eax
jmp 0x436a
movq 0xc8(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, (%r12)
movq 0x38(%rbx), %rcx
decq %rcx
xorl %edx, %edx
cmpq %rcx, %rax
setae %dl
movslq 0x2c(%rbx,%rdx,4), %r13
movl %r13d, %ecx
bswapl %ecx
movl %ecx, 0x8(%r12)
movl 0x2c(%rbx), %esi
imulq %rax, %rsi
addq (%rbx), %rsi
movq 0x30(%rsp), %rdi
movq %r13, %rdx
callq 0x2280
movl 0x68(%rbx), %edi
addq $0xc, %r13
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
movq 0x28(%rsp), %r8
pushq $0x10
popq %r9
callq 0x21a0
testq %rax, %rax
jns 0x445a
movq 0xe8(%rbx), %r13
callq 0x2060
movl (%rax), %edi
callq 0x2450
movq %r13, %rdi
leaq 0x2456(%rip), %rsi      # 0x689a
movq %rax, %rdx
xorl %eax, %eax
callq 0x34b1
andl $0x0, 0x1a8(%rbx)
jmp 0x4311
incq 0x50(%rbx)
incq %r15
addq %r13, 0x4e60(%rip)      # 0x92c8
xorl %eax, %eax
cmpq 0x40(%rbx), %r15
setae %al
movq 0x10(%rsp), %r12
jmp 0x4309
movq %r12, %rdi
callq 0x2040
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
cmpl $0x2, 0x5c(%rbx)
jl 0x44ad
movq 0xe8(%rbx), %rdi
movl 0x6c(%rbx), %edx
leaq 0x2360(%rip), %rsi      # 0x6806
xorl %eax, %eax
callq 0x34b1
movq %rbx, %rdi
pushq $0x4
popq %rsi
callq 0x495d
testl %eax, %eax
jne 0x44d4
movq 0xe8(%rbx), %rdi
movl 0x6c(%rbx), %edx
leaq 0x235a(%rip), %rsi      # 0x6827
xorl %eax, %eax
callq 0x34b1
movq 0x8(%rsp), %rdi
callq 0x2080
movq 0xd0(%rbx), %rax
movb 0x1e(%rax), %bpl
cmpb $0x1, %bpl
je 0x4586
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x2a82
movq %rax, 0x40(%rbx)
movq %rax, %xmm1
movq 0x2021(%rip), %xmm2     # 0x6530
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x2025(%rip), %xmm3     # 0x6540
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x38(%rbx), %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movl 0x58(%rbx), %eax
cvtsi2sd %rax, %xmm1
movsd 0x20d8(%rip), %xmm2     # 0x6630
subsd %xmm0, %xmm2
addsd 0x20d4(%rip), %xmm2     # 0x6638
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %edx
movl %edx, 0x58(%rbx)
movq 0xe8(%rbx), %rdi
leaq 0x22d1(%rip), %rsi      # 0x684e
movb $0x1, %al
callq 0x34b1
jmp 0x45a4
andq $0x0, 0x40(%rbx)
movq 0x20(%rbx), %rsi
movq 0x38(%rbx), %rax
movq %rax, 0x50(%rbx)
testq %rsi, %rsi
je 0x45a4
movq (%rbx), %rdi
callq 0x2310
cmpb $0x1, %bpl
jne 0x42aa
jmp 0x419a
movq 0xe8(%rbx), %r14
callq 0x2060
movl (%rax), %edi
callq 0x2450
leaq 0x22bc(%rip), %rsi      # 0x6889
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x34b1
cmpl $0x2, 0x5c(%rbx)
jl 0x45f5
movq 0xe8(%rbx), %rdi
leaq 0x21e8(%rip), %rsi      # 0x67d6
xorl %eax, %eax
callq 0x34b1
pushq $0x7
popq %rsi
movq %rbx, %rdi
callq 0x495d
andl $0x0, 0x1a8(%rbx)
xorl %edi, %edi
callq 0x22d0