// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunTest(StunAddress4&, int, bool, StunAddress4*)
void 
stunTest( StunAddress4& dest, int testNum, bool verbose, StunAddress4* sAddr )
{ 
   assert( dest.addr != 0 );
   assert( dest.port != 0 );
	
   int port = stunRandomPort();
   UInt32 interfaceIp=0;
   if (sAddr)
   {
      interfaceIp = sAddr->addr;
      if ( sAddr->port != 0 )
      {
        port = sAddr->port;
      }
   }
   Socket myFd = openPort(port,interfaceIp,verbose);
	
   StunAtrString username;
   StunAtrString password;
	
   username.sizeValue = 0;
   password.sizeValue = 0;
	
#ifdef USE_TLS
   stunGetUserNameAndPassword( dest, username, password );
#endif
	
   stunSendTest( myFd, dest, username, password, testNum, verbose );
    
   char msg[STUN_MAX_MESSAGE_SIZE];
   int msgLen = STUN_MAX_MESSAGE_SIZE;
	
   StunAddress4 from;
   getMessage( myFd,
               msg,
               &msgLen,
               &from.addr,
               &from.port,verbose );
	
   StunMessage resp;
   memset(&resp, 0, sizeof(StunMessage));
	
   if ( verbose ) clog << "Got a response" << endl;
   bool ok = stunParseMessage( msg,msgLen, resp,verbose );
	
   if ( verbose )
   {
      clog << "\t ok=" << ok << endl;
      clog << "\t id=" << resp.msgHdr.id << endl;
      clog << "\t mappedAddr=" << resp.mappedAddress.ipv4 << endl;
      clog << "\t changedAddr=" << resp.changedAddress.ipv4 << endl;
      clog << endl;
   }
	
   if (sAddr)
   {
      sAddr->port = resp.mappedAddress.ipv4.port;
      sAddr->addr = resp.mappedAddress.ipv4.addr;
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xee0, %rsp            # imm = 0xEE0
cmpl $0x0, 0x4(%rdi)
je 0x6ab7
movq %rdi, %r14
cmpw $0x0, (%rdi)
je 0x6ad6
movq %rcx, %rbx
movl %edx, %r15d
movl %esi, %ebp
callq 0x4b28
andl $0x3fff, %eax           # imm = 0x3FFF
orl $0x4000, %eax           # imm = 0x4000
testq %rbx, %rbx
je 0x684b
movl 0x4(%rbx), %esi
movzwl (%rbx), %ecx
testl %ecx, %ecx
cmovnel %ecx, %eax
jmp 0x684d
xorl %esi, %esi
movzbl %r15b, %r15d
movl %eax, %edi
movl %r15d, %edx
callq 0x7c14
movl %eax, %r12d
xorl %eax, %eax
leaq 0x5de(%rsp), %rdx
movw %ax, 0x100(%rdx)
leaq 0x4dc(%rsp), %rcx
movw %ax, 0x100(%rcx)
movl %r12d, %edi
movq %r14, %rsi
movl %ebp, %r8d
movl %r15d, %r9d
callq 0x6af5
leaq 0x8(%rsp), %rdx
movl $0x800, (%rdx)          # imm = 0x800
leaq 0x10(%rsp), %rcx
leaq 0x6e0(%rsp), %rsi
leaq 0xc(%rsp), %r8
movl %r12d, %edi
movl %r15d, %r9d
callq 0x7f81
leaq 0x14(%rsp), %rdi
movl $0x4c8, %edx            # imm = 0x4C8
xorl %esi, %esi
callq 0x2110
testb %r15b, %r15b
je 0x6a7b
movq 0x66e0(%rip), %r14      # 0xcfb8
leaq 0x369a(%rip), %rsi      # 0x9f79
movl $0xe, %edx
movq %r14, %rdi
callq 0x21f0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
movl 0x8(%rsp), %esi
leaq 0x6e0(%rsp), %rdi
leaq 0x14(%rsp), %rdx
movl $0x1, %ecx
callq 0x31ac
movl %eax, %ebp
leaq 0x3651(%rip), %rsi      # 0x9f88
movl $0x5, %edx
movq %r14, %rdi
callq 0x21f0
movzbl %bpl, %esi
movq %r14, %rdi
callq 0x2270
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x360d(%rip), %rsi      # 0x9f8e
movl $0x5, %edx
movq %r14, %rdi
callq 0x21f0
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x4d91
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x35cb(%rip), %rsi      # 0x9f94
movl $0xd, %edx
movq %r14, %rdi
callq 0x21f0
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x3dbb
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x3591(%rip), %rsi      # 0x9fa2
movl $0xe, %edx
movq %r14, %rdi
callq 0x21f0
leaq 0x68(%rsp), %rsi
movq %r14, %rdi
callq 0x3dbb
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
jmp 0x6a93
movl 0x8(%rsp), %esi
leaq 0x6e0(%rsp), %rdi
leaq 0x14(%rsp), %rdx
xorl %ecx, %ecx
callq 0x31ac
testq %rbx, %rbx
je 0x6aa7
movzwl 0x30(%rsp), %eax
movw %ax, (%rbx)
movl 0x34(%rsp), %eax
movl %eax, 0x4(%rbx)
addq $0xee0, %rsp            # imm = 0xEE0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3408(%rip), %rdi      # 0x9ec6
leaq 0x2c88(%rip), %rsi      # 0x974d
leaq 0x3474(%rip), %rcx      # 0x9f40
movl $0x716, %edx            # imm = 0x716
callq 0x2120
leaq 0x33f8(%rip), %rdi      # 0x9ed5
leaq 0x2c69(%rip), %rsi      # 0x974d
leaq 0x3455(%rip), %rcx      # 0x9f40
movl $0x717, %edx            # imm = 0x717
callq 0x2120