// File: /workspace/github_cpp_makefile_star2_O1/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 0x80c3
movq %rdx, %r15
movslq (%rdx), %r13
testq %r13, %r13
jle 0x80e2
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 0x7fd7
testl %eax, %eax
js 0x8000
je 0x8015
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 0x806c
movb $0x0, (%r14,%rax)
movb $0x1, %al
jmp 0x80b4
callq 0x2040
movl (%rax), %ebx
cmpl $0x68, %ebx
je 0x802a
cmpl $0x58, %ebx
jne 0x803f
movq 0x5001(%rip), %rbx      # 0xcff0
leaq 0x24ed(%rip), %rsi      # 0xa4e3
movl $0x15, %edx
jmp 0x8083
movq 0x4fb1(%rip), %rbx      # 0xcfb8
leaq 0x2525(%rip), %rsi      # 0xa533
movl $0x1b, %edx
jmp 0x8083
movq 0x4f9c(%rip), %rbx      # 0xcfb8
leaq 0x252c(%rip), %rsi      # 0xa54f
movl $0x17, %edx
jmp 0x8083
movq 0x4fbf(%rip), %rbx      # 0xcff0
leaq 0x24c1(%rip), %rsi      # 0xa4f9
movl $0x2b, %edx
jmp 0x8083
movq 0x4faa(%rip), %r14      # 0xcff0
leaq 0x24d8(%rip), %rsi      # 0xa525
movl $0xd, %edx
movq %r14, %rdi
callq 0x21f0
movq %r14, %rdi
movl %ebx, %esi
callq 0x22a0
movq %rax, %rbx
movq (%rax), %rax
jmp 0x808e
testb %bl, %bl
je 0x80b2
movq 0x4f41(%rip), %rbx      # 0xcfb8
leaq 0x24e9(%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 0x239c(%rip), %rdi      # 0xa466
leaq 0x23aa(%rip), %rsi      # 0xa47b
leaq 0x23ab(%rip), %rcx      # 0xa483
movl $0x76, %edx
callq 0x2120
leaq 0x23e9(%rip), %rdi      # 0xa4d2
leaq 0x238b(%rip), %rsi      # 0xa47b
leaq 0x238c(%rip), %rcx      # 0xa483
movl $0x79, %edx
callq 0x2120