// File: /workspace/github_cpp_makefile_star2_O2/Distrotech[P]stund/udp.cxx
// Function: sendMessage(int, char*, int, unsigned int, unsigned short, bool)
bool 
sendMessage( Socket fd, char* buf, int l, 
             unsigned int dstIp, unsigned short dstPort,
             bool verbose)
{
   assert( fd != INVALID_SOCKET );
    
   int s;
   if ( dstPort == 0 )
   {
      // sending on a connected port 
      assert( dstIp == 0 );
		
      s = send(fd,buf,l,0);
   }
   else
   {
      assert( dstIp != 0 );
      assert( dstPort != 0 );
        
      struct sockaddr_in to;
      int toLen = sizeof(to);
      memset(&to,0,toLen);
        
      to.sin_family = AF_INET;
      to.sin_port = htons(dstPort);
      to.sin_addr.s_addr = htonl(dstIp);
        
      s = sendto(fd, buf, l, 0,(sockaddr*)&to, toLen);
   }
    
   if ( s == SOCKET_ERROR )
   {
      int e = getErrno();
      switch (e)
      {
         case ECONNREFUSED:
         case EHOSTDOWN:
         case EHOSTUNREACH:
         {
            // quietly ignore this 
         }
         break;
         case EAFNOSUPPORT:
         {
            cerr << "err EAFNOSUPPORT in send" << endl;
         }
         break;
         default:
         {
            cerr << "err " << e << " "  << strerror(e) << " in send" << endl;
         }
      }
      return false;
   }
    
   if ( s == 0 )
   {
      cerr << "no data sent in send" << endl;
      return false;
   }
    
   if ( s != l )
   {
      if (verbose)
      {
         cerr << "only " << s << " out of " << l << " bytes sent" << endl;
      }
      return false;
   }
    
   return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpl $-0x1, %edi
je 0x6cc6
movl %r9d, %ebp
movl %edx, %ebx
testw %r8w, %r8w
je 0x6bb9
testl %ecx, %ecx
je 0x6ce5
movq %rsp, %rax
andq $0x0, 0x8(%rax)
movw $0x2, (%rax)
rolw $0x8, %r8w
movw %r8w, 0x2(%rax)
bswapl %ecx
movl %ecx, 0x4(%rax)
movslq %ebx, %rdx
pushq $0x10
popq %r9
xorl %ecx, %ecx
movq %rax, %r8
callq 0x2040
jmp 0x6bcb
testl %ecx, %ecx
jne 0x6d04
movslq %ebx, %rdx
xorl %ecx, %ecx
callq 0x20d0
movq %rax, %r14
testl %r14d, %r14d
je 0x6c04
cmpl $-0x1, %r14d
jne 0x6c17
callq 0x67e9
movl %eax, %ebx
leal -0x6f(%rbx), %eax
cmpl $0x3, %eax
jb 0x6cbb
movq 0x43fd(%rip), %rdi      # 0xaff0
cmpl $0x61, %ebx
jne 0x6c6a
leaq 0x19ee(%rip), %rsi      # 0x85ed
jmp 0x6cae
movq 0x43e5(%rip), %rdi      # 0xaff0
leaq 0x19f9(%rip), %rsi      # 0x860b
jmp 0x6cae
cmpl %ebx, %r14d
sete %al
xorb $0x1, %bpl
orb %al, %bpl
jne 0x6cbd
movq 0x43bf(%rip), %rdi      # 0xaff0
leaq 0x19e8(%rip), %rsi      # 0x8620
callq 0x21d0
movq %rax, %rdi
movl %r14d, %esi
callq 0x22a0
leaq 0x19d7(%rip), %rsi      # 0x8626
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
movl %ebx, %esi
callq 0x22a0
leaq 0x19c7(%rip), %rsi      # 0x862f
jmp 0x6cab
leaq 0x1995(%rip), %rsi      # 0x8606
callq 0x21d0
movq %rax, %rdi
movl %ebx, %esi
callq 0x22a0
leaq 0x7fe(%rip), %rsi       # 0x7485
movq %rax, %rdi
callq 0x21d0
movq %rax, %r14
movl %ebx, %edi
callq 0x2090
movq %r14, %rdi
movq %rax, %rsi
callq 0x21d0
leaq 0x1952(%rip), %rsi      # 0x85fd
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x20c0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1799(%rip), %rdi      # 0x8466
leaq 0x17a7(%rip), %rsi      # 0x847b
leaq 0x18b2(%rip), %rcx      # 0x858d
movl $0xbb, %edx
callq 0x2120
leaq 0x18f6(%rip), %rdi      # 0x85e2
leaq 0x1788(%rip), %rsi      # 0x847b
leaq 0x1893(%rip), %rcx      # 0x858d
movl $0xc7, %edx
callq 0x2120
leaq 0x18cc(%rip), %rdi      # 0x85d7
leaq 0x1769(%rip), %rsi      # 0x847b
leaq 0x1874(%rip), %rcx      # 0x858d
movl $0xc1, %edx
callq 0x2120