// File: /workspace/github_cpp_makefile_star2_O3/probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::decode2()
void Signal::decode2()
{
	decode();

	int xDevice = *pDevice;
	int xSubDevice = *pSubDevice;
	int xOBC = *pOBC;
	int xHex[4];
	unsigned int wContext[2];	// the pContext for the next iteration
	unsigned int xContext[2];	// the pContext of the first decode of a repeat sequence
	unsigned int yContext[2];	// the pContext of the last decode of a repeat sequence
	int xNote_out = nNote_out;
	int xAuxNote_out = nAuxNote_out;
	int contextLengthOut = 2;
	int xFrameCount;
	int xDittos;
	int xInitLeadIn = bInitLeadIn;
	int n;
	int bSetyContext = true;
	// Test if lead-in only with tryGap, note that nProtocol is already incremented
	int xLeadIn = ( ((pContext[1] & 0xFF) == nGapProtocol + 1) && (pLead) ) ? 1 : 0;
	int yLeadIn;
	char xProtocol[256];
	char xMisc[256];
	int iEndpoint = 0;	// -2 & -1 = saved 1 & 0; 0 = no early end; 1 = early end
	for (n = 0; n < 4; n++) xHex[n] = pHex[n];
	for (n=0; n<2; n++) xContext[n] = nFrameCount == 0 ? pContext[n] : zContext[n];
	strcpy(xProtocol, pProtocol);
	strcpy(xMisc, pMisc);
	if ( *pError == 0 && *pProtocol )
	{
		do
		{
			do	
			{
				if (bSetyContext)
				{
					// yContext is not set if the most recent decode has been suppressed as spurious
					for (n=0; n<2; n++) yContext[n] = pContext[n];	// save the current sequence end
				}
				for (n=0; n<2; n++) wContext[n] = pContext[n];		// save for next iteration
				bSetyContext = true;
				xFrameCount = ++nFrameCount;	// count the frame just validated
				xDittos = nDittos;				// save the ditto count so not upset by next decode
				iEndpoint = ( iEndpoint < 0 ) ? - iEndpoint - 1 :	// if <0 restore old value, else test
					(	nDittos != 0			// don't look for repeats if dittos present
					||	*pFrameEnd > 200000 );	// don't look for repeats if more than 200ms between frames
				sortOn.clear();
				sortOff.clear();
				sortBurst.clear();
				decode();						// check for spurious next frame even if early end
				yLeadIn = ( ((pContext[1] & 0xFF) == nGapProtocol + 1) && (pLead) ) ? 1 : 0;
			}
			while (	*pError == 0	
				&&	strcmp(pProtocol, xProtocol) == 0
				&&	*pDevice == xDevice
				&&	*pSubDevice == xSubDevice
				&&	*pOBC == xOBC
				&&	strcmp(pMisc, xMisc) == 0
				&&	nDittos == 0		// if new frame has dittos, or nDittos=-1, treat as non-matching
				&&	!bInitLeadIn		// if new frame has initial lead-in, treat as non-matching
				&&	(yContext[0] & 0xFFFFF) + (yContext[1] >> 16) + MinFrame
						== (pContext[0] & 0xFFFFF) - yLeadIn	// if not consecutive, treat as non-matching
				&&	!iEndpoint);		// exit loop if early end marked

			// If a generic Gap decode is followed by a real decode starting one burst later,
			// Gap decode was probably spurious, treating a real lead-in as start of data.
			// So cancel the Gap decode, remove it from the count and reset the 'x...' variables
			if (	*pError == 0 && *pProtocol
				&&	strncmp(xProtocol, "Gap-", 4) == 0
				&&	strncmp(pProtocol, "Gap-", 4) != 0
				&&	((pContext[0] - yContext[0]) & 0xFFFFF) == 1 )	// check start difference is 1 burst
			{
				--nFrameCount;			// remove from count
				iEndpoint = 0;			// no early end to count, but let the real decode be tested
				xDevice = *pDevice;
				xSubDevice = *pSubDevice;
				xOBC = *pOBC;
				xNote_out = nNote_out;
				xAuxNote_out = nAuxNote_out;
				xLeadIn = ( ((pContext[1] & 0xFF) == nGapProtocol + 1) && (pLead) ) ? 1 : 0;
				for (n = 0; n < 4; n++) xHex[n] = pHex[n];
				for (n=0; n<2; n++) xContext[n] = pContext[n];
				strcpy(xProtocol, pProtocol);
				strcpy(xMisc, pMisc);
			}
			else
			// If a decode is followed by a generic Gap decode with same start frame or one burst,
			// later, Gap decode was probably spurious, treating two or more real frames as one.
			// So skip the Gap decode and remove it from the count
			if (	*pError == 0 && *pProtocol
				&&	strncmp(pProtocol, "Gap-", 4) == 0
				&&	((pContext[0] - yContext[0]) & 0xFFFFE) == 0 )	// check start burst
			{
				--nFrameCount;					// remove spurious Gap decode from count
				bSetyContext = false;			// do not set yContext from it
				iEndpoint = - iEndpoint - 1;	// allow to continue but save old value
			}
			else
			// If a decode is followed by a Solidtek decode other than the documented ones of
			// Solidtek16 and Solidtek20, or by an S:xx.xx... decode (all these in tryQ2)
			// and the whole of this following decode frame lies within the frame of the
			// previous decode, then this second decode is probably spurious.  So skip
			// it and remove it from the count.
			if (	*pError == 0 && *pProtocol
				&&	(	strncmp(pProtocol, "S:", 2) == 0
					||	(	strncmp(pProtocol, "Solidtek", 8) == 0
						&&	strncmp(pProtocol+8, "16", 2) != 0
						&&	strncmp(pProtocol+8, "20", 2) != 0 ) )
				&&	( (pContext[0] & 0xFFFFF) + (pContext[1] >> 16)	// compare nStart + nFrameL
						<= (yContext[0] & 0xFFFFF) + (yContext[1] >> 16) ) )
			{
				--nFrameCount;					// remove spurious Solidtek decode from count
				bSetyContext = false;			// do not set yContext from it
				iEndpoint = - iEndpoint - 1;	// allow to continue but save old value
			}
			else
			// combine two types of X10 frame
			if (	*pError == 0 
				&&	strcmp(pProtocol, "X10") == 0
				&&	strncmp(xProtocol, "X10", 3) == 0
				&&	xOBC == *pOBC 
				&&	xHex[0] == pHex[0] )
			{
				if ( xInitLeadIn )
				{
					xNote_out = 4;
					xAuxNote_out = -1;
					*xMisc = 0;				// cancel the "invalid signal"
					xInitLeadIn = false;	// only needed once
				}
			}
			else
			// If a Solidtek16 or Solidtek20 decode is followed by various decodes
			// of fewer frames in which the first 8 bits match the Solidtek data then
			// it is probably a spurious decode of a partial Solidtek repeat at the end
			// of a signal.  Skip the spurious decode and remove it from the count.
			if (	*pError == 0
				&&	(	strncmp(pProtocol, "S:", 2) == 0
					||	strcmp(pProtocol, "Blaupunkt{prefix}") == 0 
					||	strcmp(pProtocol, "XX") == 0
					||	strcmp(pProtocol, "DirecTV") == 0)
				&&	(	strcmp(xProtocol, "Solidtek16") == 0
					||	strcmp(xProtocol, "Solidtek20") == 0 ) )	
			{
				int x2;
				int xbits;
				char xstr[3];

				// reconstruct first 8 bits of Solidtek decode as hex string in xstr
				if ( strcmp(xProtocol+8, "16") == 0 ) x2 = xOBC;
				else x2 = xSubDevice;
				xbits = ( msb(xDevice,4)<<3 |  msb(x2,3) ) & 0xFF;
				sprintf(xstr, "%02X", xbits);

				// check those that can be checked with this xbits value
				if (		strcmp(pProtocol, "Blaupunkt{prefix}") == 0
						&&	strcmp(xstr, "00") == 0	// needed to match Blaupunkt
					||		strcmp(pProtocol, "DirecTV") == 0
						&&	*pDevice == 0 && *pOBC == 0
						&&	strcmp(xstr, "00") == 0	// needed to match DirecTV
					||		strncmp(pProtocol, "S:", 2) == 0
						&&	strncmp(pProtocol+5, xstr, 2 ) == 0 )	// test against yy of S.xx.yy....
				{
					--nFrameCount;					// remove spurious decode from count
					bSetyContext = false;			// do not set yContext from it
					iEndpoint = - iEndpoint - 1;	// allow to continue but save old value
				}
				else
				// check the one that needs complemented xbits value
				{	sprintf(xstr, "%02X", 255-xbits);
					if (	strcmp(pProtocol, "XX") == 0
						&&	strncmp(pMisc, xstr, 2 ) == 0 )
					{
						--nFrameCount;					// remove spurious decode from count
						bSetyContext = false;			// do not set yContext from it
						iEndpoint = - iEndpoint - 1;	// allow to continue but save old value
					}
					else break;
				}
			}
			else
			// The Sony protocol can match the Async protocol if the Sony data comprises
			// binary pairs 01 and 10.  The Sony lead-in translates to Async 0x80, the
			// binary pairs 01 and 10 translate to Async 0xE6 and 0x98.  The minimum
			// required for an Async decode is 3 such Sony binary pairs.  So if a Sony
			// decode is followed by such an Async decode then the Async probably comes
			// from a truncated Sony frame. Skip the spurious decode and remove it from
			// the count. 
			if (	*pError == 0
				&&	strncmp(xProtocol, "Sony", 4) == 0
				&&	strncmp(pProtocol, "Async", 5) == 0 
				&&	strncmp(pMisc, "80", 2) == 0
				&&	(	strncmp(pMisc+3, "98", 2) == 0
					||	strncmp(pMisc+3, "E6", 2) == 0 )
				&&	(	strncmp(pMisc+6, "98", 2) == 0
					||	strncmp(pMisc+6, "E6", 2) == 0 )
				&&	(	strncmp(pMisc+9, "98", 2) == 0
					||	strncmp(pMisc+9, "E6", 2) == 0 ) )
			{
				--nFrameCount;					// remove spurious Async decode from count
				bSetyContext = false;			// do not set yContext from it
				iEndpoint = - iEndpoint - 1;	// allow to continue but save old value
			}
			else
			// If an XMP decode with valid first half frame is followed by a Mitsubishi decode with
			// same start frame, Mitsubishi decode was probably a spurious decode of an XMP signal
			// with one or more missing digits (Mitsubishi frame length is 17, valid XMP is 18).
			// So skip the Mitsubishi decode and remove it from the count.  If counts suppressed,
			// i.e. learning remotes rather than IRScope, do same if following decode is consecutive
			// and is another XMP frame.
			if (	*pError == 0 && *pProtocol
				&&  (strcmp(xProtocol, "XMP") == 0 || strncmp(xProtocol, "XMP-", 4) == 0)
				&&	(strcmp(pProtocol, "Mitsubishi") == 0
					&&	((pContext[0] - yContext[0]) & 0xFFFFF) == 0 	// check start burst
				||	strncmp(pProtocol, "XMP", 3) == 0 
					&& (yContext[0] & 0xFFFFF) + (yContext[1] >> 16) + MinFrame
						== (pContext[0] & 0xFFFFF) 
					&& bSuppressCount )
				&&  bXMPHalfValid )
			{
				// char xstr[100];
				// sprintf(xstr, "start1 = %d start2 = %d",(yContext[0] & 0xFFFFF) + (yContext[1] >> 16) + MinFrame,(pContext[0] & 0xFFFFF));
				// MessageBox(0,xstr,"Error",0);
				if (strcmp(pProtocol, "Mitsubishi") == 0)
				{	
					--nFrameCount;					// remove spurious Mitsubishi decode from count
					bSetyContext = false;			// do not set yContext from it
				}
				iEndpoint = - iEndpoint - 1;	// allow to continue but save old value
			}
			else break;
		}
		while ( iEndpoint <= 0 );

		// Frame just decoded does not match earlier frame.  If it comes from
		// extra bursts, treat it as spurious so prevent its decode
		if (	nNonSpurious > 0		// value has been set
			&&	(int)(pContext[0] & 0xFFFFF) >= nNonSpurious	)
		{
			wContext[0] = 0xFFFFF;
		}		
		if  	(	strcmp(xProtocol, "NEC") == 0
				||	strcmp(xProtocol, "NECx") == 0 
				||	strcmp(xProtocol, "48-NEC") == 0 )
		{
			if (xFrameCount > 1 || nDittos == 0 && nRepeat > 6 )  
			{							 //nRepeat > 0 changed to nRepeat > 6  DAR Dec 2010 to avoid detecting faulty 
				strcat(xProtocol, "2");  //ditto(s) as NEC2. Anyway, NEC2 should have nRepeat == 34 if xFrame == 1
			}  
			strcat (xProtocol,pSuffix);   //DAR Nov 2010 
		}
		else if (	strcmp(xProtocol, "JVC") == 0 
				&&	!xInitLeadIn )
		{
			strcat(xProtocol, "{2}");
			xNote_out = 1;
		}
		else if (	strncmp(xProtocol, "RCA", 3) == 0 
				&&	xInitLeadIn )
		{
			strcat(xProtocol, "(Old)");
			xNote_out = 11;
		}
		else if (	strncmp(xProtocol, "Gap-", 4) == 0
				||	strncmp(xProtocol, "??", 2) == 0 )
		{
			xNote_out = 8;
		}

		// Restore pContext to value saved before last call to decode()
		for (n=0; n<2; n++) pContext[n] = wContext[n];

		int iParam = xFrameCount;

		*pDevice = xDevice;
		*pSubDevice = xSubDevice;
		*pOBC = xOBC;
		for (n=0; n < 4; n++) pHex[n] = xHex[n];
		strcpy(pProtocol, xProtocol);
		if (xNote_out == -1)		// if note unset, set default
		{
			if (xDittos > 0)		// if dittos present
			{
				xNote_out = 3;		// set ditto-frame note
				iParam = xDittos;
			}
			else
			{
				xNote_out = 1;		// else set identical repeats note
			}
		}

		if (nContextLength > 2)		// extended context used by IRScope
		{
			// set pContext[2] to the pContext[0] value at start of repeat series
			// but without its preemptLength value as that is no longer relevant
			pContext[2] = xContext[0] & 0xFFFFF;
			// if there was a tryGap() lead-in then actual start is one frame earlier
			if ( pContext[2] > 0 ) pContext[2] -= xLeadIn;
			// carry the preemptLength for the next iteration in pContext[2] and mask
			// it out of pContext[0] as that field of pContext[0] is used for the handshake
			pContext[2] |= pContext[0] & 0xFFF00000;
			pContext[0] &= 0xFFFFF;
			contextLengthOut = 3;	// record the context length to be returned in the handshake
		}
		if (nContextLength > 3)
		{
			// set pContext[3] to the pContext[1] value at start of repeat series
			pContext[3] = xContext[1];
			contextLengthOut = 4;	// record the context length to be returned in the handshake
		}
		if (nContextLength > 5)
		{
			// set pContext[4,5] to the pContext[0,1] values at end of repeat series
			pContext[4] = yContext[0];
			pContext[5] = yContext[1];
			contextLengthOut = 6;
		}
		if (nContextLength > 7)
		{
			// Incoming, pContext[6,7] pass a 64-bit pointer to a Counts array used to calculate
			// the frequency of individual decodes.  Outgoing, pContext[6] provides the frequency of
			// the repeat series being reported in this return.
			pContext[6] = getFreq(pContext[2] & 0xFFFFF, (pContext[0] & 0xFFFFF) + (pContext[1]>>16) + MinFrame);
			contextLengthOut = 8;
		}
		if (nContextLength > 8)
		{
			// pContext[8] returns the note and aux note indexes (1-based, so add 1) for use by
			// IRScope, and the parameter value for the note.
			pContext[8] = iParam | (xNote_out + 1)<<16 | (xAuxNote_out + 1)<<24;
			contextLengthOut = 9;
		}

		if (contextLengthOut > 2)
		{
			// The handshake is that the 12-bit field in pContext[0] that normally carries the
			// preemptLength value is now used to carry a negative value, -(contextLengthOut-2).
			// The calling program checks to see if the top 8 bits of this value are 0xFF.  If
			// so then it is interpreted as a context length value, otherwise as a preemptLength
			// value.  So the maximum supported context length is 18, corresponding to 0xFF0.
			pContext[0] |= (2-contextLengthOut)<<20;
		}

		n = 0;
		if ( !bSuppressCount )
		{
			// nDittos = -1 means no dittos AND treat repeat frames as separate signals
			if ( xFrameCount == 1 && xDittos <= 0 )
			{
				n = sprintf(pMisc, *xMisc == 0 ? "no repeat" : "no repeat: ");
			}
			else if ( xFrameCount == 2 && xDittos <= 0 )	// nDittos < 0 should not occur in this case
			{
				n = sprintf(pMisc, *xMisc == 0 ? "+ 1 copy" : "+ 1 copy: ");
			}
			else if ( xDittos <= 0 )	// nDittos < 0 should not occur in this case
			{
				n = sprintf(pMisc, *xMisc == 0 ? "+ %d copies" : "+ %d copies: ", xFrameCount-1);
			}
			else if ( xFrameCount == 1 && xDittos == 1 )
			{
				n = sprintf(pMisc, *xMisc == 0 ? "+ 1 ditto" : "+ 1 ditto: ");
			}
			else if ( xFrameCount == 1 )
			{
				n = sprintf(pMisc, *xMisc == 0 ? "+ %d dittos" : "+ %d dittos: ", xDittos);
			}
			else	// this case should not occur
			{
				n = sprintf(pMisc, *xMisc == 0 ? "+ %d dittos, %d copies" : "+ %d dittos, %d copies: ", 
						xDittos, xFrameCount-1);
			}
		}
		// next line reports nStart and nFrameL for diagnostic purposes
		// n += sprintf(pMisc+n, "S=%d L=%d ", wContext[0]&0xFFFFF, (wContext[1]>>16)+MinFrame);
		strcpy(pMisc+n, xMisc);	// append original pMisc text
		*pError = 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %r12
callq 0x2734
movq 0x160(%r12), %rax
movq 0x168(%r12), %rcx
movl (%rax), %eax
movl %eax, -0x60(%rbp)
movl (%rcx), %eax
movl %eax, -0x5c(%rbp)
movq 0x170(%r12), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movl 0x88(%r12), %eax
movl %eax, -0x40(%rbp)
movl 0x8c(%r12), %eax
movl %eax, -0x64(%rbp)
movl 0x70(%r12), %eax
movl %eax, -0x54(%rbp)
movq (%r12), %rax
leaq 0x4(%rax), %rcx
movzbl 0x4(%rax), %edx
movl 0x78(%r12), %esi
incl %esi
cmpl %esi, %edx
sete %bl
cmpq $0x0, 0xd0(%r12)
setne %r15b
movq 0x178(%r12), %rdx
movl (%rdx), %esi
movl %esi, -0x68(%rbp)
movl 0xc(%rdx), %esi
movl %esi, -0x88(%rbp)
movq 0x4(%rdx), %rdx
movq %rdx, -0x90(%rbp)
leaq 0x80(%r12), %rdx
cmpl $0x0, 0x60(%r12)
leaq 0x84(%r12), %rsi
cmoveq %rax, %rdx
movl (%rdx), %eax
movq %rax, -0xb0(%rbp)
cmoveq %rcx, %rsi
movl (%rsi), %eax
movq %rax, -0xa8(%rbp)
movq 0x148(%r12), %r14
leaq -0x1c0(%rbp), %rdi
movq %r14, %rsi
callq 0x2100
movq 0x150(%r12), %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x2100
movq 0x158(%r12), %rax
cmpb $0x0, (%rax)
jne 0xfba3
cmpb $0x0, (%r14)
je 0xfba3
movq %r12, %r8
andb %r15b, %bl
movzbl %bl, %eax
movl %eax, -0x70(%rbp)
leaq 0x198(%r12), %rax
movq %rax, -0xb8(%rbp)
movl $0x1, %ebx
xorl %ecx, %ecx
movq %r12, -0x30(%rbp)
testl %ebx, %ebx
sete %dl
movq (%r8), %rax
movq %rax, -0x50(%rbp)
movl (%rax), %eax
movq -0x50(%rbp), %rsi
movl 0x4(%rsi), %esi
testb $0x1, %dl
movl -0x48(%rbp), %edx
cmovel %esi, %edx
movl %edx, -0x48(%rbp)
movl %eax, %edx
movl -0x3c(%rbp), %eax
movl %edx, -0x6c(%rbp)
cmovel %edx, %eax
movl %eax, -0x3c(%rbp)
movl 0x60(%r8), %eax
movl 0x68(%r8), %edx
movq %rax, -0x80(%rbp)
incl %eax
movl %eax, -0x74(%rbp)
movl %eax, 0x60(%r8)
testl %ecx, %ecx
movl %edx, -0x9c(%rbp)
movl %esi, -0x58(%rbp)
js 0xf057
movl $0x1, %ecx
testl %edx, %edx
jne 0xf059
movq 0x40(%r8), %rax
movss (%rax), %xmm0
xorl %ecx, %ecx
ucomiss 0x367e(%rip), %xmm0     # 0x126d0
seta %cl
jmp 0xf059
notl %ecx
movl %ecx, -0x38(%rbp)
movaps 0x2fad(%rip), %xmm0     # 0x12010
movups %xmm0, 0x180(%r8)
xorl %ebx, %ebx
movl %ebx, 0x190(%r8)
movq -0xb8(%rbp), %rdi
callq 0x116a8
movq -0x30(%rbp), %rax
movabsq $0x4e6e6b284e6e6b28, %rcx # imm = 0x4E6E6B284E6E6B28
movq %rcx, 0x1c8(%rax)
movq -0x30(%rbp), %rax
movl $0x4e6e6b28, 0x1d0(%rax) # imm = 0x4E6E6B28
movq -0x30(%rbp), %rax
movq $0x0, 0x1dc(%rax)
movq -0x30(%rbp), %rax
movl %ebx, 0x1e4(%rax)
movq -0x30(%rbp), %rdi
callq 0x2734
movq -0x30(%rbp), %r8
movq (%r8), %rax
movq %rax, -0x50(%rbp)
movl 0x4(%rax), %ecx
movzbl %cl, %eax
movl 0x78(%r8), %r14d
incl %r14d
cmpl %r14d, %eax
sete %r12b
movq 0xd0(%r8), %r13
testq %r13, %r13
setne %bl
movq 0x158(%r8), %rax
cmpb $0x0, (%rax)
jne 0xf810
movl %ecx, -0x98(%rbp)
movq 0x148(%r8), %rdi
movq %rdi, %r15
leaq -0x1c0(%rbp), %rsi
callq 0x21b0
movq -0x30(%rbp), %rcx
testl %eax, %eax
jne 0xf1bf
movq 0x160(%rcx), %rax
movl -0x60(%rbp), %edx
cmpl %edx, (%rax)
jne 0xf1bf
movq 0x168(%rcx), %rax
movl -0x5c(%rbp), %edx
cmpl %edx, (%rax)
jne 0xf1bf
movq 0x170(%rcx), %rax
movl -0x44(%rbp), %edx
cmpl %edx, (%rax)
jne 0xf1bf
movq 0x150(%rcx), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x21b0
movq -0x30(%rbp), %r8
testl %eax, %eax
jne 0xf1bf
cmpl $0x0, 0x68(%r8)
jne 0xf1bf
cmpl $0x0, 0x70(%r8)
jne 0xf1bf
andb %bl, %r12b
movzbl %r12b, %ecx
negl %ecx
movl -0x3c(%rbp), %eax
movl $0xfffff, %edi          # imm = 0xFFFFF
andl %edi, %eax
movl -0x48(%rbp), %edx
shrl $0x10, %edx
addl %eax, %edx
addl $0x2, %edx
movq -0x50(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
andl %edi, %esi
addl %ecx, %esi
cmpl %esi, %edx
jne 0xf1bf
xorl %edx, %edx
movl $0x0, %ecx
cmpl $0x0, -0x38(%rbp)
je 0xeff5
movq %r15, %r12
movb (%r15), %r15b
testb %r15b, %r15b
setne %al
movl -0x1c0(%rbp), %edx
cmpl $0x2d706147, %edx       # imm = 0x2D706147
sete %cl
andb %al, %cl
cmpb $0x1, %cl
movl %edx, -0x94(%rbp)
jne 0xf2dd
movl $0x4, %edx
movq %r12, %rdi
leaq 0x35d2(%rip), %rsi      # 0x127cc
callq 0x20a0
testl %eax, %eax
je 0xf2e2
movq -0x50(%rbp), %rax
movl (%rax), %eax
subl -0x3c(%rbp), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
cmpl $0x1, %eax
jne 0xf2e2
testq %r13, %r13
setne %al
movq -0x30(%rbp), %rbx
decl 0x60(%rbx)
movq 0x160(%rbx), %rcx
movl (%rcx), %ecx
movl %ecx, -0x60(%rbp)
movq 0x168(%rbx), %rcx
movl (%rcx), %ecx
movl %ecx, -0x5c(%rbp)
movq 0x170(%rbx), %rcx
movl (%rcx), %ecx
movl %ecx, -0x44(%rbp)
movl 0x88(%rbx), %ecx
movl %ecx, -0x40(%rbp)
movl 0x8c(%rbx), %ecx
movl %ecx, -0x64(%rbp)
movq -0x50(%rbp), %rsi
movzbl 0x4(%rsi), %ecx
cmpl %r14d, %ecx
sete %cl
andb %al, %cl
movq 0x178(%rbx), %rax
movl (%rax), %edx
movl %edx, -0x68(%rbp)
movl 0xc(%rax), %edx
movl %edx, -0x88(%rbp)
movq 0x4(%rax), %rax
movq %rax, -0x90(%rbp)
movq (%rsi), %rax
movq %rax, -0xb0(%rbp)
shrq $0x20, %rax
movq %rax, -0xa8(%rbp)
movzbl %cl, %eax
movl %eax, -0x70(%rbp)
leaq -0x1c0(%rbp), %rdi
movq %r12, %rsi
callq 0x2100
movq 0x150(%rbx), %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x2100
movq %rbx, %r8
xorl %ecx, %ecx
movl $0x1, %ebx
jmp 0xf802
testb %r15b, %r15b
je 0xf338
movl $0x4, %edx
movq %r12, %rdi
leaq 0x34db(%rip), %rsi      # 0x127cc
callq 0x20a0
testl %eax, %eax
jne 0xf30e
movq -0x50(%rbp), %rax
movl (%rax), %eax
subl -0x3c(%rbp), %eax
testl $0xffffe, %eax          # imm = 0xFFFFE
je 0xf6f9
cmpb $0x53, %r15b
jne 0xf31c
cmpb $0x3a, 0x1(%r12)
je 0xf35e
movl $0x8, %edx
movq %r12, %rdi
leaq 0x34a6(%rip), %rsi      # 0x127d1
callq 0x20a0
testl %eax, %eax
je 0xf33c
xorl %ebx, %ebx
jmp 0xf38d
movb $0x1, %bl
jmp 0xf38d
movzbl 0x8(%r12), %eax
cmpl $0x32, %eax
je 0xf356
cmpl $0x31, %eax
jne 0xf35e
cmpb $0x36, 0x9(%r12)
je 0xf334
jmp 0xf35e
cmpb $0x30, 0x9(%r12)
je 0xf334
movq -0x50(%rbp), %rax
movl (%rax), %eax
movl $0xfffff, %ecx          # imm = 0xFFFFF
andl %ecx, %eax
movl -0x98(%rbp), %edx
shrl $0x10, %edx
addl %eax, %edx
movl -0x3c(%rbp), %eax
andl %ecx, %eax
movl -0x48(%rbp), %ecx
shrl $0x10, %ecx
addl %eax, %ecx
xorl %ebx, %ebx
cmpl %ecx, %edx
jbe 0xf70d
movq %r12, %rdi
leaq 0x3443(%rip), %rsi      # 0x127da
callq 0x21b0
testl %eax, %eax
jne 0xf413
movl -0x1c0(%rbp), %eax
movl $0x3158, %ecx           # imm = 0x3158
xorl %ecx, %eax
movzbl -0x1be(%rbp), %ecx
xorl $0x30, %ecx
orw %ax, %cx
jne 0xf413
movq -0x30(%rbp), %rax
movq 0x170(%rax), %rax
movl -0x44(%rbp), %ecx
cmpl (%rax), %ecx
jne 0xf413
movq -0x30(%rbp), %rax
movq 0x178(%rax), %rax
movl -0x68(%rbp), %ecx
cmpl (%rax), %ecx
jne 0xf413
movl $0x1, %ebx
cmpl $0x0, -0x54(%rbp)
je 0xf400
movb $0x0, -0x2c0(%rbp)
movl $0x4, -0x40(%rbp)
movl $0xffffffff, -0x64(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x54(%rbp)
movq -0x30(%rbp), %r8
movl -0x38(%rbp), %ecx
jmp 0xf802
cmpb $0x53, %r15b
jne 0xf436
cmpb $0x3a, 0x1(%r12)
je 0xf472
movq %r12, %rdi
leaq 0x33b3(%rip), %rsi      # 0x127de
callq 0x21b0
testl %eax, %eax
jne 0xf45f
jmp 0xf472
movq %r12, %rdi
leaq 0x339e(%rip), %rsi      # 0x127de
callq 0x21b0
testl %eax, %eax
je 0xf472
cmpb $0x58, %r15b
jne 0xf45f
cmpb $0x58, 0x1(%r12)
jne 0xf45f
cmpb $0x0, 0x2(%r12)
je 0xf472
movq %r12, %rdi
leaq 0x338a(%rip), %rsi      # 0x127f3
callq 0x21b0
testl %eax, %eax
jne 0xf4d0
movq -0x1c0(%rbp), %rax
movabsq $0x6b657464696c6f53, %rcx # imm = 0x6B657464696C6F53
xorq %rcx, %rax
movq -0x1bd(%rbp), %rcx
movabsq $0x36316b65746469, %rdx # imm = 0x36316B65746469
xorq %rdx, %rcx
orq %rax, %rcx
je 0xf547
movq -0x1c0(%rbp), %rax
movabsq $0x6b657464696c6f53, %rcx # imm = 0x6B657464696C6F53
xorq %rcx, %rax
movq -0x1bd(%rbp), %rcx
movabsq $0x30326b65746469, %rdx # imm = 0x30326B65746469
xorq %rdx, %rcx
orq %rax, %rcx
je 0xf547
movl -0x94(%rbp), %edx
cmpl $0x796e6f53, %edx       # imm = 0x796E6F53
jne 0xf758
movl %edx, %r14d
movl $0x5, %edx
movq %r12, %rdi
leaq 0x331d(%rip), %rsi      # 0x12811
callq 0x20a0
movl %r14d, %edx
testl %eax, %eax
jne 0xf758
movq -0x30(%rbp), %rax
movq 0x150(%rax), %rax
cmpb $0x38, (%rax)
jne 0xf758
cmpb $0x30, 0x1(%rax)
jne 0xf758
movzbl 0x3(%rax), %ecx
cmpl $0x45, %ecx
je 0xf71a
cmpl $0x39, %ecx
jne 0xf758
cmpb $0x38, 0x4(%rax)
je 0xf720
jmp 0xf758
movl -0x1b8(%rbp), %eax
movl $0x3631, %ecx           # imm = 0x3631
xorl %ecx, %eax
movzbl -0x1b6(%rbp), %ecx
orw %ax, %cx
movl -0x5c(%rbp), %eax
cmovel -0x44(%rbp), %eax
movl -0x60(%rbp), %ecx
bswapl %ecx
movl %ecx, %edx
shrl $0x4, %edx
movl $0xf0f0f0f, %edi        # imm = 0xF0F0F0F
andl %edi, %edx
andl %edi, %ecx
shll $0x4, %ecx
orl %edx, %ecx
movl %ecx, %edx
movl $0x33333333, %esi       # imm = 0x33333333
andl %esi, %edx
shrl $0x2, %ecx
andl %esi, %ecx
leal (%rcx,%rdx,4), %ecx
movl %ecx, %edx
movl $0x50000000, %r8d       # imm = 0x50000000
andl %r8d, %edx
shrl %ecx
andl %r8d, %ecx
leal (%rcx,%rdx,2), %ecx
shrl $0x19, %ecx
bswapl %eax
movl %eax, %edx
shrl $0x4, %edx
andl %edi, %edx
movl %eax, %esi
andl %edi, %esi
shll $0x4, %esi
orl %edx, %esi
movl %esi, %edx
andl $0x10000000, %edx       # imm = 0x10000000
shrl $0x2, %esi
leal (%rsi,%rdx,4), %edx
andl %r8d, %edx
shll $0x5, %eax
andl $0x40000000, %eax       # imm = 0x40000000
leal (%rax,%rdx,2), %r13d
shrl $0x1d, %r13d
orl %ecx, %r13d
leaq -0x33(%rbp), %rdi
leaq 0x3927(%rip), %rsi      # 0x12f0c
movl %r13d, %edx
xorl %eax, %eax
callq 0x2060
movq -0x30(%rbp), %rax
movq 0x148(%rax), %r12
movq %r12, %rdi
leaq 0x31da(%rip), %rsi      # 0x127de
callq 0x21b0
testl %eax, %eax
jne 0xf623
movzwl -0x33(%rbp), %eax
xorl $0x3030, %eax           # imm = 0x3030
movzbl -0x31(%rbp), %ecx
orw %ax, %cx
je 0xf6f9
movq %r12, %rdi
leaq 0x31c6(%rip), %rsi      # 0x127f3
callq 0x21b0
testl %eax, %eax
jne 0xf66c
movq -0x30(%rbp), %rax
movq 0x160(%rax), %rax
cmpl $0x0, (%rax)
jne 0xf66c
movq -0x30(%rbp), %rax
movq 0x170(%rax), %rax
cmpl $0x0, (%rax)
jne 0xf66c
movzwl -0x33(%rbp), %eax
xorl $0x3030, %eax           # imm = 0x3030
movzbl -0x31(%rbp), %ecx
orw %ax, %cx
je 0xf6f9
cmpb $0x53, (%r12)
jne 0xf694
cmpb $0x3a, 0x1(%r12)
jne 0xf694
addq $0x5, %r12
movl $0x2, %edx
movq %r12, %rdi
leaq -0x33(%rbp), %rsi
callq 0x20a0
testl %eax, %eax
je 0xf6f9
xorl $0xff, %r13d
leaq -0x33(%rbp), %rdi
leaq 0x3866(%rip), %rsi      # 0x12f0c
movl %r13d, %edx
xorl %eax, %eax
callq 0x2060
movq -0x30(%rbp), %rax
movq 0x148(%rax), %rax
cmpb $0x58, (%rax)
jne 0xf80c
cmpb $0x58, 0x1(%rax)
jne 0xf80c
cmpb $0x0, 0x2(%rax)
jne 0xf80c
movq -0x30(%rbp), %rax
movq 0x150(%rax), %rdi
movl $0x2, %edx
leaq -0x33(%rbp), %rsi
callq 0x20a0
testl %eax, %eax
jne 0xf80c
movq -0x30(%rbp), %r8
decl 0x60(%r8)
movl -0x38(%rbp), %ecx
notl %ecx
xorl %ebx, %ebx
jmp 0xf802
movq -0x30(%rbp), %r8
decl 0x60(%r8)
jmp 0xf7fd
cmpb $0x36, 0x4(%rax)
jne 0xf758
movzbl 0x6(%rax), %ecx
cmpl $0x45, %ecx
je 0xf736
cmpl $0x39, %ecx
jne 0xf758
cmpb $0x38, 0x7(%rax)
je 0xf73c
jmp 0xf758
cmpb $0x36, 0x7(%rax)
jne 0xf758
movzbl 0x9(%rax), %ecx
cmpl $0x45, %ecx
je 0xf752
cmpl $0x39, %ecx
jne 0xf758
cmpb $0x38, 0xa(%rax)
je 0xf6f9
jmp 0xf758
cmpb $0x36, 0xa(%rax)
je 0xf6f9
testb %bl, %bl
jne 0xf80c
cmpl $0x2d504d58, %edx       # imm = 0x2D504D58
je 0xf774
cmpl $0x504d58, %edx         # imm = 0x504D58
jne 0xf80c
movq %r12, %rdi
leaq 0x309d(%rip), %rsi      # 0x1281b
callq 0x21b0
testl %eax, %eax
jne 0xf798
movq -0x50(%rbp), %rcx
movl (%rcx), %ecx
subl -0x3c(%rbp), %ecx
testl $0xfffff, %ecx          # imm = 0xFFFFF
je 0xf7ec
cmpb $0x58, %r15b
movq -0x30(%rbp), %r8
jne 0xf810
cmpb $0x4d, 0x1(%r12)
jne 0xf810
cmpb $0x50, 0x2(%r12)
jne 0xf810
movl -0x3c(%rbp), %ecx
movl $0xfffff, %esi          # imm = 0xFFFFF
andl %esi, %ecx
movl -0x48(%rbp), %edx
shrl $0x10, %edx
addl %edx, %ecx
addl $0x2, %ecx
movq -0x50(%rbp), %rdx
movl (%rdx), %edx
andl %esi, %edx
cmpl %edx, %ecx
jne 0xf810
cmpl $0x0, 0x64(%r8)
je 0xf810
cmpl $0x0, 0x7c(%r8)
je 0xf810
movl $0x1, %ebx
testl %eax, %eax
jne 0xf7fd
jmp 0xf7f7
movq -0x30(%rbp), %r8
cmpl $0x0, 0x7c(%r8)
je 0xf810
decl 0x60(%r8)
xorl %ebx, %ebx
movl -0x38(%rbp), %ecx
notl %ecx
testl %ecx, %ecx
jle 0xefe7
jmp 0xf810
movq -0x30(%rbp), %r8
movl 0x6c(%r8), %eax
testl %eax, %eax
jle 0xf82f
movq (%r8), %rcx
movl $0xfffff, %edx          # imm = 0xFFFFF
movl (%rcx), %ecx
andl %edx, %ecx
cmpl %eax, %ecx
movl -0x6c(%rbp), %eax
cmovael %edx, %eax
movl %eax, -0x6c(%rbp)
movl -0x1c0(%rbp), %eax
cmpl $0x43454e, %eax         # imm = 0x43454E
je 0xf8e0
movl $0x7843454e, %ecx       # imm = 0x7843454E
xorl -0x1c0(%rbp), %ecx
movzbl -0x1bc(%rbp), %edx
orl %ecx, %edx
je 0xf8e0
movl $0x4e2d3834, %ecx       # imm = 0x4E2D3834
xorl -0x1c0(%rbp), %ecx
movl $0x43454e, %edx         # imm = 0x43454E
xorl -0x1bd(%rbp), %edx
orl %ecx, %edx
je 0xf8e0
movl %eax, %ecx
xorl $0x43564a, %ecx         # imm = 0x43564A
movl -0x54(%rbp), %edx
orl %edx, %ecx
je 0xfb12
testl %edx, %edx
setne %cl
movl $0x4352, %edx           # imm = 0x4352
xorl -0x1c0(%rbp), %edx
movzbl -0x1be(%rbp), %esi
xorl $0x41, %esi
orw %dx, %si
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xfbb5
leaq -0x1c0(%rbp), %rdi
callq 0x2090
movq -0x30(%rbp), %r8
movl $0x646c4f28, -0x1c0(%rbp,%rax) # imm = 0x646C4F28
movw $0x29, -0x1bc(%rbp,%rax)
movl $0xb, -0x40(%rbp)
jmp 0xf925
cmpl $0x0, -0x80(%rbp)
jg 0xf8f4
cmpl $0x0, 0x68(%r8)
jne 0xf90e
cmpl $0x7, 0x24(%r8)
jl 0xf90e
leaq -0x1c0(%rbp), %rdi
callq 0x2090
movq -0x30(%rbp), %r8
movw $0x32, -0x1c0(%rbp,%rax)
movq 0xb0(%r8), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x2220
movq -0x30(%rbp), %r8
movl -0x58(%rbp), %ecx
movq (%r8), %rax
movl -0x6c(%rbp), %edx
movl %edx, (%rax)
movl %ecx, 0x4(%rax)
movq 0x160(%r8), %rax
movl -0x60(%rbp), %ecx
movl %ecx, (%rax)
movq 0x168(%r8), %rax
movl -0x5c(%rbp), %ecx
movl %ecx, (%rax)
movq 0x170(%r8), %rax
movl -0x44(%rbp), %ecx
movl %ecx, (%rax)
movq 0x178(%r8), %rax
movl -0x68(%rbp), %ecx
movl %ecx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x4(%rax)
movl -0x88(%rbp), %ecx
movl %ecx, 0xc(%rax)
movq 0x148(%r8), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x2100
movq -0x30(%rbp), %r8
xorl %eax, %eax
movl -0x9c(%rbp), %r9d
testl %r9d, %r9d
setg %al
movl -0x74(%rbp), %edx
movl %edx, %r14d
cmovgl %r9d, %r14d
movl -0x40(%rbp), %ecx
cmpl $-0x1, %ecx
leal 0x1(%rax,%rax), %r15d
cmovnel %ecx, %r15d
cmovnel %edx, %r14d
cmpl $0x3, 0x74(%r8)
jl 0xfa9f
movl $0xfffff, %eax          # imm = 0xFFFFF
movq -0xb0(%rbp), %rcx
andl %eax, %ecx
movq (%r8), %r12
movl %ecx, %esi
subl -0x70(%rbp), %esi
testl %ecx, %ecx
cmovel %ecx, %esi
movl (%r12), %r13d
movl %r13d, %ecx
andl $0xfff00000, %ecx       # imm = 0xFFF00000
orl %esi, %ecx
movl %ecx, 0x8(%r12)
andl %eax, %r13d
movl %r13d, (%r12)
movl $0xfff00000, %eax       # imm = 0xFFF00000
cmpl $0x4, 0x74(%r8)
jl 0xfa98
movq -0xa8(%rbp), %rax
movl %eax, 0xc(%r12)
movl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x6, 0x74(%r8)
jl 0xfa98
movl -0x3c(%rbp), %eax
movl %eax, 0x10(%r12)
movl -0x48(%rbp), %eax
movl %eax, 0x14(%r12)
movl $0xffc00000, %eax       # imm = 0xFFC00000
cmpl $0x8, 0x74(%r8)
jl 0xfa98
movzwl 0x6(%r12), %eax
leal (%rax,%r13), %edx
addl $0x2, %edx
movq %r8, %rdi
movl %r9d, %ebx
callq 0xee28
movl -0x74(%rbp), %edx
movl %ebx, %r9d
movq -0x30(%rbp), %r8
movl %eax, 0x18(%r12)
movl $0xffa00000, %eax       # imm = 0xFFA00000
cmpl $0x9, 0x74(%r8)
jl 0xfa98
shll $0x10, %r15d
addl $0x10000, %r15d         # imm = 0x10000
movl -0x64(%rbp), %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
orl %eax, %r14d
orl %r15d, %r14d
movl %r14d, 0x20(%r12)
movl $0xff900000, %eax       # imm = 0xFF900000
orl %eax, %r13d
movl %r13d, (%r12)
xorl %eax, %eax
cmpl $0x0, 0x64(%r8)
jne 0xfb80
cmpl $0x0, -0x80(%rbp)
sete %al
testl %r9d, %r9d
setle %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xfae1
movq 0x150(%r8), %rdi
cmpb $0x0, -0x2c0(%rbp)
leaq 0x2d6b(%rip), %rax      # 0x12840
leaq 0x2d6e(%rip), %rsi      # 0x1284a
jmp 0xfb71
testl %r9d, %r9d
setle %al
cmpl $0x2, %edx
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xfb39
movq 0x150(%r8), %rdi
cmpb $0x0, -0x2c0(%rbp)
leaq 0x2d4d(%rip), %rax      # 0x12856
leaq 0x2d4f(%rip), %rsi      # 0x1285f
jmp 0xfb71
leaq -0x1c0(%rbp), %rdi
callq 0x2090
movq -0x30(%rbp), %r8
movl $0x7d327b, -0x1c0(%rbp,%rax) # imm = 0x7D327B
movl $0x1, -0x40(%rbp)
jmp 0xf925
testl %r9d, %r9d
jle 0xfbd9
movl %r9d, %edx
xorl $0x1, %edx
movq 0x150(%r8), %rdi
movb -0x2c0(%rbp), %al
movq -0x80(%rbp), %rcx
orl %ecx, %edx
jne 0xfbff
testb %al, %al
leaq 0x2d1a(%rip), %rax      # 0x12884
leaq 0x2d1d(%rip), %rsi      # 0x1288e
cmoveq %rax, %rsi
xorl %eax, %eax
callq 0x2060
movq -0x30(%rbp), %r8
movslq %eax, %rdi
addq 0x150(%r8), %rdi
leaq -0x2c0(%rbp), %rsi
movq %r8, %rbx
callq 0x2100
movq 0x158(%rbx), %rax
movb $0x0, (%rax)
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzwl %ax, %ecx
cmpl $0x3f3f, %ecx           # imm = 0x3F3F
movl $0x8, %ecx
movl -0x40(%rbp), %edx
cmovel %ecx, %edx
cmpl $0x2d706147, %eax       # imm = 0x2D706147
cmovel %ecx, %edx
movl %edx, -0x40(%rbp)
jmp 0xf925
movq 0x150(%r8), %rdi
cmpb $0x0, -0x2c0(%rbp)
leaq 0x2c7c(%rip), %rax      # 0x1286a
leaq 0x2c81(%rip), %rsi      # 0x12876
cmoveq %rax, %rsi
movq -0x80(%rbp), %rdx
jmp 0xfc3d
testl %ecx, %ecx
je 0xfc26
testb %al, %al
leaq 0x2ca8(%rip), %rax      # 0x128b4
leaq 0x2cb8(%rip), %rsi      # 0x128cb
cmoveq %rax, %rsi
movl %r9d, %edx
xorl %eax, %eax
callq 0x2060
jmp 0xfb7c
testb %al, %al
leaq 0x2c6b(%rip), %rax      # 0x1289a
leaq 0x2c70(%rip), %rsi      # 0x128a6
cmoveq %rax, %rsi
movl %r9d, %edx
xorl %eax, %eax
callq 0x2060
jmp 0xfb7c
nop