// File: /workspace/github_cpp_makefile_star2_O2/Distrotech[P]stund/udp.cxx
// Function: getMessage(int, char*, int*, unsigned int*, unsigned short*, bool)
bool 
getMessage( Socket fd, char* buf, int* len,
            unsigned int* srcIp, unsigned short* srcPort,
            bool verbose)
{
   assert( fd != INVALID_SOCKET );
	
   int originalSize = *len;
   assert( originalSize > 0 );
   
   struct sockaddr_in from;
   int fromLen = sizeof(from);
	
   *len = recvfrom(fd,
                   buf,
                   originalSize,
                   0,
                   (struct sockaddr *)&from,
                   (socklen_t*)&fromLen);
	
   if ( *len == SOCKET_ERROR )
   {
      int err = getErrno();
		
      switch (err)
      {
         case ENOTSOCK:
            cerr << "Error fd not a socket" <<   endl;
            break;
         case ECONNRESET:
            cerr << "Error connection reset - host not reachable" <<   endl;
            break;
				
         default:
            cerr << "Socket Error=" << err << endl;
      }
		
      return false;
   }
	
   if ( *len < 0 )
   {
      clog << "socket closed? negative len" << endl;
      return false;
   }
    
   if ( *len == 0 )
   {
      clog << "socket closed? zero len" << endl;
      return false;
   }
    
   *srcPort = ntohs(from.sin_port);
   *srcIp = ntohl(from.sin_addr.s_addr);
	
   if ( (*len)+1 >= originalSize )
   {
      if (verbose)
      {
         clog << "Received a message that was too large" << endl;
      }
      return false;
   }
   buf[*len]=0;
    
   return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $-0x1, %edi
je 0x6b30
movq %rdx, %r15
movslq (%rdx), %r13
testq %r13, %r13
jle 0x6b49
movl %r9d, %ebx
movq %r8, %rbp
movq %rcx, %r12
movq %rsi, %r14
leaq 0x4(%rsp), %r9
movl $0x10, (%r9)
leaq 0x8(%rsp), %r8
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x2160
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x6a97
testl %eax, %eax
js 0x6ab8
je 0x6ac8
movzwl 0xa(%rsp), %eax
rolw $0x8, %ax
movw %ax, (%rbp)
movl 0xc(%rsp), %eax
bswapl %eax
movl %eax, (%r12)
movslq (%r15), %rax
leal 0x1(%rax), %ecx
cmpl %r13d, %ecx
jge 0x6b00
movb $0x0, (%r14,%rax)
movb $0x1, %al
jmp 0x6b21
callq 0x67e9
cmpl $0x68, %eax
je 0x6ad8
movl %eax, %ebx
movq 0x4546(%rip), %rdi      # 0xaff0
cmpl $0x58, %eax
jne 0x6ae8
leaq 0x1a2d(%rip), %rsi      # 0x84e3
jmp 0x6b12
movq 0x44f9(%rip), %rdi      # 0xafb8
leaq 0x1a6d(%rip), %rsi      # 0x8533
jmp 0x6b12
movq 0x44e9(%rip), %rdi      # 0xafb8
leaq 0x1a79(%rip), %rsi      # 0x854f
jmp 0x6b12
movq 0x4511(%rip), %rdi      # 0xaff0
leaq 0x1a13(%rip), %rsi      # 0x84f9
jmp 0x6b12
leaq 0x1a36(%rip), %rsi      # 0x8525
callq 0x21d0
movq %rax, %rdi
movl %ebx, %esi
callq 0x22a0
jmp 0x6b17
testb %bl, %bl
je 0x6b1f
movq 0x44ad(%rip), %rdi      # 0xafb8
leaq 0x1a55(%rip), %rsi      # 0x8567
callq 0x21d0
movq %rax, %rdi
callq 0x20c0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x192f(%rip), %rdi      # 0x8466
leaq 0x193d(%rip), %rsi      # 0x847b
leaq 0x193e(%rip), %rcx      # 0x8483
pushq $0x76
jmp 0x6b60
leaq 0x1982(%rip), %rdi      # 0x84d2
leaq 0x1924(%rip), %rsi      # 0x847b
leaq 0x1925(%rip), %rcx      # 0x8483
pushq $0x79
popq %rdx
callq 0x2120