// File: /workspace/github_cpp_makefile_star2_O1/probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::tryCanalSat()
void Signal::tryCanalSat()	// GD 2009  Added tryCanalSat

// CanalSat		{55.5k,250,msb}<-1,1|1,-1>(T=0,(1,-1,D:7,S:6,T:1,0:1,F:7,-89m,T=1)+) 
// where T=0 for the first frame and T=1 for all repeats
// (PID = 018C)
// CanalSatLD     {56k,320,msb}<-1,1|1,-1>(T=0,(1,-1,D:7,S:6,T:1,0:1,F:6,~F:1,-85m,T=1)+)  DAR Aug 2012
// Amino		{56.0k,268,msb}<-1,1|1,-1>(T=1,(7,-6,3,D:4,1:1,T:1,1:2,0:8,F:8,15:4,C:4,-79m,T=0)+)
// also 36k is used
// where T=1 for first frame and T=0 for all repeat frames
// with C = sum of the first 7 nibbles mod 15

// Zaptor		{36k,330,msb}<-1,1|1,-1>(8,-6,2,D:8,T:1,S:7,F:8,E:4,C:4,-74m)+
// where T=0 for all frames except the last, T=1 for last frame, E is a checksum seed
// with C = (D:4+D:4:4+S:4+S:3:4+8*T+F:4+F:4:4+E)&15

{
	int HB;
	static int M = 0;	// toggle mask or previous T	
	int T = 0;				// toggle
	static int FC = 0;	// count of bypassed frames
	static int confBits1to32 = 0;	// DAR July 2011
	static int confBits34to65 = 0;	//filled in when a toggle changes state  DAR July 2011

	if ( nFrameL < 11 || nTotDur < 5000) return;
	if (*pFrame < 1000)
	{	
		if (sortBurst.min3 < 570) 
		{                         
			HB = 250;
		}
		else 
		{
			HB = 320;            //DAR AUG 2012 add CanalSatLD                                       
		}
		if (	*pFrame < HB*.5 
			||	nMaxDur < .5*HB 
			||	nMaxDur > 2.5*HB ) 
		{
			return;
		}
	}
	else
	{
		//if (nFreq > 46000)  //DAR March 2011 Some Amino is 36KHz  
		if (sortBurst.min3 < 600) //so use burst times instead
		{                         
			HB = 270;
		}
		else 
		{
			HB = 330;                                                   
		}
		if (	nMaxDur != *pFrame 
			||	nMaxDur < 3.5*HB 
			||	nMaxDur > 14*HB ) // First ON nominally 7 or 8 half bits
		{
			return;
		}
	}

	if (   !framed(40*HB)
		|| sortOn.min1 < HB * .3
		|| sortOn.max2 > HB * 4.5		// nominal 4
        || sortBurst.max2 > HB * 7  )	// nominal 4,-2
	{
		return;
	}

    minGlitch = HB*.25;
	nMinShort2 = HB * .5;
	nMaxShort2 = HB * 1.5;

	cleanup();
	nBit = 1;
	nState = (HB == 270 || HB == 330) ? 0 : 1;
	pBit += 2 - nState;

	while (pBit < pFrameEnd)
	{
		if ( nBit == 1 || ((HB == 270 || HB == 330) && nBit == 2))
		{
			int pulseL = (HB == 270 || HB == 330) && nBit == 1;						// Is initial long MARK?
			nMinShort = HB * (pulseL ? HB == 330 ? 1.5 : 2.4 : .5);	// nominally 2 : 3 : 1
			nMaxShort = nMinLong = HB * (pulseL ? HB == 330 ? 2.5 : 3.5 : 1.5);	// nominally 2 v 3 : 3 v 4 : 1 v 2
			nMaxLong = HB * (pulseL ? HB == 330 ? 3.6 : 4.8 : 2.5);	// nominally 3 : 4 : 2
		}
		if ( ! phaseBit() ) return;
	}
	if ( nBit != ( (HB == 270 || HB == 330) ? 33 : 23 ) ) return;		// wrong number of bits
	if ( (HB == 250 || HB == 320) && getLsb(15,1) ) return;            // bit 15 must be zero for CanalSat

	// look to see if there is a following frame
	float* pFrameEnd1 = pFrameEnd;					// save for later restoration
	float* pFrameEnd2 = pFrameEnd + 1;
	for ( ; pFrameEnd2 < pMainLimit; pFrameEnd2++ )
	{
		if ( *pFrameEnd2 > 40 * HB ) break;
	};
	nState = (HB == 270 || HB == 330) ? 0 : 1;
	pBit = pFrameEnd + 3 - nState;
	pFrameEnd = pFrameEnd2;							// temp change for use by phaseBit{}
	nBit++;

	while ( pBit < pFrameEnd )
	{
		if ( (HB == 270 || HB == 330) && nBit <= 35 )
		{
			int pulseL = nBit == 34;
			nMinShort = HB * (pulseL ? HB == 330 ? 1.5 : 2.4 : .5);
			nMaxShort = nMinLong = HB * (pulseL ? HB == 330 ? 2.5 : 3.5 : 1.5);
			nMaxLong = HB * (pulseL ? HB == 330 ? 3.6 : 4.8 : 2.5);
		}
		if ( ! phaseBit() ) break;
	}
	pFrameEnd = pFrameEnd1;							// restore original value
	makeMsb();
	if ( (HB == 270 || HB == 330) )  //much of the below Amino/Zaptor stuff revised by DAR July 2011
	{
		int s = 0;	// For Amino andZaptor protocols, check checksum
		int tmp1 = getMsb(1,32);  
		int tmp2 = getMsb(34,32); 
		for (int n=1; n<29; n+=4) s += getMsb(n,4);
		if ( getMsb(29,4) != (s&15) ) return; 
		if ( nBit == 66 )
		{
			s = 0;   // check checksum of second frame
			for (int n=34; n<62; n+=4) s += getMsb(n,4);	
			if ( getMsb(62,4) != (s&15) ) return;
			T = ((tmp1 ^ tmp2) & 0xFFFFFFF0);	//mask off checksum nibble
			if ((T == 0x04000000) 			//Amino confirmed; also means subdevice and function codes match
					&& (tmp1 & 0x04000000))		// repeat bit changed from 1 to 0, so tmp1 is a start frame 
			{
				AminoToggleDetected = true;
				confBits1to32 = tmp1;
				confBits34to65 = tmp2;
				if ( FC == 0 ) setzContext();			// save the context value
				FC++;	
				return;			// wait for repeat to come round
			}
			if	((T == 0x00800000)			//Zaptor confirmed; also shows subdevice and function codes match
					&& (tmp2 & 0x00800000)) //repeat bit changed from 0 to 1, so tmp2 is an end frame 
			{  
				ZaptorToggleDetected = true;
				confBits1to32 = tmp1;
				confBits34to65 = tmp2;
			}
		}
	}
	if ( (HB == 250 || HB == 320)&&	nBit == 46 )
	{
		T = getMsb(14,1) ^ getMsb(37,1);				// difference between the toggle values
		if	(	( (M == 0) ^ (T == 0) )					// exactly one of M and T must be zero
			&&	getMsb(1,13) == getMsb(24,13)			// all bits other than toggle must be equal
			&&	getMsb(15,8) == getMsb(38,8) )
		{
			M = 1;										// next frame is valid repeat
			if ( FC == 0 ) setzContext();				// save the context value
			FC++;										// increment count of bypassed frames
			return;										// wait for repeat to come round
		}
	}					
	if ( HB == 250 )
	{
		*pDevice = getMsb(1,7);
		*pSubDevice = getMsb(8,6);
		*pOBC = getMsb(16,7);
		pHex[0] = *pOBC << 1;
		strcpy( pProtocol, "CanalSat" );
		nNote_out = 4;
		strcpy( pMisc, M == 0 ? (nNote_out = 1, nAuxNote_out = 1, "no start frame") : "");
	}
	else if ( HB == 320 )
	{
		*pDevice = getMsb(1,7);
		*pSubDevice = getMsb(8,6);
		*pOBC = getMsb(16,6);
		strcpy( pProtocol, "CanalSatLD" );
		nNote_out = 4;
		strcpy( pMisc, M == 0 ? (nNote_out = 1, nAuxNote_out = 1, "no start frame") : "");
	}
	else 
	{
		if (AminoToggleDetected) HB = 270;		
		else if (ZaptorToggleDetected) HB = 330;	
		else 
		{
			confBits1to32 = getMsb(1,32);
			int tmp3 = confBits1to32 & 0x000000F0; 
			if (tmp3 == 0xF0) HB = 270;			//Amino decided by seed nibble
			else if (tmp3 == 0x50) HB = 330;	//Zaptor 
		}	//  else decide protocol by already determined HB duration 	
		if ( HB == 270 )					//Amino
		{
			*pDevice = (confBits1to32 >> 28) & 0xF;	
			*pSubDevice = (confBits1to32 >> 16) & 0xFF;  //always zero according to the Amino spec
			*pOBC = (confBits1to32 >> 8) & 0xFF;   
			pHex[0] = *pOBC;
			int seed = (confBits1to32 >> 4) & 0xF;
			if (seed != 0x0F) sprintf(pMisc, "E = %d", seed);
			if (nFreq > 46000) strcpy( pProtocol, "Amino-56");
			else strcpy( pProtocol, "Amino-36");
			if (AminoToggleDetected)  nNote_out = 4;
			else
			{
				nNote_out = 1;
				if ((confBits1to32 & 0x04000000) == 0) 
				{
					nAuxNote_out = 1;
					if (*pMisc){strcat(pMisc, ", ");}
					strcat(pMisc, "no start frame");
				}
				else 
				{
					nAuxNote_out = 0;
					if (*pMisc){strcat(pMisc, ", ");}
					strcat(pMisc, "no end frame");
				}
			}
		}
		else if ( HB == 330 )  //Zaptor
		{
			if (!ZaptorToggleDetected && (nBit == 66))  
			{
					if ( FC == 0 ) setzContext();	// save the context value
					FC++;	
					return;			// wait for repeat to come round
			}
			*pDevice = (confBits1to32 >> 24) & 0xFF;
			*pSubDevice = (confBits1to32 >> 16) & 0x7F;  
			*pOBC = (confBits1to32 >> 8) & 0xFF;   
			pHex[0] = *pOBC;
			int seed = (confBits1to32 >> 4) & 0xF;
			if (nFreq > 46000) strcpy( pProtocol, "Zaptor-56");
			else strcpy( pProtocol, "Zaptor-36");
			if (seed != 5) sprintf(pMisc, "E = %d", seed);
			if (ZaptorToggleDetected) nNote_out = 5;  
			else if ((confBits1to32 & 0x00800000) == 0)
			{
				nNote_out = 1;
				nAuxNote_out = 0;
				if (*pMisc){strcat(pMisc, ", ");}
				strcat(pMisc, "no end frame");
			}
			else
			{
				nNote_out = 0;
				nAuxNote_out = 6;
				if (*pMisc){strcat(pMisc, ", ");}
				strcat(pMisc, "no start frame");
			}
		}
	}
	nFrameCount = FC;
	M = 0;		// reset static variables
	FC = 0;		
}

// Assembly:
cmpl $0xb, 0x48(%rdi)
jl 0xca97
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movss 0x66f6(%rip), %xmm0     # 0x125f0
ucomiss 0x98(%rdi), %xmm0
ja 0xca89
movq 0x38(%rbx), %rax
movss (%rax), %xmm0
movss 0x6631(%rip), %xmm1     # 0x12548
ucomiss %xmm0, %xmm1
movss 0x1c8(%rbx), %xmm1
jbe 0xbf8b
movss 0x6718(%rip), %xmm2     # 0x12644
ucomiss %xmm1, %xmm2
movl $0xfa, %ecx
movl $0x140, %r15d           # imm = 0x140
cmoval %ecx, %r15d
xorps %xmm2, %xmm2
cvtss2sd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd 0x617b(%rip), %xmm1     # 0x120d0
mulsd %xmm0, %xmm1
ucomisd %xmm2, %xmm1
ja 0xca89
xorps %xmm2, %xmm2
cvtss2sd 0x9c(%rbx), %xmm2
ucomisd %xmm2, %xmm1
ja 0xca89
mulsd 0x6200(%rip), %xmm0     # 0x12180
ucomisd %xmm0, %xmm2
jbe 0xbff9
jmp 0xca89
movss 0x6615(%rip), %xmm2     # 0x125a8
ucomiss %xmm1, %xmm2
movl $0x10e, %ecx            # imm = 0x10E
movl $0x14a, %r15d           # imm = 0x14A
cmoval %ecx, %r15d
movss 0x9c(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0xca89
jp 0xca89
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
xorps %xmm2, %xmm2
cvtsi2sd %r15d, %xmm2
mulsd 0x63ed(%rip), %xmm2     # 0x123c0
ucomisd %xmm0, %xmm2
ja 0xca89
movl %r15d, %edx
shll $0x4, %edx
subl %r15d, %edx
subl %r15d, %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
ucomiss %xmm0, %xmm1
ja 0xca89
leal (,%r15,8), %ecx
leal (%rcx,%rcx,4), %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
movss 0x140(%rbx), %xmm0
movss %xmm1, -0x40(%rbp)
ucomiss %xmm1, %xmm0
jb 0xca89
xorps %xmm0, %xmm0
cvtss2sd 0x180(%rbx), %xmm0
xorps %xmm2, %xmm2
cvtsi2sd %r15d, %xmm2
movsd 0x611c(%rip), %xmm1     # 0x12158
mulsd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
ja 0xca89
xorps %xmm0, %xmm0
cvtss2sd 0x188(%rbx), %xmm0
movsd 0x610b(%rip), %xmm1     # 0x12168
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
ja 0xca89
subl %r15d, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss 0x1e0(%rbx), %xmm1
ucomiss %xmm0, %xmm1
ja 0xca89
movsd 0x60e2(%rip), %xmm0     # 0x12170
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xe0(%rbx)
movsd 0x602a(%rip), %xmm0     # 0x120d0
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movsd 0x60c2(%rip), %xmm1     # 0x12178
mulsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
movss %xmm0, 0xf4(%rbx)
movss %xmm1, 0xf8(%rbx)
leaq 0xa0(%rbx), %rcx
movq %rcx, -0x58(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0xa0(%rbx)
movl $0x1, 0xc0(%rbx)
cmpl $0x10e, %r15d           # imm = 0x10E
setne %cl
xorl %edx, %edx
cmpl $0x14a, %r15d           # imm = 0x14A
setne %dl
andb %dl, %cl
movzbl %cl, %r13d
movl %r13d, 0xc4(%rbx)
movl $0x2, %ecx
subl %r13d, %ecx
leaq (%rax,%rcx,4), %rax
movq %rax, 0xc8(%rbx)
shll $0x3, %edx
leaq 0x5f43(%rip), %rax      # 0x12070
movsd (%rdx,%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq 0x5f42(%rip), %rax      # 0x12080
movsd (%rdx,%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x5f41(%rip), %r12      # 0x12090
movsd (%rdx,%r12), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd %xmm2, -0x48(%rbp)
movq 0x40(%rbx), %r14
cmpq %r14, 0xc8(%rbx)
jae 0xc22e
movl 0xc0(%rbx), %ecx
cmpl $0x1, %ecx
sete %al
je 0xc199
cmpl $0x14a, %r15d           # imm = 0x14A
je 0xc194
cmpl $0x10e, %r15d           # imm = 0x10E
jne 0xc214
cmpl $0x2, %ecx
jne 0xc214
cmpl $0x14a, %r15d           # imm = 0x14A
je 0xc1ad
cmpl $0x10e, %r15d           # imm = 0x10E
je 0xc1ad
xorl %eax, %eax
movsd -0x38(%rbp), %xmm0
testb %al, %al
jne 0xc1be
movsd 0x5f12(%rip), %xmm0     # 0x120d0
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xe4(%rbx)
movsd -0x30(%rbp), %xmm0
jne 0xc1dd
movsd 0x5f9b(%rip), %xmm0     # 0x12178
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xec(%rbx)
movss %xmm0, 0xe8(%rbx)
movsd -0x50(%rbp), %xmm0
jne 0xc204
movsd 0x5f7c(%rip), %xmm0     # 0x12180
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xf0(%rbx)
movq %rbx, %rdi
callq 0x10840
movsd -0x48(%rbp), %xmm2
testl %eax, %eax
jne 0xc15f
jmp 0xca89
movl 0xc0(%rbx), %eax
testl %r13d, %r13d
movl $0x17, %ecx
movl $0x21, %edx
cmovnel %ecx, %edx
cmpl %edx, %eax
jne 0xca89
cmpl $0x140, %r15d           # imm = 0x140
je 0xc25e
cmpl $0xfa, %r15d
jne 0xc26b
cmpb $0x0, 0xa1(%rbx)
js 0xca89
movq 0x10(%rbx), %rdx
leaq 0x4(%r14), %rsi
movss -0x40(%rbp), %xmm1
movq %rsi, %rcx
cmpq %rdx, %rsi
jae 0xc28d
movss (%rcx), %xmm0
leaq 0x4(%rcx), %rsi
ucomiss %xmm1, %xmm0
jbe 0xc278
xorl %edx, %edx
cmpl $0x14a, %r15d           # imm = 0x14A
setne %dl
movl %r13d, 0xc4(%rbx)
shll $0x2, %r13d
movq %r14, %rsi
subq %r13, %rsi
addq $0xc, %rsi
movq %rsi, 0xc8(%rbx)
movq %rcx, 0x40(%rbx)
incl %eax
movl %eax, 0xc0(%rbx)
shll $0x3, %edx
leaq 0x5da5(%rip), %rax      # 0x12070
movsd (%rdx,%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq 0x5da4(%rip), %rax      # 0x12080
movsd (%rdx,%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd (%rdx,%r12), %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0xc8(%rbx), %rax
cmpq 0x40(%rbx), %rax
jae 0xc39c
cmpl $0x14a, %r15d           # imm = 0x14A
je 0xc314
cmpl $0x10e, %r15d           # imm = 0x10E
jne 0xc38c
movl 0xc0(%rbx), %eax
cmpl $0x23, %eax
jg 0xc38c
movsd -0x40(%rbp), %xmm0
cmpl $0x22, %eax
je 0xc331
movsd 0x5d9f(%rip), %xmm0     # 0x120d0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xe4(%rbx)
movsd -0x38(%rbp), %xmm0
je 0xc355
movsd 0x5e23(%rip), %xmm0     # 0x12178
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xec(%rbx)
movss %xmm0, 0xe8(%rbx)
movsd -0x30(%rbp), %xmm0
je 0xc37c
movsd 0x5e04(%rip), %xmm0     # 0x12180
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xf0(%rbx)
movq %rbx, %rdi
callq 0x10840
testl %eax, %eax
jne 0xc2f1
movq %r14, 0x40(%rbx)
movl 0xc0(%rbx), %eax
addl $0x7, %eax
sarl $0x3, %eax
testl %eax, %eax
jle 0xc405
movl %eax, %eax
movl $0x33000000, %ecx       # imm = 0x33000000
movl $0x55000000, %edx       # imm = 0x55000000
movzbl 0x9f(%rbx,%rax), %esi
bswapl %esi
movl %esi, %edi
shll $0x4, %edi
shrl $0x4, %esi
andl $0xf000000, %esi        # imm = 0xF000000
orl %edi, %esi
movl %esi, %edi
andl %ecx, %edi
shrl $0x2, %esi
andl %ecx, %esi
leal (%rsi,%rdi,4), %esi
movl %esi, %edi
andl %edx, %edi
shrl %esi
andl %edx, %esi
leal (%rsi,%rdi,2), %esi
shrl $0x18, %esi
movb %sil, 0x9f(%rbx,%rax)
leaq -0x1(%rax), %rsi
cmpq $0x1, %rax
movq %rsi, %rax
jg 0xc3bc
cmpl $0x13f, %r15d           # imm = 0x13F
jg 0xc429
cmpl $0xfa, %r15d
je 0xc5bc
cmpl $0x10e, %r15d           # imm = 0x10E
je 0xc443
jmp 0xc6c7
cmpl $0x140, %r15d           # imm = 0x140
je 0xc5bc
cmpl $0x14a, %r15d           # imm = 0x14A
jne 0xc6c7
movq -0x58(%rbp), %rax
movzbl (%rax), %esi
andl $0x7f, %esi
movl $0xa1, %eax
movl %esi, %edx
movl %esi, %ecx
shll $0x8, %ecx
movzbl (%rbx,%rax), %esi
orl %ecx, %esi
incq %rax
cmpq $0xa4, %rax
jne 0xc452
movl %edx, -0x40(%rbp)
movzbl 0xa4(%rbx), %r12d
movl %r12d, %edi
shrl $0x7, %edi
andl $0x3f, %r12d
movl $0xa5, %eax
movl %r12d, %edx
movl %r12d, %ecx
shll $0x8, %ecx
movzbl (%rbx,%rax), %r12d
orl %ecx, %r12d
incq %rax
cmpq $0xa8, %rax
jne 0xc484
movl %edx, -0x50(%rbp)
movl %esi, %eax
addl %esi, %esi
movl %esi, -0x38(%rbp)
movq %rdi, -0x48(%rbp)
leal (%rdi,%rax,2), %eax
movl %eax, -0x30(%rbp)
xorl %r13d, %r13d
movl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
addl $0x4, %r14d
movq %rbx, %rdi
movl %r14d, %esi
movl $0x4, %edx
callq 0xfdf2
addl %eax, %r13d
cmpl $0x19, %r14d
jb 0xc4bd
movzbl 0xa3(%rbx), %eax
andl $0x7, %eax
movq -0x48(%rbp), %rcx
leal (%rcx,%rax,2), %eax
andl $0xf, %r13d
cmpl %r13d, %eax
jne 0xca89
cmpl $0x42, 0xc0(%rbx)
jne 0xc5a6
shll $0x2, %r12d
xorl %r13d, %r13d
movl $0x1e, %r14d
addl $0x4, %r14d
movq %rbx, %rdi
movl %r14d, %esi
movl $0x4, %edx
callq 0xfdf2
addl %eax, %r13d
cmpl $0x3a, %r14d
jb 0xc512
movzbl 0xa7(%rbx), %eax
andl $0x3, %eax
movzbl 0xa8(%rbx), %ecx
shrl $0x6, %ecx
leal (%rcx,%rax,4), %eax
andl $0xf, %r13d
cmpl %eax, %r13d
jne 0xca89
xorl -0x38(%rbp), %r12d
andl $-0x10, %r12d
btl $0x11, -0x40(%rbp)
jae 0xc583
cmpl $0x4000000, %r12d       # imm = 0x4000000
jne 0xc583
movl $0x1, 0xb8(%rbx)
movl -0x30(%rbp), %eax
movl %eax, 0x9d86(%rip)      # 0x16304
jmp 0xc82d
btl $0xd, -0x50(%rbp)
jae 0xc5a6
cmpl $0x800000, %r12d        # imm = 0x800000
jne 0xc5a6
movl $0x1, 0xbc(%rbx)
movl -0x30(%rbp), %eax
movl %eax, 0x9d5e(%rip)      # 0x16304
cmpl $0x140, %r15d           # imm = 0x140
je 0xc5bc
cmpl $0xfa, %r15d
jne 0xc6c7
cmpl $0x2e, 0xc0(%rbx)
jne 0xc64e
movzbl 0xa1(%rbx), %ecx
movl %ecx, %edx
shrl %edx
movzbl 0xa4(%rbx), %eax
movl %eax, %esi
shrl $0x2, %esi
xorl %edx, %esi
andb $0x1, %sil
cmpb %sil, 0x9d0f(%rip)      # 0x162fc
je 0xc64e
movzbl 0xa0(%rbx), %edx
andl $0x7f, %edx
shll $0x6, %edx
movl %ecx, %esi
shrl $0x2, %esi
orl %edx, %esi
movzbl 0xa3(%rbx), %edx
shll $0x5, %edx
movl %eax, %edi
shrl $0x3, %edi
orl %edx, %edi
cmpl %edi, %esi
jne 0xc64e
shll $0x7, %ecx
movl $0xff, %edx
andl %edx, %ecx
movzbl 0xa2(%rbx), %esi
shrl %esi
orl %ecx, %esi
shll $0x6, %eax
andl %edx, %eax
movzbl 0xa5(%rbx), %ecx
shrl $0x2, %ecx
orl %eax, %ecx
cmpl %ecx, %esi
jne 0xc64e
movb $0x1, 0x9cb3(%rip)      # 0x162fc
jmp 0xc82d
cmpl $0x140, %r15d           # imm = 0x140
je 0xc782
cmpl $0xfa, %r15d
jne 0xc6c7
movzbl 0xa0(%rbx), %eax
andl $0x7f, %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa1(%rbx), %eax
shrl $0x2, %eax
movq 0x168(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa2(%rbx), %eax
movl %eax, %ecx
shrl %ecx
movq 0x170(%rbx), %rdx
movl %ecx, (%rdx)
andl $-0x2, %eax
movq 0x178(%rbx), %rcx
movl %eax, (%rcx)
movq 0x148(%rbx), %rax
movabsq $0x7461536c616e6143, %rcx # imm = 0x7461536C616E6143
movq %rcx, (%rax)
movb $0x0, 0x8(%rax)
jmp 0xc7d6
movl $0x10e, %eax            # imm = 0x10E
cmpl $0x0, 0xb8(%rbx)
jne 0xc6e7
cmpl $0x0, 0xbc(%rbx)
je 0xc8d9
movl $0x14a, %eax            # imm = 0x14A
cmpl $0x14a, %eax            # imm = 0x14A
je 0xc81b
cmpl $0x10e, %eax            # imm = 0x10E
jne 0xca6f
movl 0x9c01(%rip), %edx      # 0x16304
movl %edx, %eax
shrl $0x1c, %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movl %edx, %eax
shrl $0x10, %eax
movl $0xff, %ecx
andl %ecx, %eax
movq 0x168(%rbx), %rsi
movl %eax, (%rsi)
movl %edx, %eax
shrl $0x8, %eax
andl %ecx, %eax
movq 0x170(%rbx), %rcx
movl %eax, (%rcx)
movq 0x178(%rbx), %rcx
movl %eax, (%rcx)
shrl $0x4, %edx
andl $0xf, %edx
cmpl $0xf, %edx
je 0xc75f
movq 0x150(%rbx), %rdi
leaq 0x6641(%rip), %rsi      # 0x12d99
xorl %eax, %eax
callq 0x2060
cmpl $0xb3b1, 0x2c(%rbx)     # imm = 0xB3B1
movq 0x148(%rbx), %rax
jl 0xc849
movabsq $0x36352d6f6e696d41, %rcx # imm = 0x36352D6F6E696D41
jmp 0xc853
movzbl 0xa0(%rbx), %eax
andl $0x7f, %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa1(%rbx), %eax
shrl $0x2, %eax
movq 0x168(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa2(%rbx), %eax
shrl $0x2, %eax
movq 0x170(%rbx), %rcx
movl %eax, (%rcx)
movq 0x148(%rbx), %rax
movabsq $0x7461536c616e6143, %rcx # imm = 0x7461536C616E6143
movq %rcx, (%rax)
movl $0x444c74, 0x7(%rax)    # imm = 0x444C74
movl $0x4, 0x88(%rbx)
movq 0x150(%rbx), %rdi
cmpb $0x0, 0x9b0e(%rip)      # 0x162fc
je 0xc7f9
leaq 0x6917(%rip), %rsi      # 0x1310e
jmp 0xc811
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x88(%rbx)
leaq 0x651f(%rip), %rsi      # 0x12d30
callq 0x2100
jmp 0xca6f
cmpl $0x0, 0xbc(%rbx)
jne 0xc876
cmpl $0x42, 0xc0(%rbx)
jne 0xc876
movl 0x9acc(%rip), %r14d     # 0x16300
testl %r14d, %r14d
jne 0xc841
movq %rbx, %rdi
callq 0x26ec
incl %r14d
jmp 0xca82
movabsq $0x36332d6f6e696d41, %rcx # imm = 0x36332D6F6E696D41
movq %rcx, (%rax)
movb $0x0, 0x8(%rax)
cmpl $0x0, 0xb8(%rbx)
je 0xc939
movl $0x4, 0x88(%rbx)
jmp 0xca6f
movl 0x9a88(%rip), %edx      # 0x16304
movl %edx, %eax
shrl $0x18, %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movl %edx, %eax
shrl $0x10, %eax
andl $0x7f, %eax
movq 0x168(%rbx), %rcx
movl %eax, (%rcx)
movzbl %dh, %eax
movq 0x170(%rbx), %rcx
movl %eax, (%rcx)
movq 0x178(%rbx), %rcx
movl %eax, (%rcx)
shrl $0x4, %edx
andl $0xf, %edx
cmpl $0xb3b1, 0x2c(%rbx)     # imm = 0xB3B1
movq 0x148(%rbx), %rax
jl 0xc95b
movabsq $0x352d726f7470615a, %rcx # imm = 0x352D726F7470615A
jmp 0xc965
movzbl 0xa0(%rbx), %ecx
andl $0x7f, %ecx
movq $-0x3, %rdx
movl %ecx, %esi
shll $0x8, %esi
movzbl 0xa4(%rbx,%rdx), %ecx
orl %esi, %ecx
incq %rdx
jne 0xc8ea
movzbl 0xa4(%rbx), %edx
shrl $0x7, %edx
movl %ecx, %esi
addl %ecx, %ecx
leal (%rdx,%rsi,2), %edx
movl %edx, 0x99ef(%rip)      # 0x16304
movl %ecx, %edx
notb %dl
testb $-0x10, %dl
je 0xc6e7
andl $0xf0, %ecx
cmpl $0x50, %ecx
je 0xc6e2
movl %r15d, %eax
jmp 0xc6e7
movl $0x1, 0x88(%rbx)
testb $0x4, 0x99bd(%rip)      # 0x16307
jne 0xc9a0
movl $0x1, 0x8c(%rbx)
jmp 0xca21
movabsq $0x332d726f7470615a, %rcx # imm = 0x332D726F7470615A
movq %rcx, (%rax)
movw $0x36, 0x8(%rax)
cmpl $0x5, %edx
je 0xc988
movq 0x150(%rbx), %rdi
leaq 0x6418(%rip), %rsi      # 0x12d99
xorl %eax, %eax
callq 0x2060
cmpl $0x0, 0xbc(%rbx)
je 0xc9ac
movl $0x5, 0x88(%rbx)
jmp 0xca6f
movl $0x0, 0x8c(%rbx)
jmp 0xc9c0
testb $-0x80, 0x9953(%rip)    # 0x16306
jne 0xca10
movq $0x1, 0x88(%rbx)
movq 0x150(%rbx), %r14
cmpb $0x0, (%r14)
je 0xc9e2
movq %r14, %rdi
callq 0x2090
movw $0x202c, (%r14,%rax)    # imm = 0x202C
movb $0x0, 0x2(%r14,%rax)
movq 0x150(%rbx), %r14
movq %r14, %rdi
callq 0x2090
movabsq $0x6620646e65206f6e, %rcx # imm = 0x6620646E65206F6E
movq %rcx, (%r14,%rax)
movabsq $0x656d6172662064, %rcx # imm = 0x656D6172662064
movq %rcx, 0x5(%r14,%rax)
jmp 0xca6f
movabsq $0x600000000, %rax      # imm = 0x600000000
movq %rax, 0x88(%rbx)
movq 0x150(%rbx), %r14
cmpb $0x0, (%r14)
je 0xca43
movq %r14, %rdi
callq 0x2090
movw $0x202c, (%r14,%rax)    # imm = 0x202C
movb $0x0, 0x2(%r14,%rax)
movq 0x150(%rbx), %r14
movq %r14, %rdi
callq 0x2090
movabsq $0x7472617473206f6e, %rcx # imm = 0x7472617473206F6E
movq %rcx, (%r14,%rax)
movabsq $0x656d6172662074, %rcx # imm = 0x656D6172662074
movq %rcx, 0x7(%r14,%rax)
movl 0x988b(%rip), %eax      # 0x16300
movl %eax, 0x60(%rbx)
movb $0x0, 0x987d(%rip)      # 0x162fc
xorl %r14d, %r14d
movl %r14d, 0x9877(%rip)     # 0x16300
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq