// File: /workspace/github_cpp_makefile_star2_O1/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 0x6c05
movq %rsi, %r14
cmpw $0x0, (%rsi)
je 0x6c24
movl %r8d, %r15d
movq %rcx, 0x8(%rsp)
movl %edi, 0x4(%rsp)
leal -0x1(%r15), %r12d
cmpl $0xb, %r12d
jae 0x6bb9
movl $0x61f, %eax            # imm = 0x61F
btl %r12d, %eax
jae 0x6bb9
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 0x664e
movzbl %bpl, %ebp
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movl $0x800, %edx            # imm = 0x800
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x40bb
movl %eax, %r15d
testb %bpl, %bpl
je 0x6b81
movq 0x649f(%rip), %rbx      # 0xcfb8
leaq 0x2847(%rip), %rsi      # 0x9367
movl $0x19, %edx
movq %rbx, %rdi
callq 0x21f0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x22a0
movq %rax, %rbx
leaq 0x283f(%rip), %rsi      # 0x9381
movl $0x4, %edx
movq %rax, %rdi
callq 0x21f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3f5b
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 0x8101
movl $0x2710, %edi           # imm = 0x2710
callq 0x2240
addq $0xcd8, %rsp            # imm = 0xCD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6430(%rip), %rdi      # 0xcff0
leaq 0x3785(%rip), %rsi      # 0xa34c
callq 0x21d0
movq %rax, %rdi
movl %r15d, %esi
callq 0x22a0
leaq 0x3774(%rip), %rsi      # 0xa352
movq %rax, %rdi
callq 0x21d0
leaq 0x39fe(%rip), %rdi      # 0xa5eb
leaq 0x2b61(%rip), %rsi      # 0x9755
leaq 0x36ee(%rip), %rcx      # 0xa2e9
movl $0x6e5, %edx            # imm = 0x6E5
callq 0x2120
leaq 0x32c2(%rip), %rdi      # 0x9ece
leaq 0x2b42(%rip), %rsi      # 0x9755
leaq 0x36cf(%rip), %rcx      # 0xa2e9
movl $0x6c9, %edx            # imm = 0x6C9
callq 0x2120
leaq 0x32b2(%rip), %rdi      # 0x9edd
leaq 0x2b23(%rip), %rsi      # 0x9755
leaq 0x36b0(%rip), %rcx      # 0xa2e9
movl $0x6ca, %edx            # imm = 0x6CA
callq 0x2120