// File: /workspace/github_cpp_makefile_star2_O1/Distrotech[P]stund/stun.cxx
// Function: stunServerProcessMsg(char*, unsigned int, StunAddress4&, StunAddress4&, StunAddress4&, StunAddress4&, StunMessage*, StunAddress4*, StunAtrString*, bool*, bool*, bool)
bool
stunServerProcessMsg( char* buf,
                      unsigned int bufLen,
                      StunAddress4& from, 
                      StunAddress4& secondary,
                      StunAddress4& myAddr,
                      StunAddress4& altAddr, 
                      StunMessage* resp,
                      StunAddress4* destination,
                      StunAtrString* hmacPassword,
                      bool* changePort,
                      bool* changeIp,
                      bool verbose)
{
    
   // set up information for default response 
	
   memset( resp, 0 , sizeof(*resp) );
	
   *changeIp = false;
   *changePort = false;
	
   StunMessage req;
   bool ok = stunParseMessage( buf,bufLen, req, verbose);
	
   if (!ok)      // Complete garbage, drop it on the floor
   {
      if (verbose) clog << "Request did not parse" << endl;
      return false;
   }
   if (verbose) clog << "Request parsed ok" << endl;
	
   StunAddress4 mapped = req.mappedAddress.ipv4;
   StunAddress4 respondTo = req.responseAddress.ipv4;
   UInt32 flags = req.changeRequest.value;
	
   switch (req.msgHdr.msgType)
   {
      case SharedSecretRequestMsg:
         if(verbose) clog << "Received SharedSecretRequestMsg on udp. send error 433." << endl;
         // !cj! - should fix so you know if this came over TLS or UDP
         stunCreateSharedSecretResponse(req, from, *resp);
         //stunCreateSharedSecretErrorResponse(*resp, 4, 33, "this request must be over TLS");
         return true;
			
      case BindRequestMsg:
         if (!req.hasMessageIntegrity)
         {
            if (verbose) clog << "BindRequest does not contain MessageIntegrity" << endl;
				
            if (0) // !jf! mustAuthenticate
            {
               if(verbose) clog << "Received BindRequest with no MessageIntegrity. Sending 401." << endl;
               stunCreateErrorResponse(*resp, 4, 1, "Missing MessageIntegrity");
               return true;
            }
         }
         else
         {
            if (!req.hasUsername)
            {
               if (verbose) clog << "No UserName. Send 432." << endl;
               stunCreateErrorResponse(*resp, 4, 32, "No UserName and contains MessageIntegrity");
               return true;
            }
            else
            {
               if (verbose) clog << "Validating username: " << req.username.value << endl;
               // !jf! could retrieve associated password from provisioning here
               if (strcmp(req.username.value, "test") == 0)
               {
                  if (0)
                  {
                     // !jf! if the credentials are stale 
                     stunCreateErrorResponse(*resp, 4, 30, "Stale credentials on BindRequest");
                     return true;
                  }
                  else
                  {
                     if (verbose) clog << "Validating MessageIntegrity" << endl;
                     // need access to shared secret
							
                     unsigned char hmac[20];
#ifndef NOSSL
                     unsigned int hmacSize=20;

                     HMAC(EVP_sha1(), 
                          "1234", 4, 
                          reinterpret_cast<const unsigned char*>(buf), bufLen-20-4, 
                          hmac, &hmacSize);
                     assert(hmacSize == 20);
#endif
							
                     if (memcmp(buf, hmac, 20) != 0)
                     {
                        if (verbose) clog << "MessageIntegrity is bad. Sending " << endl;
                        stunCreateErrorResponse(*resp, 4, 3, "Unknown username. Try test with password 1234");
                        return true;
                     }
							
                     // need to compute this later after message is filled in
                     resp->hasMessageIntegrity = true;
                     assert(req.hasUsername);
                     resp->hasUsername = true;
                     resp->username = req.username; // copy username in
                  }
               }
               else
               {
                  if (verbose) clog << "Invalid username: " << req.username.value << "Send 430." << endl; 
               }
            }
         }
			
         // TODO !jf! should check for unknown attributes here and send 420 listing the
         // unknown attributes. 
			
         if ( respondTo.port == 0 ) respondTo = from;
         if ( mapped.port == 0 ) mapped = from;
				
         *changeIp   = ( flags & ChangeIpFlag )?true:false;
         *changePort = ( flags & ChangePortFlag )?true:false;
			
         if (verbose)
         {
            clog << "Request is valid:" << endl;
            clog << "\t flags=" << flags << endl;
            clog << "\t changeIp=" << *changeIp << endl;
            clog << "\t changePort=" << *changePort << endl;
            clog << "\t from = " << from << endl;
            clog << "\t respond to = " << respondTo << endl;
            clog << "\t mapped = " << mapped << endl;
         }
				
         // form the outgoing message
         resp->msgHdr.msgType = BindResponseMsg;
         for ( int i=0; i<16; i++ )
         {
            resp->msgHdr.id.octet[i] = req.msgHdr.id.octet[i];
         }
		
         if ( req.xorOnly == false )
         {
            resp->hasMappedAddress = true;
            resp->mappedAddress.ipv4.port = mapped.port;
            resp->mappedAddress.ipv4.addr = mapped.addr;
         }

         if (1) // do xorMapped address or not 
         {
            resp->hasXorMappedAddress = true;
            UInt16 id16 = req.msgHdr.id.octet[0]<<8 
               | req.msgHdr.id.octet[1];
            UInt32 id32 = req.msgHdr.id.octet[0]<<24 
               | req.msgHdr.id.octet[1]<<16 
               | req.msgHdr.id.octet[2]<<8 
               | req.msgHdr.id.octet[3];
            resp->xorMappedAddress.ipv4.port = mapped.port^id16;
            resp->xorMappedAddress.ipv4.addr = mapped.addr^id32;
         }
         
         resp->hasSourceAddress = true;
         resp->sourceAddress.ipv4.port = (*changePort) ? altAddr.port : myAddr.port;
         resp->sourceAddress.ipv4.addr = (*changeIp)   ? altAddr.addr : myAddr.addr;
			
         resp->hasChangedAddress = true;
         resp->changedAddress.ipv4.port = altAddr.port;
         resp->changedAddress.ipv4.addr = altAddr.addr;
	
         if ( secondary.port != 0 )
         {
            resp->hasSecondaryAddress = true;
            resp->secondaryAddress.ipv4.port = secondary.port;
            resp->secondaryAddress.ipv4.addr = secondary.addr;
         }
         
         if ( req.hasUsername && req.username.sizeValue > 0 ) 
         {
            // copy username in
            resp->hasUsername = true;
            assert( req.username.sizeValue % 4 == 0 );
            assert( req.username.sizeValue < STUN_MAX_STRING );
            memcpy( resp->username.value, req.username.value, req.username.sizeValue );
            resp->username.sizeValue = req.username.sizeValue;
         }
		
         if (1) // add ServerName 
         {
            resp->hasServerName = true;
            const char serverName[] = "Vovida.org " STUN_VERSION; // must pad to mult of 4
            
            assert( sizeof(serverName) < STUN_MAX_STRING );
            //cerr << "sizeof serverName is "  << sizeof(serverName) << endl;
            assert( sizeof(serverName)%4 == 0 );
            memcpy( resp->serverName.value, serverName, sizeof(serverName));
            resp->serverName.sizeValue = sizeof(serverName);
         }
         
         if ( req.hasMessageIntegrity & req.hasUsername )  
         {
            // this creates the password that will be used in the HMAC when then
            // messages is sent
            stunCreatePassword( req.username, hmacPassword );
         }
				
         if (req.hasUsername && (req.username.sizeValue > 64 ) )
         {
            UInt32 source;
            assert( sizeof(int) == sizeof(UInt32) );
					
            sscanf(req.username.value, "%x", &source);
            resp->hasReflectedFrom = true;
            resp->reflectedFrom.ipv4.port = 0;
            resp->reflectedFrom.ipv4.addr = source;
         }
				
         destination->port = respondTo.port;
         destination->addr = respondTo.addr;
			
         return true;
			
      default:
         if (verbose) clog << "Unknown or unsupported request " << endl;
         return false;
   }
	
   assert(0);
   return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
movq %r9, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x10(%rsp)
movl %esi, %r14d
movq %rdi, %rbp
movb 0x578(%rsp), %bl
movq 0x570(%rsp), %r13
movq 0x568(%rsp), %r15
movq 0x550(%rsp), %rdi
xorl %r12d, %r12d
movl $0x4c8, %edx            # imm = 0x4C8
xorl %esi, %esi
callq 0x2110
movb %r12b, (%r13)
movb %r12b, (%r15)
movq %r15, %r12
movl %ebx, %r15d
movzbl %bl, %ecx
leaq 0x50(%rsp), %rdx
movq %rbp, %rdi
movl %r14d, %esi
callq 0x3248
testb %al, %al
je 0x5111
testb %r15b, %r15b
je 0x5013
movq 0x7fe0(%rip), %r14      # 0xcfb8
leaq 0x4a89(%rip), %rsi      # 0x9a68
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 0x6c(%rsp), %rax
movq 0x7c(%rsp), %rcx
movq %rax, (%rsp)
movq %rcx, 0x8(%rsp)
movzwl 0x50(%rsp), %eax
cmpl $0x1, %eax
movq 0x550(%rsp), %rbx
je 0x5132
cmpl $0x2, %eax
jne 0x523c
testb %r15b, %r15b
je 0x508c
movq 0x7f67(%rip), %r14      # 0xcfb8
leaq 0x4a22(%rip), %rsi      # 0x9a7a
movl $0x37, %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
movw $0x102, (%rbx)          # imm = 0x102
movdqu 0x54(%rsp), %xmm0
movdqu %xmm0, 0x4(%rbx)
movb $0x1, %bpl
movb %bpl, 0x5c(%rbx)
leaq 0x5e(%rbx), %rsi
movq 0x10(%rsp), %rdi
callq 0x4b80
movb %bpl, 0x160(%rbx)
xorl %eax, %eax
leaq 0x52af(%rip), %rcx      # 0xa370
leaq 0x52c8(%rip), %rdx      # 0xa390
movzbl (%rax,%rcx), %esi
movl %esi, %edi
shrl $0x4, %edi
andl $0xf, %esi
movb (%rdi,%rdx), %dil
movb %dil, 0x162(%rbx,%rax,2)
movb (%rsi,%rdx), %sil
movb %sil, 0x163(%rbx,%rax,2)
incq %rax
cmpl $0x14, %eax
jne 0x50c8
xorl %ecx, %ecx
movb %cl, 0x162(%rbx,%rax,2)
movw $0x28, 0x262(%rbx)
movb %cl, 0x18a(%rbx)
jmp 0x57b7
testb %r15b, %r15b
je 0x5283
movq 0x7e97(%rip), %rbx      # 0xcfb8
leaq 0x492a(%rip), %rsi      # 0x9a52
movl $0x15, %edx
jmp 0x5254
movl 0x88(%rsp), %r13d
cmpb $0x0, 0x2b4(%rsp)
je 0x528a
cmpb $0x0, 0xac(%rsp)
je 0x572f
testb %r15b, %r15b
je 0x51c3
movq 0x7e56(%rip), %rdi      # 0xcfb8
leaq 0x49b8(%rip), %rsi      # 0x9b21
movl $0x15, %edx
callq 0x21f0
leaq 0xae(%rsp), %r14
movq %r14, %rdi
callq 0x20c0
movq 0x7e2e(%rip), %rdi      # 0xcfb8
movq %r14, %rsi
movq %rax, %rdx
callq 0x21f0
movq 0x7e1c(%rip), %r14      # 0xcfb8
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 0xae(%rsp), %rsi
movl $0x74736574, %eax       # imm = 0x74736574
xorl (%rsi), %eax
movzbl 0x4(%rsi), %ecx
orl %eax, %ecx
je 0x57cb
testb %r15b, %r15b
je 0x52d1
movq 0x7dca(%rip), %r14      # 0xcfb8
movq %rsi, %rbp
leaq 0x4a76(%rip), %rsi      # 0x9c6e
movl $0x12, %edx
movq %r14, %rdi
callq 0x21f0
movq %rbp, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x21f0
leaq 0x4a5f(%rip), %rsi      # 0x9c81
movl $0x9, %edx
movq %r14, %rdi
callq 0x21f0
movq %r14, %rdi
callq 0x20d0
jmp 0x52d1
testb %r15b, %r15b
je 0x5283
movq 0x7d70(%rip), %rbx      # 0xcfb8
leaq 0x4ae3(%rip), %rsi      # 0x9d32
movl $0x1f, %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
xorl %eax, %eax
jmp 0x57b9
testb %r15b, %r15b
je 0x52d1
movq 0x7d22(%rip), %r14      # 0xcfb8
leaq 0x4815(%rip), %rsi      # 0x9ab2
movl $0x2d, %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
cmpw $0x0, 0x8(%rsp)
jne 0x52e6
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
cmpw $0x0, (%rsp)
jne 0x52f9
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
movl %r13d, %eax
shrb $0x2, %al
andb $0x1, %al
movq 0x570(%rsp), %rcx
movb %al, (%rcx)
movl %r13d, %eax
shrb %al
andb $0x1, %al
movb %al, (%r12)
testb %r15b, %r15b
je 0x5520
movq 0x7c92(%rip), %rbp      # 0xcfb8
leaq 0x495e(%rip), %rsi      # 0x9c8b
movl $0x11, %edx
movq %rbp, %rdi
callq 0x21f0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x4934(%rip), %rsi      # 0x9c9d
movl $0x8, %edx
movq %rbp, %rdi
callq 0x21f0
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2130
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
leaq 0x48f4(%rip), %rsi      # 0x9ca6
movl $0xb, %edx
movq %rbp, %rdi
callq 0x21f0
movq 0x570(%rsp), %rax
movzbl (%rax), %esi
movq %rbp, %rdi
callq 0x2280
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
leaq 0x48af(%rip), %rsi      # 0x9cb2
movl $0xd, %edx
movq %rbp, %rdi
callq 0x21f0
movzbl (%r12), %esi
movq %rbp, %rdi
callq 0x2280
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
leaq 0x4872(%rip), %rsi      # 0x9cc0
movl $0x9, %edx
movq %rbp, %rdi
callq 0x21f0
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
callq 0x3f5b
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x4833(%rip), %rsi      # 0x9cca
movl $0xf, %edx
movq %rbp, %rdi
callq 0x21f0
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0x3f5b
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x47fa(%rip), %rsi      # 0x9cda
movl $0xb, %edx
movq %rbp, %rdi
callq 0x21f0
movq %rsp, %rsi
movq %rbp, %rdi
callq 0x3f5b
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
movw $0x101, (%rbx)          # imm = 0x101
movups 0x54(%rsp), %xmm0
movups %xmm0, 0x4(%rbx)
cmpb $0x0, 0x404(%rsp)
jne 0x554b
movb $0x1, 0x14(%rbx)
movzwl (%rsp), %eax
movw %ax, 0x1c(%rbx)
movl 0x4(%rsp), %eax
movl %eax, 0x20(%rbx)
movb $0x1, %al
movb %al, 0x3a4(%rbx)
movzbl 0x54(%rsp), %ecx
movl %ecx, %edx
shll $0x8, %edx
movzbl 0x55(%rsp), %esi
orl %esi, %edx
shll $0x18, %ecx
shll $0x10, %esi
orl %ecx, %esi
movzbl 0x56(%rsp), %ecx
shll $0x8, %ecx
orl %esi, %ecx
movzbl 0x57(%rsp), %esi
xorw (%rsp), %dx
orl %ecx, %esi
movw %dx, 0x3ac(%rbx)
xorl 0x4(%rsp), %esi
movl %esi, 0x3b0(%rbx)
movb %al, 0x3c(%rbx)
cmpb $0x0, (%r12)
movq 0x18(%rsp), %rsi
movq %rsi, %rcx
movq 0x20(%rsp), %rdx
cmovneq %rdx, %rcx
movzwl (%rcx), %ecx
movw %cx, 0x44(%rbx)
movq 0x570(%rsp), %rcx
cmpb $0x0, (%rcx)
cmovneq %rdx, %rsi
movl 0x4(%rsi), %ecx
movl %ecx, 0x48(%rbx)
movb %al, 0x4c(%rbx)
movzwl (%rdx), %eax
movw %ax, 0x54(%rbx)
movl 0x4(%rdx), %eax
movl %eax, 0x58(%rbx)
movq 0x28(%rsp), %rcx
movzwl (%rcx), %eax
testw %ax, %ax
je 0x55fb
movb $0x1, 0x4b8(%rbx)
movw %ax, 0x4c0(%rbx)
movl 0x4(%rcx), %eax
movl %eax, 0x4c4(%rbx)
leaq 0xae(%rsp), %r14
movb -0x2(%r14), %bpl
movzwl 0x100(%r14), %r12d
testw %r12w, %r12w
setne %al
andb %bpl, %al
cmpb $0x1, %al
jne 0x5653
movb $0x1, 0x5c(%rbx)
testb $0x3, %r12b
jne 0x58cb
movzwl %r12w, %r15d
cmpl $0x100, %r15d           # imm = 0x100
jae 0x58ea
leaq 0x5e(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2170
movw %r15w, 0x15e(%rbx)
movb $0x1, 0x3b5(%rbx)
movdqa 0x4cfe(%rip), %xmm0     # 0xa360
movdqu %xmm0, 0x3b6(%rbx)
movw $0x10, 0x4b6(%rbx)
testb %bpl, 0x2b4(%rsp)
je 0x56cd
movq 0x560(%rsp), %rax
xorl %ecx, %ecx
leaq 0x4ce2(%rip), %rdx      # 0xa370
leaq 0x4cfb(%rip), %rsi      # 0xa390
movzbl (%rcx,%rdx), %edi
movl %edi, %r8d
shrl $0x4, %r8d
andl $0xf, %edi
movb (%r8,%rsi), %r8b
movb %r8b, (%rax,%rcx,2)
movb (%rdi,%rsi), %dil
movb %dil, 0x1(%rax,%rcx,2)
incq %rcx
cmpl $0x14, %ecx
jne 0x5695
xorl %edx, %edx
movb %dl, (%rax,%rcx,2)
movw $0x28, 0x100(%rax)
movb %dl, 0x28(%rax)
movq 0x558(%rsp), %r13
cmpw $0x41, %r12w
setae %al
andb %al, %bpl
cmpb $0x1, %bpl
jne 0x5718
leaq 0x4642(%rip), %rsi      # 0x9d2f
leaq 0x30(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x21c0
movb $0x1, 0x394(%rbx)
movw $0x0, 0x39c(%rbx)
movl (%r15), %eax
movl %eax, 0x3a0(%rbx)
movzwl 0x8(%rsp), %eax
movw %ax, (%r13)
movl 0xc(%rsp), %eax
movl %eax, 0x4(%r13)
jmp 0x57b7
testb %r15b, %r15b
je 0x5776
movq 0x787d(%rip), %r14      # 0xcfb8
leaq 0x439e(%rip), %rsi      # 0x9ae0
movl $0x16, %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
movw $0x111, (%rbx)          # imm = 0x111
movb $0x1, 0x279(%rbx)
movw $0x2004, 0x27c(%rbx)    # imm = 0x2004
movups 0x4365(%rip), %xmm0     # 0x9af7
movups %xmm0, 0x27e(%rbx)
movups 0x4367(%rip), %xmm0     # 0x9b07
movups %xmm0, 0x28e(%rbx)
movdqu 0x4362(%rip), %xmm0     # 0x9b11
movdqu %xmm0, 0x298(%rbx)
movb $0x1, %al
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %r15b, %r15b
je 0x57fb
movq 0x77e1(%rip), %r14      # 0xcfb8
leaq 0x435e(%rip), %rsi      # 0x9b3c
movl $0x1b, %edx
movq %r14, %rdi
callq 0x21f0
movq %r14, %rdi
callq 0x20d0
leaq 0xae(%rsp), %rsi
movdqu (%rbp), %xmm0
movd 0x10(%rbp), %xmm1
movd 0x40(%rsp), %xmm2
pcmpeqb %xmm1, %xmm2
pcmpeqb 0x30(%rsp), %xmm0
pand %xmm2, %xmm0
pmovmskb %xmm0, %eax
xorl %ebp, %ebp
cmpl $0xffff, %eax           # imm = 0xFFFF
setne %r14b
je 0x5896
testb %r15b, %r15b
je 0x5853
movq 0x7782(%rip), %rdi      # 0xcfb8
leaq 0x431b(%rip), %rsi      # 0x9b58
movl $0x21, %edx
callq 0x21f0
movq 0x776a(%rip), %rdi      # 0xcfb8
callq 0x20d0
movw $0x111, (%rbx)          # imm = 0x111
movb $0x1, 0x279(%rbx)
movw $0x304, 0x27c(%rbx)     # imm = 0x304
movups 0x430b(%rip), %xmm0     # 0x9b7a
movups %xmm0, 0x27e(%rbx)
movups 0x430d(%rip), %xmm0     # 0x9b8a
movups %xmm0, 0x28e(%rbx)
movdqu 0x430c(%rip), %xmm0     # 0x9b98
movdqu %xmm0, 0x29c(%rbx)
jmp 0x58b9
movb $0x1, 0x264(%rbx)
cmpb $0x0, 0xac(%rsp)
je 0x5909
movb $0x1, 0x5c(%rbx)
leaq 0x5e(%rbx), %rdi
movl $0x102, %edx            # imm = 0x102
callq 0x2170
movb %r14b, %bpl
movb $0x1, %al
testl %ebp, %ebp
jne 0x57b9
jmp 0x52d1
leaq 0x4414(%rip), %rdi      # 0x9ce6
leaq 0x3e7c(%rip), %rsi      # 0x9755
leaq 0x42d8(%rip), %rcx      # 0x9bb8
movl $0x4ad, %edx            # imm = 0x4AD
callq 0x2120
leaq 0x4415(%rip), %rdi      # 0x9d06
leaq 0x3e5d(%rip), %rsi      # 0x9755
leaq 0x42b9(%rip), %rcx      # 0x9bb8
movl $0x4ae, %edx            # imm = 0x4AE
callq 0x2120
leaq 0x4298(%rip), %rdi      # 0x9ba8
leaq 0x3e3e(%rip), %rsi      # 0x9755
leaq 0x429a(%rip), %rcx      # 0x9bb8
movl $0x45f, %edx            # imm = 0x45F
callq 0x2120