// File: /workspace/github_c_makefile_star2_O0/pencode-lab[P]Shoit/shoit_receiver.c
// Function: echo_to_sender_on_tcp
static bool echo_to_sender_on_tcp(shoit_core_t *receiver, int type)
{
    char buffer[MTU]={0};
    int dataSize =0;
    shoit_control_t *tcpCrl=(shoit_control_t *)buffer;

    memset(buffer,0,sizeof(buffer));
    tcpCrl->status =type;
    switch(type){
        case CONNECT:
        {
            dataSize= strlen(receiver->password);
            tcpCrl->dataSize =htonl(dataSize);
            memcpy(tcpCrl->data,receiver->password,dataSize);
        }break;
        case READY:
        {
            dataSize=0;
            tcpCrl->dataSize = htonl(0);
        }break;
        default:
            return false;                                                                                                            
    }                                                                                                                                
                                                                                                                                     
    if(shoit_network_writen(receiver->tcpSockfd, buffer, sizeof(shoit_control_t)+dataSize) != (sizeof(shoit_control_t)+dataSize))                    
    {                                                                                                                                
        SHOIT_LOG("tcp send failed(%s).\n",__func__);                                                                                
        return false;                                                                                                                
    }                                                                                                                                
                                                                                                                                     
    if(receiver->verbose>1) SHOIT_LOG("echo_to_sender_on_tcp ok....:%d\n",type);
    return true;                                                                                                                     
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5a0, %rsp            # imm = 0x5A0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq -0x570(%rbp), %rdi
movq %rdi, -0x5a0(%rbp)
xorl %esi, %esi
movl %esi, -0x594(%rbp)
movl $0x550, %edx            # imm = 0x550
movq %rdx, -0x590(%rbp)
callq 0x21a0
movq -0x5a0(%rbp), %rdi
movl -0x594(%rbp), %esi
movq -0x590(%rbp), %rdx
movl $0x0, -0x574(%rbp)
movq %rdi, -0x580(%rbp)
callq 0x21a0
movl -0x14(%rbp), %ecx
movq -0x580(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x584(%rbp)
subl $0x1, %eax
je 0x776c
jmp 0x775f
movl -0x584(%rbp), %eax
subl $0x3, %eax
je 0x77b7
jmp 0x77d6
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x20d0
movl %eax, -0x574(%rbp)
movl -0x574(%rbp), %edi
callq 0x2190
movl %eax, %ecx
movq -0x580(%rbp), %rax
movl %ecx, 0x1a(%rax)
movq -0x580(%rbp), %rdi
addq $0x1e, %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
movslq -0x574(%rbp), %rdx
callq 0x2280
jmp 0x77e2
movl $0x0, -0x574(%rbp)
xorl %edi, %edi
callq 0x2190
movl %eax, %ecx
movq -0x580(%rbp), %rax
movl %ecx, 0x1a(%rax)
jmp 0x77e2
movl $0x0, -0x4(%rbp)
jmp 0x786c
movq -0x10(%rbp), %rax
movl 0x6c(%rax), %edi
leaq -0x570(%rbp), %rsi
movslq -0x574(%rbp), %rdx
addq $0x1e, %rdx
callq 0x39f0
movslq -0x574(%rbp), %rcx
addq $0x1e, %rcx
cmpq %rcx, %rax
je 0x783b
jmp 0x7812
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rdi
leaq 0x21b0(%rip), %rsi      # 0x99d4
leaq 0x2587(%rip), %rdx      # 0x9db2
movb $0x0, %al
callq 0x3df0
movl $0x0, -0x4(%rbp)
jmp 0x786c
movq -0x10(%rbp), %rax
cmpl $0x1, 0x5c(%rax)
jle 0x7865
jmp 0x7847
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x256c(%rip), %rsi      # 0x9dc8
movb $0x0, %al
callq 0x3df0
jmp 0x7865
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x5a0, %rsp            # imm = 0x5A0
popq %rbp
retq
nopl (%rax,%rax)