// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunServerProcess(StunServerInfo&, bool)
bool
stunServerProcess(StunServerInfo& info, bool verbose)
{
   char msg[STUN_MAX_MESSAGE_SIZE];
   int msgLen = sizeof(msg);
   	
   bool ok = false;
   bool recvAltIp =false;
   bool recvAltPort = false;
	
   fd_set fdSet; 
   Socket maxFd=0;

   FD_ZERO(&fdSet); 
   FD_SET(info.myFd,&fdSet); 
   if ( info.myFd >= maxFd ) maxFd=info.myFd+1;
   FD_SET(info.altPortFd,&fdSet); 
   if ( info.altPortFd >= maxFd ) maxFd=info.altPortFd+1;

   if ( info.altIpFd != INVALID_SOCKET )
   {
      FD_SET(info.altIpFd,&fdSet);
      if (info.altIpFd>=maxFd) maxFd=info.altIpFd+1;
   }
   if ( info.altIpPortFd != INVALID_SOCKET )
   {
      FD_SET(info.altIpPortFd,&fdSet);
      if (info.altIpPortFd>=maxFd) maxFd=info.altIpPortFd+1;
   }

   if (info.relay)
   {
      for (int i=0; i<MAX_MEDIA_RELAYS; ++i)
      {
         StunMediaRelay* relay = &info.relays[i];
         if (relay->fd)
         {
            FD_SET(relay->fd, &fdSet);
            if (relay->fd >= maxFd) 
			{
				maxFd=relay->fd+1;
			}
         }
      }
   }
   
   if ( info.altIpFd != INVALID_SOCKET )
   {
      FD_SET(info.altIpFd,&fdSet);
      if (info.altIpFd>=maxFd) maxFd=info.altIpFd+1;
   }
   if ( info.altIpPortFd != INVALID_SOCKET )
   {
      FD_SET(info.altIpPortFd,&fdSet);
      if (info.altIpPortFd>=maxFd) maxFd=info.altIpPortFd+1;
   }
   
   struct timeval tv;
   tv.tv_sec = 0;
   tv.tv_usec = 1000;
	
   int e = select( maxFd, &fdSet, NULL,NULL, &tv );
   if (e < 0)
   {
      int err = getErrno();
      clog << "Error on select: " << strerror(err) << endl;
   }
   else if (e >= 0)
   {
      StunAddress4 from;

      // do the media relaying
      if (info.relay)
      {
         time_t now = time(0);
         for (int i=0; i<MAX_MEDIA_RELAYS; ++i)
         {
            StunMediaRelay* relay = &info.relays[i];
            if (relay->fd)
            {
               if (FD_ISSET(relay->fd, &fdSet))
               {
                  char msg[MAX_RTP_MSG_SIZE];
                  int msgLen = sizeof(msg);
                  
                  StunAddress4 rtpFrom;
                  ok = getMessage( relay->fd, msg, &msgLen, &rtpFrom.addr, &rtpFrom.port ,verbose);
                  if (ok)
                  {
                     sendMessage(info.myFd, msg, msgLen, relay->destination.addr, relay->destination.port, verbose);
                     relay->expireTime = now + MEDIA_RELAY_TIMEOUT;
                     if ( verbose ) clog << "Relay packet on " 
                                         << relay->fd 
                                         << " from " << rtpFrom 
                                         << " -> " << relay->destination 
                                         << endl;
                  }
               }
               else if (now > relay->expireTime)
               {
                  closesocket(relay->fd);
                  relay->fd = 0;
               }
            }
         }
      }
      
     
      if (FD_ISSET(info.myFd,&fdSet))
      {
         if (verbose) clog << "received on A1:P1" << endl;
         recvAltIp = false;
         recvAltPort = false;
         ok = getMessage( info.myFd, msg, &msgLen, &from.addr, &from.port,verbose );
      }
      else if (FD_ISSET(info.altPortFd, &fdSet))
      {
         if (verbose) clog << "received on A1:P2" << endl;
         recvAltIp = false;
         recvAltPort = true;
         ok = getMessage( info.altPortFd, msg, &msgLen, &from.addr, &from.port,verbose );
      }
      else if ( (info.altIpFd!=INVALID_SOCKET) && FD_ISSET(info.altIpFd,&fdSet))
      {
         if (verbose) clog << "received on A2:P1" << endl;
         recvAltIp = true;
         recvAltPort = false;
         ok = getMessage( info.altIpFd, msg, &msgLen, &from.addr, &from.port ,verbose);
      }
      else if ( (info.altIpPortFd!=INVALID_SOCKET) && FD_ISSET(info.altIpPortFd, &fdSet))
      {
         if (verbose) clog << "received on A2:P2" << endl;
         recvAltIp = true;
         recvAltPort = true;
         ok = getMessage( info.altIpPortFd, msg, &msgLen, &from.addr, &from.port,verbose );
      }
      else
      {
         return true;
      }

      int relayPort = 0;
      if (info.relay)
      {
         for (int i=0; i<MAX_MEDIA_RELAYS; ++i)
         {
            StunMediaRelay* relay = &info.relays[i];
            if (relay->destination.addr == from.addr && 
                relay->destination.port == from.port)
            {
               relayPort = relay->relayPort;
               relay->expireTime = time(0) + MEDIA_RELAY_TIMEOUT;
               break;
            }
         }

         if (relayPort == 0)
         {
            for (int i=0; i<MAX_MEDIA_RELAYS; ++i)
            {
               StunMediaRelay* relay = &info.relays[i];
               if (relay->fd == 0)
               {
                  if ( verbose ) clog << "Open relay port " << relay->relayPort << endl;
                  
                  relay->fd = openPort(relay->relayPort, info.myAddr.addr, verbose);
                  relay->destination.addr = from.addr;
                  relay->destination.port = from.port;
                  relay->expireTime = time(0) + MEDIA_RELAY_TIMEOUT;
                  relayPort = relay->relayPort;
                  break;
               }
            }
         }
      }
         
      if ( !ok ) 
      {
         if ( verbose ) clog << "Get message did not return a valid message" <<endl;
         return true;
      }
		
      if ( verbose ) clog << "Got a request (len=" << msgLen << ") from " << from << endl;
		
      if ( msgLen <= 0 )
      {
         return true;
      }
		
      bool changePort = false;
      bool changeIp = false;
		
      StunMessage resp;
      StunAddress4 dest;
      StunAtrString hmacPassword;  
      hmacPassword.sizeValue = 0;

      StunAddress4 secondary;
      secondary.port = 0;
      secondary.addr = 0;
               
      if (info.relay && relayPort)
      {
         secondary = from;
         
         from.addr = info.myAddr.addr;
         from.port = relayPort;
      }
      
      ok = stunServerProcessMsg( msg, msgLen, from, secondary,
                                 recvAltIp ? info.altAddr : info.myAddr,
                                 recvAltIp ? info.myAddr : info.altAddr, 
                                 &resp,
                                 &dest,
                                 &hmacPassword,
                                 &changePort,
                                 &changeIp,
                                 verbose );
		
      if ( !ok )
      {
         if ( verbose ) clog << "Failed to parse message" << endl;
         return true;
      }
		
      char buf[STUN_MAX_MESSAGE_SIZE];
      int len = sizeof(buf);
      		
      len = stunEncodeMessage( resp, buf, len, hmacPassword,verbose );
		
      if ( dest.addr == 0 )  ok=false;
      if ( dest.port == 0 ) ok=false;
		
      if ( ok )
      {
         assert( dest.addr != 0 );
         assert( dest.port != 0 );
			
         Socket sendFd;
			
         bool sendAltIp   = recvAltIp;   // send on the received IP address 
         bool sendAltPort = recvAltPort; // send on the received port
			
         if ( changeIp )   sendAltIp   = !sendAltIp;   // if need to change IP, then flip logic 
         if ( changePort ) sendAltPort = !sendAltPort; // if need to change port, then flip logic 
			
         if ( !sendAltPort )
         {
            if ( !sendAltIp )
            {
               sendFd = info.myFd;
            }
            else
            {
               sendFd = info.altIpFd;
            }
         }
         else
         {
            if ( !sendAltIp )
            {
               sendFd = info.altPortFd;
            }
            else
            {
               sendFd = info.altIpPortFd;
            }
         }
	
         if ( sendFd != INVALID_SOCKET )
         {
            sendMessage( sendFd, buf, len, dest.addr, dest.port, verbose );
         }
      }
   }
	
   return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x16b8, %rsp           # imm = 0x16B8
movq %rdi, %rbx
movl $0x800, 0x1c(%rsp)      # imm = 0x800
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movl 0x10(%rdi), %ecx
leal 0x3f(%rcx), %edx
xorl %eax, %eax
testl %ecx, %ecx
cmovnsl %ecx, %edx
leal 0x1(%rcx), %edi
cmovnsl %edi, %eax
movl %edx, %edi
andl $-0x40, %edi
subl %edi, %ecx
movl $0x1, %edi
shlq %cl, %rdi
sarl $0x6, %edx
movslq %edx, %rcx
orq %rdi, 0x50(%rsp,%rcx,8)
movl 0x14(%rbx), %r8d
leal 0x3f(%r8), %edx
testl %r8d, %r8d
cmovnsl %r8d, %edx
movl %edx, %edi
andl $-0x40, %edi
movl %r8d, %ecx
subl %edi, %ecx
movl $0x1, %edi
shlq %cl, %rdi
sarl $0x6, %edx
movslq %edx, %rcx
orq %rdi, 0x50(%rsp,%rcx,8)
movl %esi, 0x4(%rsp)
movl $0x1, %edx
leal 0x1(%r8), %edi
cmpl %eax, %r8d
cmovll %eax, %edi
movl 0x18(%rbx), %eax
cmpl $-0x1, %eax
je 0x5d54
leal 0x3f(%rax), %esi
testl %eax, %eax
cmovnsl %eax, %esi
movl %esi, %r8d
andl $-0x40, %r8d
movl %eax, %ecx
subl %r8d, %ecx
shlq %cl, %rdx
sarl $0x6, %esi
movslq %esi, %rcx
orq %rdx, 0x50(%rsp,%rcx,8)
leal 0x1(%rax), %ecx
cmpl %edi, %eax
cmovgel %ecx, %edi
movl 0x1c(%rbx), %edx
cmpl $-0x1, %edx
je 0x5d8c
leal 0x3f(%rdx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
movl %esi, %r8d
andl $-0x40, %r8d
movl %edx, %ecx
subl %r8d, %ecx
movl $0x1, %r8d
shlq %cl, %r8
sarl $0x6, %esi
movslq %esi, %rcx
orq %r8, 0x50(%rsp,%rcx,8)
leal 0x1(%rdx), %ecx
cmpl %edi, %edx
cmovgel %ecx, %edi
cmpb $0x1, 0x20(%rbx)
jne 0x5de4
movl $0x2c, %esi
movl (%rbx,%rsi), %r8d
testl %r8d, %r8d
je 0x5dd7
leal 0x3f(%r8), %r9d
testl %r8d, %r8d
cmovnsl %r8d, %r9d
movl %r9d, %r10d
andl $-0x40, %r10d
movl %r8d, %ecx
subl %r10d, %ecx
movl $0x1, %r10d
shlq %cl, %r10
sarl $0x6, %r9d
movslq %r9d, %rcx
orq %r10, 0x50(%rsp,%rcx,8)
leal 0x1(%r8), %ecx
cmpl %edi, %r8d
cmovgel %ecx, %edi
addq $0x18, %rsi
cmpq $0x2f0c, %rsi           # imm = 0x2F0C
jne 0x5d97
cmpl $-0x1, %eax
je 0x5e19
leal 0x3f(%rax), %esi
testl %eax, %eax
cmovnsl %eax, %esi
movl %esi, %r8d
andl $-0x40, %r8d
movl %eax, %ecx
subl %r8d, %ecx
movl $0x1, %r8d
shlq %cl, %r8
sarl $0x6, %esi
movslq %esi, %rcx
orq %r8, 0x50(%rsp,%rcx,8)
leal 0x1(%rax), %ecx
cmpl %edi, %eax
cmovgel %ecx, %edi
cmpl $-0x1, %edx
je 0x5e49
leal 0x3f(%rdx), %eax
testl %edx, %edx
cmovnsl %edx, %eax
movl %eax, %esi
andl $-0x40, %esi
movl %edx, %ecx
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
sarl $0x6, %eax
cltq
orq %rsi, 0x50(%rsp,%rax,8)
leal 0x1(%rdx), %eax
cmpl %edi, %edx
cmovgel %eax, %edi
leaq 0xd0(%rsp), %r8
movq $0x0, (%r8)
movq $0x3e8, 0x8(%r8)        # imm = 0x3E8
leaq 0x50(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x21a0
testl %eax, %eax
js 0x6142
leaq 0x10(%rbx), %rax
movq %rax, 0x30(%rsp)
cmpb $0x1, 0x20(%rbx)
movzbl 0x4(%rsp), %ebp
movq %rbp, 0x38(%rsp)
jne 0x6034
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x2190
movq %rax, %r15
leaq 0x6b4(%rsp), %r14
movq %rax, %r13
addq $0xb4, %r13
leaq 0x30(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r13, 0x20(%rsp)
movl 0x2c(%rbx,%r12), %edi
testl %edi, %edi
je 0x6023
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $0x6, %eax
cltq
movq 0x50(%rsp,%rax,8), %rax
btq %rdi, %rax
jae 0x600e
movl $0x5dc, 0x1e8(%rsp) # imm = 0x5DC
leaq 0xeb0(%rsp), %rsi
leaq 0x1e8(%rsp), %rdx
movq %r14, %rcx
leaq 0x6b0(%rsp), %r8
movl %ebp, %r9d
callq 0x7f81
testb %al, %al
je 0x6023
movl 0x10(%rbx), %edi
movl 0x1e8(%rsp), %edx
movl 0x34(%rbx,%r12), %ecx
movzwl 0x30(%rbx,%r12), %r8d
leaq 0xeb0(%rsp), %rsi
movl %ebp, %r9d
callq 0x8138
movq %r13, 0x38(%rbx,%r12)
testb %bpl, %bpl
je 0x6023
movq 0x10(%rsp), %rax
addq %r12, %rax
movq %rax, 0x28(%rsp)
movl $0x10, %edx
movq 0x704d(%rip), %rbp      # 0xcfb8
movq %rbp, %rdi
leaq 0x3e83(%rip), %rsi      # 0x9df8
callq 0x21f0
movl 0x2c(%rbx,%r12), %esi
movq %rbp, %rdi
callq 0x2290
movq %r15, %r13
movq %r14, %r15
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0x3f08(%rip), %rsi      # 0x9ea7
callq 0x21f0
movq %r14, %rdi
leaq 0x6b0(%rsp), %rsi
callq 0x3dbb
movl $0x4, %edx
movq %r14, %rdi
leaq 0x3e46(%rip), %rsi      # 0x9e09
callq 0x21f0
movq %r14, %rdi
movq 0x28(%rsp), %rsi
movq 0x38(%rsp), %rbp
callq 0x3dbb
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
movq %r15, %r14
movq %r13, %r15
movq 0x20(%rsp), %r13
callq 0x2030
movq %rax, %rdi
callq 0x2140
jmp 0x6023
cmpq 0x38(%rbx,%r12), %r15
jle 0x6023
callq 0x22b0
movl $0x0, 0x2c(%rbx,%r12)
addq $0x18, %r12
cmpq $0x2ee0, %r12           # imm = 0x2EE0
jne 0x5ec0
leaq 0x14(%rbx), %r15
leaq 0x18(%rbx), %rdx
leaq 0x1c(%rbx), %rcx
movq 0x30(%rsp), %rax
movl (%rax), %edi
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $0x6, %eax
cltq
movq 0x50(%rsp,%rax,8), %rax
btq %rdi, %rax
movq %rcx, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
jae 0x6191
cmpb $0x0, 0x4(%rsp)
je 0x60bd
movq 0x6f3d(%rip), %r14      # 0xcfb8
leaq 0x3d8c(%rip), %rsi      # 0x9e0e
movl $0x11, %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
movq 0x30(%rsp), %rax
movl (%rax), %edi
movl $0x0, 0x10(%rsp)
xorl %r13d, %r13d
leaq 0xc(%rsp), %rcx
leaq 0xeb0(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x8(%rsp), %r8
movl %ebp, %r9d
callq 0x7f81
movl %eax, %ebp
cmpb $0x1, 0x20(%rbx)
jne 0x613a
movl 0xc(%rsp), %eax
movl $0x38, %r14d
movzwl 0x8(%rsp), %ecx
cmpl %eax, -0x4(%rbx,%r14)
jne 0x6111
cmpw %cx, -0x8(%rbx,%r14)
je 0x62c5
addq $0x18, %r14
cmpq $0x2f18, %r14           # imm = 0x2F18
jne 0x60fe
xorl %r12d, %r12d
cmpl $0x0, 0x2c(%rbx,%r12)
je 0x6227
addq $0x18, %r12
cmpq $0x2ee0, %r12           # imm = 0x2EE0
jne 0x6121
xorl %r12d, %r12d
jmp 0x62e4
callq 0x2040
movl (%rax), %ebp
movq 0x6e68(%rip), %rbx      # 0xcfb8
leaq 0x3c8f(%rip), %rsi      # 0x9de6
movl $0x11, %edx
movq %rbx, %rdi
callq 0x21f0
movl %ebp, %edi
callq 0x20a0
testq %rax, %rax
je 0x620b
movq %rax, %r14
movq %rax, %rdi
callq 0x20c0
movq 0x6e32(%rip), %rdi      # 0xcfb8
movq %r14, %rsi
movq %rax, %rdx
jmp 0x64df
movl (%r15), %edi
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $0x6, %eax
cltq
movq 0x50(%rsp,%rax,8), %rax
btq %rdi, %rax
jae 0x651f
movb $0x1, %al
movl %eax, 0x10(%rsp)
cmpb $0x0, 0x4(%rsp)
je 0x60c5
movq 0x6df0(%rip), %r14      # 0xcfb8
leaq 0x3c51(%rip), %rsi      # 0x9e20
movl $0x11, %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 (%r15), %edi
jmp 0x60c5
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x2280
jmp 0x64e4
cmpb $0x0, 0x4(%rsp)
je 0x6280
movq 0x6d83(%rip), %r14      # 0xcfb8
leaq 0x3c1a(%rip), %rsi      # 0x9e56
movl $0x10, %edx
movq %r14, %rdi
callq 0x21f0
movl 0x28(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x2290
movq %rax, %r14
movq (%rax), %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
movzwl 0x28(%rbx,%r12), %edi
movl 0x4(%rbx), %esi
movq 0x38(%rsp), %rdx
callq 0x7c14
movl %eax, 0x2c(%rbx,%r12)
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rbx,%r12)
movzwl 0x8(%rsp), %eax
movw %ax, 0x30(%rbx,%r12)
xorl %edi, %edi
callq 0x2190
addq $0xb4, %rax
movq %rax, 0x38(%rbx,%r12)
movl 0x28(%rbx,%r12), %r12d
jmp 0x62e4
movl -0x10(%rbx,%r14), %r12d
xorl %edi, %edi
callq 0x2190
addq $0xb4, %rax
movq %rax, (%rbx,%r14)
testl %r12d, %r12d
je 0x611e
testb %bpl, %bpl
je 0x64a6
cmpb $0x0, 0x4(%rsp)
je 0x6366
movq 0x6cbd(%rip), %r14      # 0xcfb8
leaq 0x3b90(%rip), %rsi      # 0x9e92
movl $0x13, %edx
movq %r14, %rdi
callq 0x21f0
movl 0x1c(%rsp), %esi
movq %r14, %rdi
callq 0x2290
movq %rax, %r14
leaq 0x3b81(%rip), %rsi      # 0x9ea6
movl $0x7, %edx
movq %rax, %rdi
callq 0x21f0
leaq 0x8(%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
movl 0x1c(%rsp), %esi
testl %esi, %esi
movq 0x38(%rsp), %rbp
jle 0x650b
xorl %eax, %eax
movb %al, 0x3(%rsp)
movb %al, 0x2(%rsp)
movw %ax, 0x1e6(%rsp)
movw %ax, 0x40(%rsp)
movl $0x0, 0x44(%rsp)
cmpb $0x1, 0x20(%rbx)
jne 0x63b8
testl %r12d, %r12d
je 0x63b8
movq 0x8(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x4(%rbx), %eax
movl %eax, 0xc(%rsp)
movw %r12w, 0x8(%rsp)
leaq 0x8(%rbx), %r9
testb %r13b, %r13b
movq %rbx, %r8
cmovneq %r9, %r8
cmovneq %rbx, %r9
leaq 0x2(%rsp), %rax
leaq 0x3(%rsp), %r10
leaq 0xe6(%rsp), %r11
leaq 0x48(%rsp), %rbx
leaq 0x1e8(%rsp), %r14
leaq 0xeb0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x40(%rsp), %rcx
pushq %rbp
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
callq 0x4f5c
addq $0x30, %rsp
testb %al, %al
je 0x64c2
leaq 0x1e8(%rsp), %rdi
leaq 0x6b0(%rsp), %rsi
leaq 0xe6(%rsp), %rcx
movl $0x800, %edx            # imm = 0x800
movl %ebp, %r8d
callq 0x3f1b
movl 0x4c(%rsp), %ecx
testl %ecx, %ecx
setne %sil
movzwl 0x48(%rsp), %edx
testw %dx, %dx
setne %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x650b
xorb 0x2(%rsp), %r13b
movl 0x10(%rsp), %edi
xorb 0x3(%rsp), %dil
testb %r13b, %r13b
movq 0x30(%rsp), %rsi
cmovneq 0x28(%rsp), %rsi
cmovneq 0x20(%rsp), %r15
testb %dil, %dil
cmoveq %rsi, %r15
movl (%r15), %edi
cmpl $-0x1, %edi
je 0x650b
movzwl %dx, %r8d
leaq 0x6b0(%rsp), %rsi
movl %eax, %edx
movl %ebp, %r9d
callq 0x8138
jmp 0x650b
cmpb $0x0, 0x4(%rsp)
je 0x650b
movq 0x6b04(%rip), %rbx      # 0xcfb8
leaq 0x39ac(%rip), %rsi      # 0x9e67
movl $0x2a, %edx
jmp 0x64dc
cmpb $0x0, 0x4(%rsp)
je 0x650b
movq 0x6ae8(%rip), %rbx      # 0xcfb8
leaq 0x39d7(%rip), %rsi      # 0x9eae
movl $0x17, %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
movb $0x1, %al
addq $0x16b8, %rsp           # imm = 0x16B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%rdx), %edi
cmpl $-0x1, %edi
je 0x657f
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $0x6, %eax
cltq
movq 0x50(%rsp,%rax,8), %rax
btq %rdi, %rax
jae 0x657f
movb $0x1, %r13b
cmpb $0x0, 0x4(%rsp)
je 0x6572
movq 0x6a69(%rip), %r14      # 0xcfb8
leaq 0x38dc(%rip), %rsi      # 0x9e32
movl $0x11, %edx
movq %r14, %rdi
callq 0x21f0
movq %r14, %rdi
callq 0x20d0
movq 0x28(%rsp), %rax
movl (%rax), %edi
movl $0x0, 0x10(%rsp)
jmp 0x60c8
movl (%rcx), %edi
cmpl $-0x1, %edi
je 0x650b
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $0x6, %eax
cltq
movq 0x50(%rsp,%rax,8), %rax
btq %rdi, %rax
jae 0x650b
movb $0x1, %al
movl %eax, 0x10(%rsp)
cmpb $0x0, 0x4(%rsp)
je 0x65d9
movq 0x6a02(%rip), %r14      # 0xcfb8
leaq 0x3887(%rip), %rsi      # 0x9e44
movl $0x11, %edx
movq %r14, %rdi
callq 0x21f0
movq %r14, %rdi
callq 0x20d0
movq 0x20(%rsp), %rax
movl (%rax), %edi
movb $0x1, %r13b
jmp 0x60c8