// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunSendTest(int, StunAddress4&, StunAtrString const&, StunAtrString const&, int, bool)
static void 
stunSendTest( Socket myFd, StunAddress4& dest, 
              const StunAtrString& username, const StunAtrString& password, 
              int testNum, bool verbose )
{ 
   assert( dest.addr != 0 );
   assert( dest.port != 0 );
	
   bool changePort=false;
   bool changeIP=false;
   bool discard=false;
	
   switch (testNum)
   {
      case 1:
      case 10:
      case 11:
         break;
      case 2:
         //changePort=true;
         changeIP=true;
         break;
      case 3:
         changePort=true;
         break;
      case 4:
         changeIP=true;
         break;
      case 5:
         discard=true;
         break;
      default:
         cerr << "Test " << testNum <<" is unkown\n";
         assert(0);
   }
	
   StunMessage req;
   memset(&req, 0, sizeof(StunMessage));
	
   stunBuildReqSimple( &req, username, 
                       changePort , changeIP , 
                       testNum );
	
   char buf[STUN_MAX_MESSAGE_SIZE];
   int len = STUN_MAX_MESSAGE_SIZE;
	
   len = stunEncodeMessage( req, buf, len, password,verbose );
	
   if ( verbose )
   {
      clog << "About to send msg of len " << len << " to " << dest << endl;
   }
	
   sendMessage( myFd, buf, len, dest.addr, dest.port, verbose );
	
   // add some delay so the packets don't get sent too quickly 
#ifdef WIN32 // !cj! TODO - should fix this up in windows
		 clock_t now = clock();
		 assert( CLOCKS_PER_SEC == 1000 );
		 while ( clock() <= now+10 ) { };
#else
		 usleep(10*1000);
#endif

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xcd8, %rsp            # imm = 0xCD8
cmpl $0x0, 0x4(%rsi)
je 0x6ca6
movq %rsi, %r14
cmpw $0x0, (%rsi)
je 0x6cc5
movl %r8d, %r15d
movq %rcx, 0x8(%rsp)
movl %edi, 0x4(%rsp)
leal -0x1(%r15), %r12d
cmpl $0xb, %r12d
jae 0x6c5a
movl $0x61f, %eax            # imm = 0x61F
btl %r12d, %eax
jae 0x6c5a
movl %r9d, %ebp
movq %rdx, %r13
leaq 0x810(%rsp), %rbx
movl $0x4c8, %edx            # imm = 0x4C8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2110
movl $0x4, %eax
xorl %edx, %edx
btl %r12d, %eax
setb %dl
movl $0xa, %eax
xorl %ecx, %ecx
btl %r12d, %eax
setb %cl
movq %rbx, %rdi
movq %r13, %rsi
movl %r15d, %r8d
callq 0x66de
movzbl %bpl, %ebp
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movl $0x800, %edx            # imm = 0x800
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x3f1b
movl %eax, %r15d
testb %bpl, %bpl
je 0x6c22
movq 0x63fe(%rip), %rbx      # 0xcfb8
leaq 0x279d(%rip), %rsi      # 0x935e
movl $0x19, %edx
movq %rbx, %rdi
callq 0x21f0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2290
movq %rax, %rbx
leaq 0x2795(%rip), %rsi      # 0x9378
movl $0x4, %edx
movq %rax, %rdi
callq 0x21f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3dbb
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
movl 0x4(%r14), %ecx
movzwl (%r14), %r8d
leaq 0x10(%rsp), %rsi
movl 0x4(%rsp), %edi
movl %r15d, %edx
movl %ebp, %r9d
callq 0x8138
movl $0x2710, %edi           # imm = 0x2710
callq 0x2230
addq $0xcd8, %rsp            # imm = 0xCD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x638f(%rip), %rdi      # 0xcff0
leaq 0x36dc(%rip), %rsi      # 0xa344
callq 0x21d0
movq %rax, %rdi
movl %r15d, %esi
callq 0x2290
leaq 0x36cb(%rip), %rsi      # 0xa34a
movq %rax, %rdi
callq 0x21d0
leaq 0x395d(%rip), %rdi      # 0xa5eb
leaq 0x2ab8(%rip), %rsi      # 0x974d
leaq 0x3645(%rip), %rcx      # 0xa2e1
movl $0x6e5, %edx            # imm = 0x6E5
callq 0x2120
leaq 0x3219(%rip), %rdi      # 0x9ec6
leaq 0x2a99(%rip), %rsi      # 0x974d
leaq 0x3626(%rip), %rcx      # 0xa2e1
movl $0x6c9, %edx            # imm = 0x6C9
callq 0x2120
leaq 0x3209(%rip), %rdi      # 0x9ed5
leaq 0x2a7a(%rip), %rsi      # 0x974d
leaq 0x3607(%rip), %rcx      # 0xa2e1
movl $0x6ca, %edx            # imm = 0x6CA
callq 0x2120