// File: /workspace/github_cpp_makefile_star2_O1/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 0x6a16
movq %rdi, %r15
cmpw $0x0, (%rdi)
je 0x6a35
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
callq 0x4b17
andl $0x3fff, %eax           # imm = 0x3FFF
orl $0x4000, %eax           # imm = 0x4000
testq %rbx, %rbx
je 0x67bb
movl 0x4(%rbx), %esi
movzwl (%rbx), %ecx
testl %ecx, %ecx
cmovnel %ecx, %eax
jmp 0x67bd
xorl %esi, %esi
movzbl %bpl, %ebp
movl %eax, %edi
movl %ebp, %edx
callq 0x7c10
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 %r15, %rsi
movl %r14d, %r8d
movl %ebp, %r9d
callq 0x6a54
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 %ebp, %r9d
callq 0x7f4a
leaq 0x14(%rsp), %rdi
movl $0x4c8, %edx            # imm = 0x4C8
xorl %esi, %esi
callq 0x2110
testb %bpl, %bpl
je 0x687e
movq 0x6775(%rip), %r14      # 0xcfb8
leaq 0x3737(%rip), %rsi      # 0x9f81
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 %ebp, %ecx
callq 0x3248
testb %bpl, %bpl
je 0x69f2
movl %eax, %r15d
movq 0x670f(%rip), %r14      # 0xcfb8
leaq 0x36e0(%rip), %rsi      # 0x9f90
movl $0x5, %edx
movq %r14, %rdi
callq 0x21f0
movzbl %r15b, %esi
movq %r14, %rdi
callq 0x2280
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 0x369c(%rip), %rsi      # 0x9f96
movl $0x5, %edx
movq %r14, %rdi
callq 0x21f0
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x4d80
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 0x365a(%rip), %rsi      # 0x9f9c
movl $0xd, %edx
movq %r14, %rdi
callq 0x21f0
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x3f5b
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 0x3620(%rip), %rsi      # 0x9faa
movl $0xe, %edx
movq %r14, %rdi
callq 0x21f0
leaq 0x68(%rsp), %rsi
movq %r14, %rdi
callq 0x3f5b
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
testq %rbx, %rbx
je 0x6a06
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 0x34b1(%rip), %rdi      # 0x9ece
leaq 0x2d31(%rip), %rsi      # 0x9755
leaq 0x351d(%rip), %rcx      # 0x9f48
movl $0x716, %edx            # imm = 0x716
callq 0x2120
leaq 0x34a1(%rip), %rdi      # 0x9edd
leaq 0x2d12(%rip), %rsi      # 0x9755
leaq 0x34fe(%rip), %rcx      # 0x9f48
movl $0x717, %edx            # imm = 0x717
callq 0x2120