// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
cmpl $-0x1, %edi
je 0x82f2
movl %r9d, %ebp
movl %edx, %ebx
testw %r8w, %r8w
je 0x8159
testl %ecx, %ecx
je 0x8311
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movw $0x2, (%rax)
rolw $0x8, %r8w
movw %r8w, 0x2(%rax)
bswapl %ecx
movl %ecx, 0x4(%rax)
movslq %ebx, %rdx
xorl %ecx, %ecx
movq %rax, %r8
movl $0x10, %r9d
callq 0x2050
jmp 0x816b
testl %ecx, %ecx
jne 0x8330
movslq %ebx, %rdx
xorl %ecx, %ecx
callq 0x20e0
movq %rax, %r14
testl %r14d, %r14d
je 0x81ad
cmpl $-0x1, %r14d
jne 0x81c5
callq 0x2040
movl (%rax), %r14d
leal -0x6f(%r14), %eax
cmpl $0x3, %eax
jb 0x825d
movq 0x4e5b(%rip), %rbx      # 0xcff0
cmpl $0x61, %r14d
jne 0x826a
leaq 0x2447(%rip), %rsi      # 0xa5ed
movl $0x18, %edx
jmp 0x81c0
movq 0x4e3c(%rip), %rbx      # 0xcff0
leaq 0x2450(%rip), %rsi      # 0xa60b
movl $0x14, %edx
movq %rbx, %rdi
jmp 0x8231
cmpl %ebx, %r14d
sete %al
xorb $0x1, %bpl
orb %al, %bpl
jne 0x825f
movq 0x4e11(%rip), %r15      # 0xcff0
leaq 0x243a(%rip), %rsi      # 0xa620
movl $0x5, %edx
movq %r15, %rdi
callq 0x21f0
movq %r15, %rdi
movl %r14d, %esi
callq 0x22a0
movq %rax, %r14
leaq 0x241e(%rip), %rsi      # 0xa626
movl $0x8, %edx
movq %rax, %rdi
callq 0x21f0
movq %r14, %rdi
movl %ebx, %esi
callq 0x22a0
movq %rax, %rbx
leaq 0x2406(%rip), %rsi      # 0xa62f
movl $0xb, %edx
movq %rax, %rdi
callq 0x21f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2395(%rip), %rsi      # 0xa606
movl $0x4, %edx
movq %rbx, %rdi
callq 0x21f0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x22a0
movq %rax, %rbx
leaq 0x11fa(%rip), %rsi      # 0x948d
movl $0x1, %edx
movq %rax, %rdi
callq 0x21f0
movl %r14d, %edi
callq 0x20a0
testq %rax, %rax
je 0x82c8
movq %rax, %r14
movq %rax, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x21f0
jmp 0x82e1
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %rbx, %rdi
addq %rax, %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x2290
leaq 0x2315(%rip), %rsi      # 0xa5fd
movl $0x8, %edx
jmp 0x81c0
leaq 0x216d(%rip), %rdi      # 0xa466
leaq 0x217b(%rip), %rsi      # 0xa47b
leaq 0x2286(%rip), %rcx      # 0xa58d
movl $0xbb, %edx
callq 0x2120
leaq 0x22ca(%rip), %rdi      # 0xa5e2
leaq 0x215c(%rip), %rsi      # 0xa47b
leaq 0x2267(%rip), %rcx      # 0xa58d
movl $0xc7, %edx
callq 0x2120
leaq 0x22a0(%rip), %rdi      # 0xa5d7
leaq 0x213d(%rip), %rsi      # 0xa47b
leaq 0x2248(%rip), %rcx      # 0xa58d
movl $0xc1, %edx
callq 0x2120