// File: /workspace/github_c_makefile_star2_O3/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 0x4478
cmpl $0x2, 0x5c(%rbx)
jl 0x4431
movq 0xe8(%rbx), %rdi
movl 0x98(%rbx), %r9d
movl 0xa0(%rbx), %ecx
leaq 0x78(%rbx), %r8
leaq 0x2380(%rip), %rsi      # 0x67a3
leaq 0x23a3(%rip), %rdx      # 0x67cd
xorl %eax, %eax
callq 0x374a
leaq 0xa4(%rbx), %rdi
movl 0x98(%rbx), %ecx
movl 0xa0(%rbx), %esi
leaq 0x78(%rbx), %rdx
callq 0x2fe8
movl %eax, 0x68(%rbx)
cmpl $-0x1, %eax
jne 0x4478
movq 0xe8(%rbx), %rdi
leaq 0x2324(%rip), %rsi      # 0x6787
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x374a
leaq 0x120(%rbx), %rdi
movq %rdi, 0x10(%rsp)
callq 0x2080
cmpl $0x0, 0x1a8(%rbx)
jne 0x44b0
movq %rbx, %rdi
movl $0x7, %esi
callq 0x4cb6
movl $0x0, 0x1a8(%rbx)
xorl %edi, %edi
callq 0x22d0
leaq 0xa4(%rbx), %rax
movq %rax, 0x28(%rsp)
leaq 0x18(%rsp), %r12
cmpl $0x2, 0x5c(%rbx)
jl 0x44e3
movq 0xe8(%rbx), %rdi
leaq 0x230b(%rip), %rsi      # 0x67e0
leaq 0x230f(%rip), %rdx      # 0x67eb
xorl %eax, %eax
callq 0x374a
cmpl $0x0, 0x1a0(%rbx)
je 0x454e
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x48f0
movq 0x8(%rbx), %rcx
cmpq %rax, %rcx
movq %rax, %r15
cmovbq %rcx, %r15
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 %r15, %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x20f0
movq %rax, (%rbx)
testq %rax, %rax
je 0x48c9
movq %r15, 0x8(%rbx)
movq %r15, 0x20(%rbx)
subq %r15, 0x18(%rbx)
jmp 0x45a0
movl 0xf8(%rbx), %edi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
callq 0x345f
testq %rax, %rax
je 0x48f0
cmpq 0x8(%rbx), %rax
je 0x45a0
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 0x3b94
movq %rbx, %rdi
movl $0x2, %esi
callq 0x4cb6
movq 0x10(%rsp), %rdi
callq 0x2080
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
cmpl $0x0, 0x1a8(%rbx)
je 0x4492
cmpl $0x2, 0x5c(%rbx)
jl 0x45f3
movq 0xe8(%rbx), %rdi
leaq 0x2236(%rip), %rsi      # 0x6822
xorl %eax, %eax
callq 0x374a
movl 0x34(%rbx), %edi
callq 0x22e0
movq %rax, %r15
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
movq 0x38(%rsp), %r14
movq 0x40(%rsp), %rbp
movq %r15, 0x8(%rsp)
addq $0xc, %r15
movq %r15, 0x30(%rsp)
xorl %r13d, %r13d
cmpl $0x0, 0x1a8(%rbx)
je 0x4783
movl 0x34(%rbx), %edx
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x2190
movq %r12, %rdi
xorl %esi, %esi
callq 0x2170
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %r15
subq %r14, %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
subq %rbp, %r15
addq %rax, %r15
movl 0x58(%rbx), %eax
imulq %r13, %rax
cmpq %rax, %r15
jae 0x46c9
xorl %eax, %eax
callq 0x3549
movq %rax, %rsi
movl 0x58(%rbx), %ecx
shll $0x3, %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
addq %rax, %rsi
movq %rbx, %rdi
callq 0x2b04
movq %r12, %rdi
xorl %esi, %esi
callq 0x2170
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %r15
subq %r14, %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
subq %rbp, %r15
addq %rax, %r15
movl 0x58(%rbx), %eax
imulq %r13, %rax
cmpq %rax, %r15
jb 0x4671
jmp 0x4625
movq 0xc8(%rbx), %rax
movq (%rax,%r13,8), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %rcx, %rsi
movq 0x38(%rbx), %rcx
decq %rcx
xorl %edx, %edx
cmpq %rcx, %rax
setae %dl
movslq 0x2c(%rbx,%rdx,4), %r15
movl %r15d, %ecx
bswapl %ecx
movl %ecx, 0x8(%rsi)
movl 0x2c(%rbx), %esi
imulq %rax, %rsi
addq (%rbx), %rsi
movq 0x30(%rsp), %rdi
movq %r15, %rdx
callq 0x2280
movl 0x68(%rbx), %edi
addq $0xc, %r15
movq 0x8(%rsp), %rsi
movq %r15, %rdx
xorl %ecx, %ecx
movq 0x28(%rsp), %r8
movl $0x10, %r9d
callq 0x21a0
testq %rax, %rax
js 0x4752
incq 0x50(%rbx)
addq %r15, 0x4b85(%rip)      # 0x92c8
incq %r13
cmpq 0x40(%rbx), %r13
jb 0x4625
jmp 0x4783
movq 0xe8(%rbx), %r15
callq 0x2060
movl (%rax), %edi
callq 0x2450
movq %r15, %rdi
leaq 0x215b(%rip), %rsi      # 0x68ca
movq %rax, %rdx
xorl %eax, %eax
callq 0x374a
movl $0x0, 0x1a8(%rbx)
movq 0x8(%rsp), %rdi
callq 0x2040
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
cmpl $0x2, 0x5c(%rbx)
jl 0x47b7
movq 0xe8(%rbx), %rdi
movl 0x6c(%rbx), %edx
leaq 0x2086(%rip), %rsi      # 0x6836
xorl %eax, %eax
callq 0x374a
movq %rbx, %rdi
movl $0x4, %esi
callq 0x4cb6
testl %eax, %eax
jne 0x47e0
movq 0xe8(%rbx), %rdi
movl 0x6c(%rbx), %edx
leaq 0x207e(%rip), %rsi      # 0x6857
xorl %eax, %eax
callq 0x374a
movq 0x10(%rsp), %rdi
callq 0x2080
movq 0xd0(%rbx), %rax
cmpb $0x1, 0x1e(%rax)
je 0x4896
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2c83
movq %rax, 0x40(%rbx)
movq %rax, %xmm1
movq 0x1d17(%rip), %xmm2     # 0x6530
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x1d1b(%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
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movsd 0x1dfb(%rip), %xmm2     # 0x6660
subsd %xmm0, %xmm2
addsd 0x1df7(%rip), %xmm2     # 0x6668
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %edx
movl %edx, 0x58(%rbx)
movq 0xe8(%rbx), %rdi
leaq 0x1ff4(%rip), %rsi      # 0x687e
movb $0x1, %al
callq 0x374a
jmp 0x45cb
movq $0x0, 0x40(%rbx)
movq 0x20(%rbx), %rsi
movq 0x38(%rbx), %rax
movq %rax, 0x50(%rbx)
testq %rsi, %rsi
je 0x48b7
movq (%rbx), %rdi
callq 0x2310
cmpl $0x0, 0x1a8(%rbx)
jne 0x44c1
jmp 0x4492
movq 0xe8(%rbx), %r14
callq 0x2060
movl (%rax), %edi
callq 0x2450
leaq 0x1fd6(%rip), %rsi      # 0x68b9
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x374a
cmpl $0x2, 0x5c(%rbx)
jl 0x4492
movq 0xe8(%rbx), %rdi
leaq 0x1efe(%rip), %rsi      # 0x6806
xorl %eax, %eax
callq 0x374a
jmp 0x4492