// File: /workspace/github_cpp_makefile_star2_O3/probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::tryQ2()
void Signal::tryQ2()
{
	// {38k}<-624,468|468-624>(1820,-590,0:1,D:4,F:7,S:1,C:4,1:1,-???)
	// {38k}<-624,468|468-624>(1820,-590,0:1,D:4,S:6,F:6,C:4,1:1,-???)
	if (   pFrameEnd[0] < 3000.
		|| pFrame[0]    < 1000.
		|| pFrame[0]    > 2000.
		|| pFrame[1]    < 500.
		|| pFrame[1]    > 1300.
		|| sortBurst.max2   > 2300.
		|| sortBurst.max2   > pFrame[0] + pFrame[1]
		|| sortBurst.min1    < 900. )
	{
		return;
	}

	if ( preemptValue >= prQ2 )		// GD 2009  Avoids spurious decode of OrtekMCE
	{
		// the tolerances for OrtekMCE overlap with those for S:17
		// signal, so potentially every OrtekMCE signal could be
		// mistaken for an S:17 one.
		return;
	}

	m_minShortPulse = 200. ;
	m_nominalShortPulse = 468. ;
	m_maxShortPulse = 525. ;
	m_nominalLongPulse = 936. ;
	m_maxLongPulse = 1050. ;

	// GD 2009 Added initializations of two "nominal" values whose omission
	// caused "Invalid floating point operation" in certain circumstances

	m_minShortGap = 500. ;
	m_nominalShortGap = 624. ;  // GD 2009
	m_maxShortGap = 850. ;
	m_minLongGap =  950. ;
	m_nominalLongGap = 1248. ;  // GD 2009
	m_maxLongGap = 1700. ;

	m_extra = 0. ;

   	cleanup();
	++pBit;
	nState = 0;

	do
	{
		if ( phaseBit2() <= 0 )
			return;

	} while ( pBit < pFrameEnd );

	if ( nBit < 10 )
		return;

	if ( (nBit&3)==2 && getBit(0)==1 && getBit(nBit-1)==0 )
	{
		int sum=0;
		char *p1 = pMisc;
		int ndx;
		int dig;
		for (ndx=1; ; )
		{
			dig = 15 - getLsb(ndx,4);
			sprintf( p1, "%X ", dig );
			p1 += 2;
			ndx += 4;
			if ( ndx >= nBit-1 )
				break;
			sum = (sum>>4) + (sum&15) + dig;
		}
		if ( (sum&=15) != dig )
		{
			sprintf(p1-1, "-%X", sum);
		}
		else
		{
			sprintf( pProtocol, "Solidtek%d", nBit-2 );
			if ( nBit == 22 )
			{
				*pDevice = 15-getLsb(1,4);
				*pSubDevice = 63-getLsb(5,6);
				*pOBC = 63-getLsb(11,6);
				return;
			}
			if ( nBit == 18 )
			{
				*pDevice = 15-getLsb(1,4);
				*pSubDevice = 1-getLsb(12,1);
				*pOBC = 127-getLsb(5,7);
				if (	*pDevice == 0
					&&	*pSubDevice == 0
					&&	*pOBC == 0 )
				{	
					newPreemptValue = prBySolidtek; 	// Avoid RC6-8-13 decode of same frame
					newPreemptLength = nFrameL;
				}
			}
			return;
		}
	}
	char* p1 = pProtocol;
	sprintf( p1, "S:%d", nBit );
	unsigned char* pb = cBits;
	pb[nBit>>3] += 0xFF << (nBit&7);
	do
	{
		sprintf( p1+=strlen(p1), ".%02X", msb(255-*pb) );
		++pb;
	} while ( (nBit-=8) > 0 );


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x40(%rdi), %rax
movss 0xc4e7(%rip), %xmm0     # 0x12544
ucomiss (%rax), %xmm0
jbe 0x6071
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movss (%rax), %xmm0
movss 0xc4c4(%rip), %xmm1     # 0x12548
ucomiss %xmm0, %xmm1
ja 0x6062
ucomiss 0xc4bc(%rip), %xmm0     # 0x1254c
ja 0x6062
movss 0x4(%rax), %xmm1
movss 0xc4b1(%rip), %xmm2     # 0x12550
ucomiss %xmm1, %xmm2
ja 0x6062
ucomiss 0xc4a9(%rip), %xmm1     # 0x12554
ja 0x6062
movss 0x1e0(%rbx), %xmm2
ucomiss 0xc49c(%rip), %xmm2     # 0x12558
ja 0x6062
addss %xmm1, %xmm0
ucomiss %xmm0, %xmm2
ja 0x6062
movss 0xc48d(%rip), %xmm0     # 0x1255c
ucomiss 0x1d0(%rbx), %xmm0
ja 0x6062
cmpl $0x2, 0x54(%rbx)
jg 0x6062
addq $0x4, %rax
movaps 0xbf37(%rip), %xmm0     # 0x12020
movups %xmm0, 0xfc(%rbx)
movabsq $0x43fa000044834000, %rcx # imm = 0x43FA000044834000
movq %rcx, 0x10c(%rbx)
movabsq $0x446d800044548000, %rcx # imm = 0x446D800044548000
movq %rcx, 0x114(%rbx)
movl $0x449c0000, 0x124(%rbx) # imm = 0x449C0000
movabsq $0x441c000044d48000, %rcx # imm = 0x441C000044D48000
movq %rcx, 0x11c(%rbx)
movl $0x0, 0x130(%rbx)
leaq 0xa0(%rbx), %r13
xorps %xmm0, %xmm0
movups %xmm0, 0xa0(%rbx)
movq $0x0, 0xc0(%rbx)
movq %rax, 0xc8(%rbx)
movq %rbx, %rdi
callq 0x103f2
testl %eax, %eax
jle 0x6062
movq 0xc8(%rbx), %rax
cmpq 0x40(%rbx), %rax
jb 0x615a
movl 0xc0(%rbx), %edx
cmpl $0xa, %edx
jl 0x6062
movl %edx, %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x6329
testb $0x1, (%r13)
je 0x6329
leal -0x1(%rdx), %eax
movl %eax, %ecx
shrl $0x3, %ecx
movzbl (%r13,%rcx), %ecx
andl $0x5, %eax
btl %eax, %ecx
jb 0x6329
movq 0x150(%rbx), %r14
movq %rbx, %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0xfd2a
movl $0xf, %r12d
subl %eax, %r12d
leaq 0xce1c(%rip), %rsi      # 0x12ffe
xorl %r15d, %r15d
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0x2060
movl 0xc0(%rbx), %edx
cmpl $0x7, %edx
jl 0x6270
movq %r14, -0x38(%rbp)
movl $0x5, %ecx
xorl %r15d, %r15d
movl %ecx, -0x2c(%rbp)
movq -0x38(%rbp), %r14
addq $0x2, %r14
movl %r15d, %eax
sarl $0x4, %eax
andl $0xf, %r15d
addl %eax, %r15d
addl %r12d, %r15d
movq %rbx, %rdi
movl -0x2c(%rbp), %esi
movl $0x4, %edx
callq 0xfd2a
movl $0xf, %r12d
subl %eax, %r12d
movq %r14, -0x38(%rbp)
movq %r14, %rdi
leaq 0xcdb3(%rip), %rsi      # 0x12ffe
movl %r12d, %edx
xorl %eax, %eax
callq 0x2060
movl -0x2c(%rbp), %ecx
addl $0x4, %ecx
movl 0xc0(%rbx), %edx
leal -0x1(%rdx), %eax
cmpl %eax, %ecx
jl 0x6209
andl $0xf, %r15d
movq -0x38(%rbp), %r14
cmpl %r12d, %r15d
jne 0x630c
movq 0x148(%rbx), %rdi
addl $-0x2, %edx
leaq 0xcd7c(%rip), %rsi      # 0x13006
xorl %eax, %eax
callq 0x2060
movl 0xc0(%rbx), %eax
cmpl $0x12, %eax
je 0x63dc
cmpl $0x16, %eax
jne 0x6062
movl 0xa0(%rbx), %eax
notl %eax
shrl %eax
andl $0xf, %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa0(%rbx), %eax
shrl $0x5, %eax
movzbl 0xa1(%rbx), %ecx
andl $0x7, %ecx
leal (%rax,%rcx,8), %eax
xorl $0x3f, %eax
movq 0x168(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa1(%rbx), %eax
shrl $0x3, %eax
movzbl 0xa2(%rbx), %ecx
shll $0x5, %ecx
andl $0x20, %ecx
orl %eax, %ecx
xorl $0x3f, %ecx
movq 0x170(%rbx), %rax
movl %ecx, (%rax)
jmp 0x6062
incq %r14
leaq 0xccec(%rip), %rsi      # 0x13002
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2060
movl 0xc0(%rbx), %edx
movq 0x148(%rbx), %r14
leaq 0xccda(%rip), %rsi      # 0x13011
movq %r14, %rdi
xorl %eax, %eax
callq 0x2060
movl 0xc0(%rbx), %eax
movl %eax, %ecx
andb $0x7, %cl
movl $0xff, %edx
shll %cl, %edx
sarl $0x3, %eax
cltq
addb %dl, 0xa0(%rbx,%rax)
movl $0x33000000, %r12d      # imm = 0x33000000
movl $0x55000000, %r15d      # imm = 0x55000000
movq %r14, %rdi
callq 0x2090
addq %rax, %r14
movzbl (%r13), %eax
xorl $0xff, %eax
bswapl %eax
movl %eax, %ecx
shll $0x4, %ecx
shrl $0x4, %eax
andl $0xf000000, %eax        # imm = 0xF000000
orl %ecx, %eax
movl %eax, %ecx
andl %r12d, %ecx
shrl $0x2, %eax
andl %r12d, %eax
leal (%rax,%rcx,4), %eax
movl %eax, %ecx
andl %r15d, %ecx
shrl %eax
andl %r15d, %eax
leal (%rax,%rcx,2), %edx
shrl $0x18, %edx
movq %r14, %rdi
leaq 0xcc12(%rip), %rsi      # 0x12fcb
xorl %eax, %eax
callq 0x2060
incq %r13
movl 0xc0(%rbx), %eax
leal -0x8(%rax), %ecx
movl %ecx, 0xc0(%rbx)
cmpl $0x8, %eax
jg 0x636b
jmp 0x6062
movl 0xa0(%rbx), %eax
notl %eax
shrl %eax
andl $0xf, %eax
movq 0x160(%rbx), %rdx
movl %eax, (%rdx)
movzbl 0xa1(%rbx), %eax
xorl %ecx, %ecx
testb $0x10, %al
sete %cl
movq 0x168(%rbx), %rax
movl %ecx, (%rax)
movzbl 0xa0(%rbx), %ecx
shrl $0x5, %ecx
movzbl 0xa1(%rbx), %esi
andl $0xf, %esi
leal (%rcx,%rsi,8), %ecx
movl %ecx, %esi
xorl $0x7f, %esi
movq 0x170(%rbx), %rdi
movl %esi, (%rdi)
cmpl $0x0, (%rdx)
jne 0x6062
cmpl $0x0, (%rax)
jne 0x6062
cmpb $0x7f, %cl
jne 0x6062
movl $0x3, 0x5c(%rbx)
movl 0x48(%rbx), %eax
movl %eax, 0x58(%rbx)
jmp 0x6062
nop