// File: maydali28[P]cpp-socket/matrix_hal/socketUDP.cpp
// Function: matrix_hal::socketUDP::send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::valarray<short>, int)
int socketUDP::send(std::string ip, int port,std::valarray<int16_t> buf, int length){
      std::ostringstream oss;
      if (buf.size())
      {
        // Convert all but the last element to avoid a trailing ","
        std::copy(std::begin(buf), std::end(buf)-1,
            std::ostream_iterator<int16_t>(oss, ","));

        // Now add the last element with no delimiter
        oss << buf[buf.size()-1 ];
      }
      std::cout << oss.str() <<"\n";
      std::string packet = oss.str();
      int result = send(ip,port, packet);
      return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rsi, -0x278(%rbp)
movq %rcx, -0x268(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x270(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x2220
movq -0x268(%rbp), %rdi
callq 0x3160
movq %rax, -0x260(%rbp)
jmp 0x2e68
movq -0x260(%rbp), %rax
cmpq $0x0, %rax
je 0x2f47
movq -0x268(%rbp), %rdi
callq 0x31f0
movq -0x268(%rbp), %rdi
movq %rax, -0x288(%rbp)
callq 0x3250
addq $-0x2, %rax
movq %rax, -0x280(%rbp)
leaq 0x1169(%rip), %rdx      # 0x4013
leaq -0x1c0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x32c0
jmp 0x2ebf
movq -0x280(%rbp), %rdx
movq -0x288(%rbp), %rsi
leaq -0x1d0(%rbp), %rdi
leaq -0x1c0(%rbp), %rcx
callq 0x3180
jmp 0x2ee2
movq -0x268(%rbp), %rdi
callq 0x3160
movq %rax, -0x290(%rbp)
jmp 0x2ef7
movq -0x268(%rbp), %rdi
movq -0x290(%rbp), %rsi
decq %rsi
callq 0x32f0
movq %rax, -0x298(%rbp)
jmp 0x2f16
movq -0x298(%rbp), %rax
movswl (%rax), %esi
leaq -0x1a0(%rbp), %rdi
callq 0x2180
jmp 0x2f2e
jmp 0x2f47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x30de
leaq -0x1f0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x21c0
jmp 0x2f5c
movq 0x3075(%rip), %rdi      # 0x5fd8
leaq -0x1f0(%rbp), %rsi
callq 0x2170
movq %rax, -0x2a0(%rbp)
jmp 0x2f78
movq -0x2a0(%rbp), %rdi
leaq 0x108b(%rip), %rsi      # 0x4011
callq 0x21a0
jmp 0x2f8d
leaq -0x1f0(%rbp), %rdi
callq 0x2110
leaq -0x210(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x21c0
jmp 0x2fae
movq -0x278(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0x20f0
jmp 0x2fc3
movl -0x14(%rbp), %eax
movl %eax, -0x2a4(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x20f0
jmp 0x2fe1
movl -0x2a4(%rbp), %edx
movq -0x270(%rbp), %rdi
leaq -0x238(%rbp), %rsi
leaq -0x258(%rbp), %rcx
callq 0x2d50
movl %eax, -0x2a8(%rbp)
jmp 0x3009
leaq -0x258(%rbp), %rdi
callq 0x2110
leaq -0x238(%rbp), %rdi
callq 0x2110
movl -0x2a8(%rbp), %eax
movl %eax, -0x214(%rbp)
movl -0x214(%rbp), %eax
movl %eax, -0x2ac(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x2110
leaq -0x1a0(%rbp), %rdi
callq 0x2090
movl -0x2ac(%rbp), %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x2110
jmp 0x30de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x30d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x30c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x2110
leaq -0x238(%rbp), %rdi
callq 0x2110
leaq -0x210(%rbp), %rdi
callq 0x2110
leaq -0x1a0(%rbp), %rdi
callq 0x2090
movq -0x1a8(%rbp), %rdi
callq 0x2280
nopw %cs:(%rax,%rax)