// File: /workspace/github_cpp_makefile_star2_O3/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 0x80fa
movq %rdx, %r15
movslq (%rdx), %r13
testq %r13, %r13
jle 0x8119
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 0x800e
testl %eax, %eax
js 0x8037
je 0x804c
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 0x80a3
movb $0x0, (%r14,%rax)
movb $0x1, %al
jmp 0x80eb
callq 0x2040
movl (%rax), %ebx
cmpl $0x68, %ebx
je 0x8061
cmpl $0x58, %ebx
jne 0x8076
movq 0x4fca(%rip), %rbx      # 0xcff0
leaq 0x24b6(%rip), %rsi      # 0xa4e3
movl $0x15, %edx
jmp 0x80ba
movq 0x4f7a(%rip), %rbx      # 0xcfb8
leaq 0x24ee(%rip), %rsi      # 0xa533
movl $0x1b, %edx
jmp 0x80ba
movq 0x4f65(%rip), %rbx      # 0xcfb8
leaq 0x24f5(%rip), %rsi      # 0xa54f
movl $0x17, %edx
jmp 0x80ba
movq 0x4f88(%rip), %rbx      # 0xcff0
leaq 0x248a(%rip), %rsi      # 0xa4f9
movl $0x2b, %edx
jmp 0x80ba
movq 0x4f73(%rip), %r14      # 0xcff0
leaq 0x24a1(%rip), %rsi      # 0xa525
movl $0xd, %edx
movq %r14, %rdi
callq 0x21f0
movq %r14, %rdi
movl %ebx, %esi
callq 0x2290
movq %rax, %rbx
movq (%rax), %rax
jmp 0x80c5
testb %bl, %bl
je 0x80e9
movq 0x4f0a(%rip), %rbx      # 0xcfb8
leaq 0x24b2(%rip), %rsi      # 0xa567
movl $0x25, %edx
movq %rbx, %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 %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2365(%rip), %rdi      # 0xa466
leaq 0x2373(%rip), %rsi      # 0xa47b
leaq 0x2374(%rip), %rcx      # 0xa483
movl $0x76, %edx
callq 0x2120
leaq 0x23b2(%rip), %rdi      # 0xa4d2
leaq 0x2354(%rip), %rsi      # 0xa47b
leaq 0x2355(%rip), %rcx      # 0xa483
movl $0x79, %edx
callq 0x2120