// File: /workspace/github_cpp_makefile_star2_O2/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 $0x288, %rsp            # imm = 0x288
movq %rdi, %rbx
callq 0x26b8
movq 0x160(%rbx), %rax
movq 0x168(%rbx), %rcx
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movl (%rcx), %eax
movl %eax, -0x50(%rbp)
movq 0x170(%rbx), %rax
movl (%rax), %eax
movl %eax, -0x40(%rbp)
movl 0x88(%rbx), %eax
movl %eax, -0x38(%rbp)
movl 0x8c(%rbx), %eax
movl %eax, -0x58(%rbp)
movl 0x70(%rbx), %eax
movl %eax, -0x4c(%rbp)
movq (%rbx), %rax
movzbl 0x4(%rax), %ecx
movl 0x78(%rbx), %edx
incl %edx
cmpl %edx, %ecx
sete %cl
cmpq $0x0, 0xd0(%rbx)
setne %r15b
andb %cl, %r15b
movq 0x178(%rbx), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0xdeb8
movl (%rcx,%rdx,4), %esi
movl %esi, -0xa0(%rbp,%rdx,4)
incq %rdx
jmp 0xdea3
movl 0x60(%rbx), %ecx
leaq 0x80(%rbx), %rdx
xorl %esi, %esi
cmpq $0x2, %rsi
je 0xdee6
testl %ecx, %ecx
movq %rdx, %rdi
cmoveq %rax, %rdi
movl (%rdi), %edi
movl %edi, -0x74(%rbp,%rsi,4)
incq %rsi
addq $0x4, %rax
addq $0x4, %rdx
jmp 0xdec4
movq 0x148(%rbx), %r14
leaq -0x1b0(%rbp), %rdi
movq %r14, %rsi
movq %rbx, -0x30(%rbp)
callq 0x2120
movq -0x30(%rbp), %rax
movq 0x150(%rax), %rsi
leaq -0x2b0(%rbp), %rdi
callq 0x2120
movq -0x30(%rbp), %rsi
movq 0x158(%rsi), %rax
cmpb $0x0, (%rax)
jne 0xea74
cmpb $0x0, (%r14)
je 0xea74
movzbl %r15b, %eax
movl %eax, -0x5c(%rbp)
leaq 0x198(%rsi), %rax
movq %rax, -0xb0(%rbp)
pushq $0x1
popq %r14
xorl %ebx, %ebx
testl %r14d, %r14d
sete %al
movq (%rsi), %r12
testb $0x1, %al
je 0xdfb1
xorl %eax, %eax
cmpq $0x2, %rax
je 0xdf75
movl (%r12,%rax,4), %ecx
movl %ecx, -0x88(%rbp,%rax,4)
incq %rax
jmp 0xdf5f
movl 0x60(%rsi), %eax
movl 0x68(%rsi), %ecx
movq %rax, -0x80(%rbp)
incl %eax
movl %eax, 0x60(%rsi)
testl %ebx, %ebx
movl %ecx, -0x6c(%rbp)
movl %eax, -0x60(%rbp)
js 0xdfc6
pushq $0x1
popq %rax
movl %eax, -0x34(%rbp)
testl %ecx, %ecx
jne 0xdfcb
movq 0x40(%rsi), %rax
movss (%rax), %xmm0
xorl %eax, %eax
ucomiss 0x3727(%rip), %xmm0     # 0x116d0
seta %al
movl %eax, -0x34(%rbp)
jmp 0xdfcb
xorl %eax, %eax
cmpq $0x2, %rax
je 0xdf5d
movl (%r12,%rax,4), %ecx
movl %ecx, -0x48(%rbp,%rax,4)
incq %rax
jmp 0xdfb3
notl %ebx
movl %ebx, -0x34(%rbp)
movaps 0x303e(%rip), %xmm0     # 0x11010
movups %xmm0, 0x180(%rsi)
andl $0x0, 0x190(%rsi)
movq -0xb0(%rbp), %rdi
callq 0x1026a
movq -0x30(%rbp), %rdi
callq 0x26b8
movq -0x30(%rbp), %rsi
movq (%rsi), %r12
movl 0x4(%r12), %ecx
movzbl %cl, %eax
movl 0x78(%rsi), %r14d
incl %r14d
cmpl %r14d, %eax
sete %bl
movq 0xd0(%rsi), %rdx
testq %rdx, %rdx
setne %r15b
movq 0x158(%rsi), %rax
cmpb $0x0, (%rax)
jne 0xe6e3
movq %rdx, -0xa8(%rbp)
movl %ecx, -0x68(%rbp)
movq 0x148(%rsi), %rdi
movq %rdi, %r13
leaq -0x1b0(%rbp), %rsi
callq 0x21d0
movq -0x30(%rbp), %rcx
testl %eax, %eax
jne 0xe0e4
movq 0x160(%rcx), %rax
movl -0x54(%rbp), %edx
cmpl %edx, (%rax)
jne 0xe0e4
movq 0x168(%rcx), %rax
movl -0x50(%rbp), %edx
cmpl %edx, (%rax)
jne 0xe0e4
movq 0x170(%rcx), %rax
movl -0x40(%rbp), %edx
cmpl %edx, (%rax)
jne 0xe0e4
movq 0x150(%rcx), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x21d0
movq -0x30(%rbp), %rsi
testl %eax, %eax
jne 0xe0e4
cmpl $0x0, 0x68(%rsi)
jne 0xe0e4
cmpl $0x0, 0x70(%rsi)
jne 0xe0e4
andb %r15b, %bl
movzbl %bl, %eax
negl %eax
movl -0x48(%rbp), %ecx
movl $0xfffff, %edi          # imm = 0xFFFFF
andl %edi, %ecx
movzwl -0x42(%rbp), %edx
addl %edx, %ecx
addl $0x2, %ecx
movl (%r12), %edx
andl %edi, %edx
addl %eax, %edx
cmpl %edx, %ecx
jne 0xe0e4
xorl %eax, %eax
movl $0x0, %ebx
cmpl $0x0, -0x34(%rbp)
je 0xdf59
movq %r13, %r15
movb (%r13), %r13b
testb %r13b, %r13b
setne %al
movl -0x1b0(%rbp), %edx
cmpl $0x2d706147, %edx       # imm = 0x2D706147
sete %cl
andb %al, %cl
movl -0x34(%rbp), %ebx
notl %ebx
cmpb $0x1, %cl
movl %edx, -0x64(%rbp)
jne 0xe1b6
movq %r15, %rdi
leaq 0x36af(%rip), %rsi      # 0x117cc
pushq $0x4
popq %rdx
callq 0x20b0
testl %eax, %eax
je 0xe1bb
movl (%r12), %eax
subl -0x48(%rbp), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
cmpl $0x1, %eax
jne 0xe1bb
cmpq $0x0, -0xa8(%rbp)
setne %cl
movq -0x30(%rbp), %rdx
decl 0x60(%rdx)
movq 0x160(%rdx), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq 0x168(%rdx), %rax
movl (%rax), %eax
movl %eax, -0x50(%rbp)
movq 0x170(%rdx), %rax
movl (%rax), %eax
movl %eax, -0x40(%rbp)
movl 0x88(%rdx), %eax
movl %eax, -0x38(%rbp)
movl 0x8c(%rdx), %eax
movl %eax, -0x58(%rbp)
movzbl 0x4(%r12), %eax
cmpl %r14d, %eax
sete %al
andb %cl, %al
movq 0x178(%rdx), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0xe232
movl (%rcx,%rdx,4), %esi
movl %esi, -0xa0(%rbp,%rdx,4)
incq %rdx
jmp 0xe19d
testb %r13b, %r13b
je 0xe212
movq %r15, %rdi
leaq 0x3607(%rip), %rsi      # 0x117cc
pushq $0x4
popq %rdx
callq 0x20b0
testl %eax, %eax
jne 0xe1e3
movl (%r12), %eax
subl -0x48(%rbp), %eax
testl $0xffffe, %eax          # imm = 0xFFFFE
je 0xe5e8
cmpb $0x53, %r13b
jne 0xe1f4
cmpb $0x3a, 0x1(%r15)
je 0xe289
movq %r15, %rdi
leaq 0x35d3(%rip), %rsi      # 0x117d1
pushq $0x8
popq %rdx
callq 0x20b0
testl %eax, %eax
je 0xe21a
xorl %r14d, %r14d
jmp 0xe2b2
movb $0x1, %r14b
jmp 0xe2b2
movzbl 0x8(%r15), %eax
cmpl $0x32, %eax
je 0xe282
cmpl $0x31, %eax
jne 0xe289
cmpb $0x36, 0x9(%r15)
je 0xe20a
jmp 0xe289
xorl %ecx, %ecx
cmpq $0x2, %rcx
je 0xe247
movl (%r12,%rcx,4), %edx
movl %edx, -0x74(%rbp,%rcx,4)
incq %rcx
jmp 0xe234
movzbl %al, %eax
movl %eax, -0x5c(%rbp)
leaq -0x1b0(%rbp), %rdi
movq %r15, %rsi
callq 0x2120
movq -0x30(%rbp), %rax
movq 0x150(%rax), %rsi
leaq -0x2b0(%rbp), %rdi
callq 0x2120
movq -0x30(%rbp), %rsi
xorl %ebx, %ebx
pushq $0x1
popq %r14
jmp 0xe6d5
cmpb $0x30, 0x9(%r15)
je 0xe20a
movl (%r12), %eax
movl $0xfffff, %ecx          # imm = 0xFFFFF
andl %ecx, %eax
movl -0x68(%rbp), %edx
shrl $0x10, %edx
addl %eax, %edx
movl -0x48(%rbp), %eax
andl %ecx, %eax
movzwl -0x42(%rbp), %ecx
addl %eax, %ecx
xorl %r14d, %r14d
cmpl %ecx, %edx
jbe 0xe5f1
movq %r15, %rdi
leaq 0x351e(%rip), %rsi      # 0x117da
callq 0x21d0
testl %eax, %eax
jne 0xe336
leaq -0x1b0(%rbp), %rdi
leaq 0x3507(%rip), %rsi      # 0x117da
pushq $0x3
popq %rdx
callq 0x2170
testl %eax, %eax
jne 0xe336
movq -0x30(%rbp), %rax
movq 0x170(%rax), %rax
movl -0x40(%rbp), %ecx
cmpl (%rax), %ecx
jne 0xe336
movl -0xa0(%rbp), %eax
movq -0x30(%rbp), %rcx
movq 0x178(%rcx), %rcx
cmpl (%rcx), %eax
jne 0xe336
cmpl $0x0, -0x4c(%rbp)
je 0xe31f
movb $0x0, -0x2b0(%rbp)
pushq $-0x1
popq %rax
movl %eax, -0x58(%rbp)
pushq $0x4
popq %rax
movl %eax, -0x38(%rbp)
movl $0x0, -0x4c(%rbp)
pushq $0x1
popq %r14
movl -0x34(%rbp), %ebx
movq -0x30(%rbp), %rsi
jmp 0xe6d5
cmpb $0x53, %r13b
jne 0xe343
cmpb $0x3a, 0x1(%r15)
je 0xe37d
movq %r15, %rdi
leaq 0x3491(%rip), %rsi      # 0x117de
callq 0x21d0
testl %eax, %eax
je 0xe37d
cmpb $0x58, %r13b
jne 0xe36a
cmpb $0x58, 0x1(%r15)
jne 0xe36a
cmpb $0x0, 0x2(%r15)
je 0xe37d
movq %r15, %rdi
leaq 0x347f(%rip), %rsi      # 0x117f3
callq 0x21d0
testl %eax, %eax
jne 0xe3b5
leaq -0x1b0(%rbp), %rdi
leaq 0x3470(%rip), %rsi      # 0x117fb
pushq $0xb
popq %rdx
callq 0x2170
testl %eax, %eax
je 0xe42f
leaq -0x1b0(%rbp), %rdi
leaq 0x345d(%rip), %rsi      # 0x11806
pushq $0xb
popq %rdx
callq 0x2170
testl %eax, %eax
je 0xe42f
movl -0x64(%rbp), %edx
cmpl $0x796e6f53, %edx       # imm = 0x796E6F53
jne 0xe63b
movq %r15, %rdi
leaq 0x3443(%rip), %rsi      # 0x11811
movl %r14d, -0x34(%rbp)
movl %edx, %r14d
pushq $0x5
popq %rdx
callq 0x20b0
movl %r14d, %edx
movl -0x34(%rbp), %r14d
testl %eax, %eax
jne 0xe63b
movq -0x30(%rbp), %rax
movq 0x150(%rax), %rax
cmpb $0x38, (%rax)
jne 0xe63b
cmpb $0x30, 0x1(%rax)
jne 0xe63b
movzbl 0x3(%rax), %ecx
cmpl $0x45, %ecx
je 0xe5fd
cmpl $0x39, %ecx
jne 0xe63b
cmpb $0x38, 0x4(%rax)
je 0xe603
jmp 0xe63b
leaq -0x1a8(%rbp), %rdi
leaq 0x3c1f(%rip), %rsi      # 0x1205c
pushq $0x3
popq %rdx
callq 0x2170
testl %eax, %eax
movl -0x50(%rbp), %eax
cmovel -0x40(%rbp), %eax
movl -0x54(%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 -0x3b(%rbp), %rdi
leaq 0x3a3e(%rip), %rsi      # 0x11f0c
movl %r13d, %edx
xorl %eax, %eax
callq 0x2060
movq -0x30(%rbp), %rax
movq 0x148(%rax), %r12
movq %r12, %rdi
leaq 0x32f1(%rip), %rsi      # 0x117de
callq 0x21d0
testl %eax, %eax
jne 0xe511
leaq -0x3b(%rbp), %rdi
leaq 0x3bd8(%rip), %rsi      # 0x120d9
pushq $0x3
popq %rdx
callq 0x2170
testl %eax, %eax
je 0xe5e8
movq %r12, %rdi
leaq 0x32d8(%rip), %rsi      # 0x117f3
callq 0x21d0
testl %eax, %eax
jne 0xe55f
movq -0x30(%rbp), %rax
movq 0x160(%rax), %rax
cmpl $0x0, (%rax)
jne 0xe55f
movq -0x30(%rbp), %rax
movq 0x170(%rax), %rax
cmpl $0x0, (%rax)
jne 0xe55f
leaq -0x3b(%rbp), %rdi
leaq 0x3b8a(%rip), %rsi      # 0x120d9
pushq $0x3
popq %rdx
callq 0x2170
testl %eax, %eax
je 0xe5e8
cmpb $0x53, (%r12)
jne 0xe585
cmpb $0x3a, 0x1(%r12)
jne 0xe585
addq $0x5, %r12
movq %r12, %rdi
leaq -0x3b(%rbp), %rsi
pushq $0x2
popq %rdx
callq 0x20b0
testl %eax, %eax
je 0xe5e8
xorl $0xff, %r13d
leaq -0x3b(%rbp), %rdi
leaq 0x3975(%rip), %rsi      # 0x11f0c
movl %r13d, %edx
xorl %eax, %eax
callq 0x2060
movq -0x30(%rbp), %rax
movq 0x148(%rax), %rax
cmpb $0x58, (%rax)
jne 0xe6df
cmpb $0x58, 0x1(%rax)
jne 0xe6df
cmpb $0x0, 0x2(%rax)
jne 0xe6df
movq -0x30(%rbp), %rax
movq 0x150(%rax), %rdi
leaq -0x3b(%rbp), %rsi
pushq $0x2
popq %rdx
callq 0x20b0
testl %eax, %eax
jne 0xe6df
movq -0x30(%rbp), %rsi
jmp 0xe6cf
movq -0x30(%rbp), %rsi
decl 0x60(%rsi)
jmp 0xe6d5
cmpb $0x36, 0x4(%rax)
jne 0xe63b
movzbl 0x6(%rax), %ecx
cmpl $0x45, %ecx
je 0xe619
cmpl $0x39, %ecx
jne 0xe63b
cmpb $0x38, 0x7(%rax)
je 0xe61f
jmp 0xe63b
cmpb $0x36, 0x7(%rax)
jne 0xe63b
movzbl 0x9(%rax), %ecx
cmpl $0x45, %ecx
je 0xe635
cmpl $0x39, %ecx
jne 0xe63b
cmpb $0x38, 0xa(%rax)
je 0xe5e8
jmp 0xe63b
cmpb $0x36, 0xa(%rax)
je 0xe5e8
testb %r14b, %r14b
jne 0xe6df
cmpl $0x2d504d58, %edx       # imm = 0x2D504D58
je 0xe658
cmpl $0x504d58, %edx         # imm = 0x504D58
jne 0xe6df
movq %r15, %rdi
leaq 0x31b9(%rip), %rsi      # 0x1181b
callq 0x21d0
testl %eax, %eax
jne 0xe67a
movl (%r12), %ecx
subl -0x48(%rbp), %ecx
testl $0xfffff, %ecx          # imm = 0xFFFFF
je 0xe6c5
cmpb $0x58, %r13b
movq -0x30(%rbp), %rsi
jne 0xe6e3
cmpb $0x4d, 0x1(%r15)
jne 0xe6e3
cmpb $0x50, 0x2(%r15)
jne 0xe6e3
movl -0x48(%rbp), %ecx
movl $0xfffff, %edi          # imm = 0xFFFFF
andl %edi, %ecx
movzwl -0x42(%rbp), %edx
addl %edx, %ecx
addl $0x2, %ecx
movl (%r12), %edx
andl %edi, %edx
cmpl %edx, %ecx
jne 0xe6e3
cmpl $0x0, 0x64(%rsi)
je 0xe6e3
cmpl $0x0, 0x7c(%rsi)
je 0xe6e3
pushq $0x1
popq %r14
testl %eax, %eax
jne 0xe6d5
jmp 0xe6cf
movq -0x30(%rbp), %rsi
cmpl $0x0, 0x7c(%rsi)
je 0xe6e3
decl 0x60(%rsi)
xorl %r14d, %r14d
testl %ebx, %ebx
jle 0xdf50
jmp 0xe6e3
movq -0x30(%rbp), %rsi
movl 0x6c(%rsi), %eax
testl %eax, %eax
jle 0xe702
movq (%rsi), %rcx
movl $0xfffff, %edx          # imm = 0xFFFFF
andl (%rcx), %edx
cmpl %eax, %edx
jb 0xe702
movl $0xfffff, -0x88(%rbp)   # imm = 0xFFFFF
movl -0x1b0(%rbp), %r14d
cmpl $0x43454e, %r14d        # imm = 0x43454E
je 0xe7bb
leaq 0x3109(%rip), %rsi      # 0x11826
leaq -0x1b0(%rbp), %rdi
pushq $0x5
popq %rdx
callq 0x2170
movq -0x30(%rbp), %rsi
testl %eax, %eax
je 0xe7bb
leaq 0x30ec(%rip), %rsi      # 0x1182b
leaq -0x1b0(%rbp), %rdi
pushq $0x7
popq %rdx
callq 0x2170
movq -0x30(%rbp), %rsi
testl %eax, %eax
je 0xe7bb
movl %r14d, %eax
xorl $0x43564a, %eax         # imm = 0x43564A
movl -0x4c(%rbp), %ecx
orl %ecx, %eax
je 0xe9ec
testl %ecx, %ecx
setne %bl
leaq 0x30c1(%rip), %rsi      # 0x11836
leaq -0x1b0(%rbp), %rdi
pushq $0x3
popq %rdx
callq 0x2170
testl %eax, %eax
sete %al
andb %bl, %al
cmpb $0x1, %al
jne 0xea86
leaq -0x1b0(%rbp), %rdi
callq 0x20a0
movl $0x646c4f28, -0x1b0(%rbp,%rax) # imm = 0x646C4F28
movw $0x29, -0x1ac(%rbp,%rax)
pushq $0xb
jmp 0xea05
cmpl $0x0, -0x80(%rbp)
jg 0xe7cd
cmpl $0x0, 0x68(%rsi)
jne 0xe7e7
cmpl $0x7, 0x24(%rsi)
jl 0xe7e7
leaq -0x1b0(%rbp), %rdi
callq 0x20a0
movq -0x30(%rbp), %rsi
movw $0x32, -0x1b0(%rbp,%rax)
movq 0xb0(%rsi), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x2240
movq -0x30(%rbp), %rsi
movq (%rsi), %rax
xorl %ecx, %ecx
cmpq $0x2, %rcx
je 0xe818
movl -0x88(%rbp,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
jmp 0xe803
movq 0x160(%rsi), %rax
movl -0x54(%rbp), %ecx
movl %ecx, (%rax)
movq 0x168(%rsi), %rax
movl -0x50(%rbp), %ecx
movl %ecx, (%rax)
movq 0x170(%rsi), %rax
movl -0x40(%rbp), %ecx
movl %ecx, (%rax)
movq 0x178(%rsi), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0xe85a
movl -0xa0(%rbp,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
jmp 0xe845
movq 0x148(%rsi), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x2120
movq -0x30(%rbp), %r8
xorl %eax, %eax
movl -0x6c(%rbp), %r9d
testl %r9d, %r9d
setg %al
movl -0x60(%rbp), %edi
movl %edi, %r14d
cmovgl %r9d, %r14d
movl -0x38(%rbp), %ecx
cmpl $-0x1, %ecx
leal 0x1(%rax,%rax), %r15d
cmovnel %ecx, %r15d
cmovnel %edi, %r14d
cmpl $0x3, 0x74(%r8)
jl 0xe977
movl $0xfffff, %eax          # imm = 0xFFFFF
movl -0x74(%rbp), %ecx
andl %eax, %ecx
movq (%r8), %r12
movl %ecx, %esi
subl -0x5c(%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 0xe970
movl -0x70(%rbp), %eax
movl %eax, 0xc(%r12)
movl $0xffe00000, %eax       # imm = 0xFFE00000
cmpl $0x6, 0x74(%r8)
jl 0xe970
movl -0x48(%rbp), %eax
movl %eax, 0x10(%r12)
movl -0x44(%rbp), %eax
movl %eax, 0x14(%r12)
movl $0xffc00000, %eax       # imm = 0xFFC00000
cmpl $0x8, 0x74(%r8)
jl 0xe970
movzwl 0x6(%r12), %eax
leal (%rax,%r13), %edx
addl $0x2, %edx
movq %r8, %rdi
movl %r9d, %ebx
callq 0xddb8
movl -0x60(%rbp), %edi
movl %ebx, %r9d
movq -0x30(%rbp), %r8
movl %eax, 0x18(%r12)
movl $0xffa00000, %eax       # imm = 0xFFA00000
cmpl $0x9, 0x74(%r8)
jl 0xe970
shll $0x10, %r15d
addl $0x10000, %r15d         # imm = 0x10000
movl -0x58(%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 0xea51
movq -0x80(%rbp), %rdx
testl %edx, %edx
sete %al
testl %r9d, %r9d
setle %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xe9bb
movq 0x150(%r8), %rdi
cmpb $0x0, -0x2b0(%rbp)
leaq 0x2e91(%rip), %rax      # 0x11840
leaq 0x2e94(%rip), %rsi      # 0x1184a
jmp 0xea42
testl %r9d, %r9d
setle %al
cmpl $0x2, %edi
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xea0e
movq 0x150(%r8), %rdi
cmpb $0x0, -0x2b0(%rbp)
leaq 0x2e73(%rip), %rax      # 0x11856
leaq 0x2e75(%rip), %rsi      # 0x1185f
jmp 0xea42
leaq -0x1b0(%rbp), %rdi
callq 0x20a0
movl $0x7d327b, -0x1b0(%rbp,%rax) # imm = 0x7D327B
pushq $0x1
popq %rax
movl %eax, -0x38(%rbp)
jmp 0xe7fa
testl %r9d, %r9d
jle 0xeaa7
movl %r9d, %ecx
xorl $0x1, %ecx
movq 0x150(%r8), %rdi
movb -0x2b0(%rbp), %al
orl %edx, %ecx
jne 0xeac9
testb %al, %al
leaq 0x2e49(%rip), %rax      # 0x11884
leaq 0x2e4c(%rip), %rsi      # 0x1188e
cmoveq %rax, %rsi
xorl %eax, %eax
callq 0x2060
movq -0x30(%rbp), %r8
movslq %eax, %rdi
addq 0x150(%r8), %rdi
leaq -0x2b0(%rbp), %rsi
movq %r8, %rbx
callq 0x2120
movq 0x158(%rbx), %rax
movb $0x0, (%rax)
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpw $0x3f3f, %r14w          # imm = 0x3F3F
pushq $0x8
popq %rax
movl -0x38(%rbp), %ecx
cmovel %eax, %ecx
cmpl $0x2d706147, %r14d      # imm = 0x2D706147
cmovel %eax, %ecx
movl %ecx, -0x38(%rbp)
jmp 0xe7fa
movq 0x150(%r8), %rdi
cmpb $0x0, -0x2b0(%rbp)
leaq 0x2dae(%rip), %rax      # 0x1186a
leaq 0x2db3(%rip), %rsi      # 0x11876
cmoveq %rax, %rsi
jmp 0xeb0a
testl %edx, %edx
je 0xeaf3
testb %al, %al
leaq 0x2dde(%rip), %rax      # 0x118b4
movq %rdx, %rcx
leaq 0x2deb(%rip), %rsi      # 0x118cb
cmoveq %rax, %rsi
movl %r9d, %edx
xorl %eax, %eax
callq 0x2060
jmp 0xea4d
testb %al, %al
leaq 0x2d9e(%rip), %rax      # 0x1189a
leaq 0x2da3(%rip), %rsi      # 0x118a6
cmoveq %rax, %rsi
movl %r9d, %edx
xorl %eax, %eax
callq 0x2060
jmp 0xea4d