// File: /workspace/github_cpp_makefile_star2_O2/probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::tryXX()
void Signal::tryXX()	// {500}<-1,1|1,-1>((1,-5, 1:1, 
{
    if ( pFrameEnd[0] < sortBurst.max1 )    // Right hand framing
        return;
	if ( pFrame[1] <= sortBurst.max2 )      // Lead-in
		return;
	if ( nFrameL > 20 || nFrameL < 6 )
		return;
	if ( preemptValue >= prBlaupunkt )
		return;
	if ( sortBurst.min1*4 < sortBurst.max1 )
		return;
	cleanup();
	float u = sortBurst.max1 * (1./18);
    minGlitch = .5*u;
	nMinShort = nMinShort2 = 2*u;
	nMaxShort = nMaxShort2 = 4*u;
	nMinLong = 5*u;
	nMaxLong = 7*u;
	pBit += 2;
	if (*(pBit++) > nMaxShort)
		return;
	nState = 1;
	do
	{
		if ( ! phaseBit() )
			return;
	} while (pBit != pFrameEnd);
	if (nBit < 8)
		return;
	switch (nBit)
	{
	case 9:
	{
		newPreemptValue = prBlaupunkt;
		newPreemptLength = nFrameL;
		int obc = getLsb(0,7);
		int device = getLsb(7,2);
		strcpy(pProtocol, "Blaupunkt{body}");
		if (getLsb(0,9)==511)
		{
			int command = moreBlaupunkt(9);
			if (command>=0 && command != 511)
			{
				int cmds = 0;
				obc = getLsb(0,6);
				device = getLsb(6,3);
				int nextCommand;
				do
				{
					newPreemptLength = (pBit-pFrame)/2;
					++cmds;
					nextCommand = moreBlaupunkt(9);
				} while (nextCommand == command);
				strcpy(pProtocol, "Blaupunkt");
				if (cmds>1)
					sprintf(pMisc, "(%d)", cmds);
			}
			else
			{
				strcpy(pProtocol, "Blaupunkt{prefix}");
				return;
			}
		}
		*pOBC = obc;
		*pDevice = device;
		*pHex = (msb(obc)>>1) + 0x80;
		return;
	}
	case 15:
	case 16:
	{
		newPreemptValue = prBlaupunkt;
		newPreemptLength = nFrameL;
		int obc = getLsb(0,8);
		int device = getLsb(8,nBit-1);
		sprintf(pProtocol, "NRC%d{body}", nBit+1);
		char* pP = pProtocol+5;
		if ( getLsb(0,nBit) == (1<<nBit)-2 )
		{
			int command = moreBlaupunkt(nBit);
			if (command>=0 && command != (1<<nBit)-2)
			{
				*pP = 0;
				int cmds = 0;
				obc = getLsb(0,8);
				device = getLsb(8,nBit-8);
				int nextCommand;
				do
				{
					newPreemptLength = (pBit-pFrame)/2;
					++cmds;
					nextCommand = moreBlaupunkt(nBit);
				} while (nextCommand == command);
				if (cmds>1)
					sprintf(pMisc, "(%d)", cmds);
			}
			else
			{
				strcpy(pP, "{prefix}");
				return;
			}
		}
		*pOBC = obc;
		*pDevice = device;
		return;
	}
	}
	strcpy(pProtocol, "XX");
	*pDevice = nBit;
	char *pt=pMisc;
	for (int ndx= (nBit+7)>>3; --ndx>=0; )
	{
		sprintf(pt,"%02X", cBits[ndx]);
		pt+=2;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x40(%rdi), %rax
movss 0x1dc(%rdi), %xmm0
ucomiss (%rax), %xmm0
ja 0x49a6
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movss 0x1e0(%rdi), %xmm1
ucomiss 0x4(%rax), %xmm1
jae 0x49a6
movl 0x48(%rbx), %ecx
addl $-0x15, %ecx
cmpl $-0xf, %ecx
jb 0x49a6
cmpl $0x1, 0x54(%rbx)
jg 0x49a6
movss 0x1d0(%rbx), %xmm1
mulss 0xcc05(%rip), %xmm1     # 0x11500
ucomiss %xmm1, %xmm0
ja 0x49a6
xorps %xmm1, %xmm1
movups %xmm1, 0xa0(%rbx)
andq $0x0, 0xc0(%rbx)
cvtss2sd %xmm0, %xmm0
mulsd 0xc82e(%rip), %xmm0     # 0x11150
cvtsd2ss %xmm0, %xmm0
movss 0xcbe2(%rip), %xmm1     # 0x11510
mulss %xmm0, %xmm1
movss %xmm1, 0xe0(%rbx)
movaps %xmm0, %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0xf4(%rbx)
movss %xmm1, 0xe4(%rbx)
movss 0xcba7(%rip), %xmm1     # 0x11500
mulss %xmm0, %xmm1
movss %xmm1, 0xf8(%rbx)
movss %xmm1, 0xe8(%rbx)
movss 0xcb93(%rip), %xmm2     # 0x11508
mulss %xmm0, %xmm2
movss %xmm2, 0xec(%rbx)
mulss 0xcb8b(%rip), %xmm0     # 0x11514
movss %xmm0, 0xf0(%rbx)
leaq 0xc(%rax), %rcx
movq %rcx, 0xc8(%rbx)
movss 0x8(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x49b5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0xc4(%rbx)
movq %rbx, %rdi
callq 0xf4f4
testl %eax, %eax
je 0x49a6
movq 0xc8(%rbx), %rax
cmpq 0x40(%rbx), %rax
jne 0x49bf
movl 0xc0(%rbx), %r15d
cmpl $0x8, %r15d
jl 0x49a6
leal -0xf(%r15), %eax
cmpl $0x2, %eax
jae 0x4aac
movl $0x2, 0x5c(%rbx)
movl 0x48(%rbx), %eax
movl %eax, 0x58(%rbx)
movb 0xa0(%rbx), %al
movb %al, -0x29(%rbp)
leal -0x1(%r15), %edx
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0xebd6
movl %eax, %r14d
movq 0x148(%rbx), %rdi
incl %r15d
leaq 0xd560(%rip), %rsi      # 0x11f8b
movl %r15d, %edx
xorl %eax, %eax
callq 0x2060
movq 0x148(%rbx), %r12
movl 0xc0(%rbx), %r15d
movq %rbx, %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0xebd6
pushq $0x1
popq %r13
movl %r13d, %edx
movl %r15d, %ecx
shll %cl, %edx
addl $-0x2, %edx
cmpl %edx, %eax
jne 0x4cfb
addq $0x5, %r12
movq %rbx, %rdi
movl %r15d, %esi
callq 0xf800
testl %eax, %eax
js 0x4a93
movl %eax, %r15d
movb 0xc0(%rbx), %cl
shll %cl, %r13d
addl $-0x2, %r13d
cmpl %r13d, %eax
jne 0x4c84
movabsq $0x7d7869666572707b, %rax # imm = 0x7D7869666572707B
movq %rax, (%r12)
movb $0x0, 0x8(%r12)
jmp 0x49a6
cmpl $0x9, %r15d
jne 0x4bbe
movl $0x2, 0x5c(%rbx)
movl 0x48(%rbx), %eax
movl %eax, 0x58(%rbx)
movb 0xa0(%rbx), %r14b
pushq $0x7
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0xebd6
movl %eax, %r15d
movq 0x148(%rbx), %rax
movups 0xd483(%rip), %xmm0     # 0x11f6c
movups %xmm0, (%rax)
pushq $0x9
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xebd6
cmpl $0x1ff, %eax            # imm = 0x1FF
jne 0x4c1d
pushq $0x9
popq %rsi
movq %rbx, %rdi
callq 0xf800
movl %eax, %r15d
testl %eax, %eax
sets %al
cmpl $0x1ff, %r15d           # imm = 0x1FF
sete %cl
orb %al, %cl
jne 0x4d17
movb 0xa0(%rbx), %al
movb %al, -0x29(%rbp)
pushq $0x6
popq %rsi
pushq $0x3
popq %rdx
movq %rbx, %rdi
callq 0xebd6
movl %eax, -0x30(%rbp)
xorl %r12d, %r12d
pushq $0x2
popq %r14
pushq $0x9
popq %r13
movq 0xc8(%rbx), %rax
subq 0x38(%rbx), %rax
sarq $0x2, %rax
cqto
idivq %r14
movl %eax, 0x58(%rbx)
incl %r12d
movq %rbx, %rdi
movl %r13d, %esi
callq 0xf800
cmpl %r15d, %eax
je 0x4b4e
movb -0x29(%rbp), %r14b
andb $0x3f, %r14b
movq 0x148(%rbx), %rax
movabsq $0x6b6e757075616c42, %rcx # imm = 0x6B6E757075616C42
movq %rcx, (%rax)
movw $0x74, 0x8(%rax)
cmpl $0x1, %r12d
je 0x4bb8
movq 0x150(%rbx), %rdi
leaq 0xd3d8(%rip), %rsi      # 0x11f86
movl %r12d, %edx
xorl %eax, %eax
callq 0x2060
movl -0x30(%rbp), %r15d
jmp 0x4c21
movq 0x148(%rbx), %rax
movb $0x0, 0x2(%rax)
movw $0x5858, (%rax)         # imm = 0x5858
movl 0xc0(%rbx), %r12d
movq 0x160(%rbx), %rax
movl %r12d, (%rax)
movq 0x150(%rbx), %r14
addl $0x7, %r12d
sarl $0x3, %r12d
leaq 0xd317(%rip), %r15      # 0x11f0c
testl %r12d, %r12d
jle 0x49a6
movzbl 0x9f(%rbx,%r12), %edx
decq %r12
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2060
addq $0x2, %r14
jmp 0x4bf5
andb $0x7f, %r14b
movzbl %r14b, %eax
movq 0x170(%rbx), %rcx
movl %eax, (%rcx)
movq 0x160(%rbx), %rcx
movl %r15d, (%rcx)
bswapl %eax
movl %eax, %ecx
shll $0x4, %ecx
shrl $0x4, %eax
andl $0x7000000, %eax        # imm = 0x7000000
orl %ecx, %eax
movl %eax, %ecx
andl $0x33000000, %ecx       # imm = 0x33000000
shrl $0x2, %eax
andl $0x31000000, %eax       # imm = 0x31000000
leal (%rax,%rcx,4), %eax
movl %eax, %ecx
andl $0x55000000, %ecx       # imm = 0x55000000
shrl %eax
andl $0x54000000, %eax       # imm = 0x54000000
leal (%rax,%rcx,2), %eax
shrl $0x19, %eax
orl $0x80, %eax
movq 0x178(%rbx), %rcx
movl %eax, (%rcx)
jmp 0x49a6
movb $0x0, (%r12)
movb 0xa0(%rbx), %al
movb %al, -0x29(%rbp)
movl 0xc0(%rbx), %edx
addl $-0x8, %edx
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0xebd6
movl %eax, %r14d
xorl %r12d, %r12d
pushq $0x2
popq %r13
movq 0xc8(%rbx), %rax
subq 0x38(%rbx), %rax
sarq $0x2, %rax
cqto
idivq %r13
movl %eax, 0x58(%rbx)
incl %r12d
movl 0xc0(%rbx), %esi
movq %rbx, %rdi
callq 0xf800
cmpl %r15d, %eax
je 0x4cb0
cmpl $0x1, %r12d
je 0x4cfb
movq 0x150(%rbx), %rdi
leaq 0xd295(%rip), %rsi      # 0x11f86
movl %r12d, %edx
xorl %eax, %eax
callq 0x2060
movzbl -0x29(%rbp), %eax
movq 0x170(%rbx), %rcx
movl %eax, (%rcx)
movq 0x160(%rbx), %rax
movl %r14d, (%rax)
jmp 0x49a6
movq 0x148(%rbx), %rax
movups 0xcab9(%rip), %xmm0     # 0x117de
movups %xmm0, (%rax)
movw $0x7d, 0x10(%rax)
jmp 0x49a6
nop