// File: 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
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq 0x40(%rax), %rcx
movss (%rcx), %xmm1
movss 0x1dc(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x618e
jmp 0x672a
movq -0x58(%rbp), %rax
movq 0x38(%rax), %rcx
movss 0x4(%rcx), %xmm1
movss 0x1e0(%rax), %xmm0
ucomiss %xmm1, %xmm0
jb 0x61ad
jmp 0x672a
movq -0x58(%rbp), %rax
cmpl $0x14, 0x48(%rax)
jg 0x61c1
movq -0x58(%rbp), %rax
cmpl $0x6, 0x48(%rax)
jge 0x61c6
jmp 0x672a
movq -0x58(%rbp), %rax
cmpl $0x2, 0x54(%rax)
jl 0x61d5
jmp 0x672a
movq -0x58(%rbp), %rax
movss 0x13e37(%rip), %xmm1    # 0x1a018
mulss 0x1d0(%rax), %xmm1
movss 0x1dc(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x61fb
jmp 0x672a
movq -0x58(%rbp), %rdi
callq 0x16180
movq -0x58(%rbp), %rax
movss 0x1dc(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x14044(%rip), %xmm1    # 0x1a260
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
movss -0xc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x13f86(%rip), %xmm0    # 0x1a1c0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xe0(%rax)
movss 0x13dc2(%rip), %xmm0    # 0x1a014
mulss -0xc(%rbp), %xmm0
movss %xmm0, 0xf4(%rax)
movss %xmm0, 0xe4(%rax)
movss 0x13da9(%rip), %xmm0    # 0x1a018
mulss -0xc(%rbp), %xmm0
movss %xmm0, 0xf8(%rax)
movss %xmm0, 0xe8(%rax)
movss 0x13d94(%rip), %xmm0    # 0x1a020
mulss -0xc(%rbp), %xmm0
movss %xmm0, 0xec(%rax)
movss 0x13d87(%rip), %xmm0    # 0x1a028
mulss -0xc(%rbp), %xmm0
movss %xmm0, 0xf0(%rax)
movq 0xc8(%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0xc8(%rax)
movq 0xc8(%rax), %rcx
movq %rcx, %rdx
addq $0x4, %rdx
movq %rdx, 0xc8(%rax)
movss (%rcx), %xmm0
ucomiss 0xe8(%rax), %xmm0
jbe 0x62e7
jmp 0x672a
movq -0x58(%rbp), %rax
movl $0x1, 0xc4(%rax)
movq -0x58(%rbp), %rdi
callq 0x17050
cmpl $0x0, %eax
jne 0x6308
jmp 0x672a
jmp 0x630a
movq -0x58(%rbp), %rcx
movq 0xc8(%rcx), %rax
cmpq 0x40(%rcx), %rax
jne 0x62f5
movq -0x58(%rbp), %rax
cmpl $0x8, 0xc0(%rax)
jge 0x632d
jmp 0x672a
movq -0x58(%rbp), %rax
movl 0xc0(%rax), %eax
movl %eax, -0x5c(%rbp)
subl $0x9, %eax
je 0x6355
jmp 0x6341
movl -0x5c(%rbp), %eax
addl $-0xf, %eax
subl $0x2, %eax
jb 0x64f6
jmp 0x66a8
movq -0x58(%rbp), %rdi
movl $0x2, 0x5c(%rdi)
movl 0x48(%rdi), %eax
movl %eax, 0x58(%rdi)
xorl %esi, %esi
movl $0x7, %edx
callq 0x16030
movq -0x58(%rbp), %rdi
movl %eax, -0x10(%rbp)
movl $0x7, %esi
movl $0x2, %edx
callq 0x16030
movl %eax, %ecx
movq -0x58(%rbp), %rax
movl %ecx, -0x14(%rbp)
movq 0x148(%rax), %rdi
leaq 0x14cfc(%rip), %rsi     # 0x1b09b
callq 0x2120
movq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x16030
cmpl $0x1ff, %eax            # imm = 0x1FF
jne 0x64b1
movq -0x58(%rbp), %rdi
movl $0x9, %esi
callq 0x176f0
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jl 0x6493
cmpl $0x1ff, -0x18(%rbp)     # imm = 0x1FF
je 0x6493
movq -0x58(%rbp), %rdi
movl $0x0, -0x1c(%rbp)
xorl %esi, %esi
movl $0x6, %edx
callq 0x16030
movq -0x58(%rbp), %rdi
movl %eax, -0x10(%rbp)
movl $0x6, %esi
movl $0x3, %edx
callq 0x16030
movl %eax, -0x14(%rbp)
movq -0x58(%rbp), %rdi
movq 0xc8(%rdi), %rax
movq 0x38(%rdi), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl $0x2, %ecx
cqto
idivq %rcx
movl %eax, 0x58(%rdi)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl $0x9, %esi
callq 0x176f0
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
je 0x6417
movq -0x58(%rbp), %rax
movq 0x148(%rax), %rdi
leaq 0x14c41(%rip), %rsi     # 0x1b0ab
callq 0x2120
cmpl $0x1, -0x1c(%rbp)
jle 0x6491
movq -0x58(%rbp), %rax
movq 0x150(%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x14c2b(%rip), %rsi     # 0x1b0b5
movb $0x0, %al
callq 0x2060
jmp 0x64af
movq -0x58(%rbp), %rax
movq 0x148(%rax), %rdi
leaq 0x14405(%rip), %rsi     # 0x1a8aa
callq 0x2120
jmp 0x672a
jmp 0x64b1
movq -0x58(%rbp), %rdi
movl -0x10(%rbp), %ecx
movq 0x170(%rdi), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %ecx
movq 0x160(%rdi), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %esi
movl $0x8, %edx
callq 0x15e70
movl %eax, %ecx
movq -0x58(%rbp), %rax
sarl %ecx
addl $0x80, %ecx
movq 0x178(%rax), %rax
movl %ecx, (%rax)
jmp 0x672a
movq -0x58(%rbp), %rdi
movl $0x2, 0x5c(%rdi)
movl 0x48(%rdi), %eax
movl %eax, 0x58(%rdi)
xorl %esi, %esi
movl $0x8, %edx
callq 0x16030
movq -0x58(%rbp), %rdi
movl %eax, -0x24(%rbp)
movl 0xc0(%rdi), %edx
subl $0x1, %edx
movl $0x8, %esi
callq 0x16030
movl %eax, %ecx
movq -0x58(%rbp), %rax
movl %ecx, -0x28(%rbp)
movq 0x148(%rax), %rdi
movl 0xc0(%rax), %edx
addl $0x1, %edx
leaq 0x14b6d(%rip), %rsi     # 0x1b0ba
movb $0x0, %al
callq 0x2060
movq -0x58(%rbp), %rdi
movq 0x148(%rdi), %rax
addq $0x5, %rax
movq %rax, -0x30(%rbp)
movl 0xc0(%rdi), %edx
xorl %esi, %esi
callq 0x16030
movq -0x58(%rbp), %rcx
movl 0xc0(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jne 0x6687
movq -0x58(%rbp), %rdi
movl 0xc0(%rdi), %esi
callq 0x176f0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x6670
movq -0x58(%rbp), %rcx
movl -0x34(%rbp), %eax
movl 0xc0(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
je 0x6670
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movl $0x0, -0x38(%rbp)
xorl %esi, %esi
movl $0x8, %edx
callq 0x16030
movq -0x58(%rbp), %rdi
movl %eax, -0x24(%rbp)
movl 0xc0(%rdi), %edx
subl $0x8, %edx
movl $0x8, %esi
callq 0x16030
movl %eax, -0x28(%rbp)
movq -0x58(%rbp), %rdi
movq 0xc8(%rdi), %rax
movq 0x38(%rdi), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl $0x2, %ecx
cqto
idivq %rcx
movl %eax, 0x58(%rdi)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl 0xc0(%rdi), %esi
callq 0x176f0
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x34(%rbp), %eax
je 0x660a
cmpl $0x1, -0x38(%rbp)
jle 0x666e
movq -0x58(%rbp), %rax
movq 0x150(%rax), %rdi
movl -0x38(%rbp), %edx
leaq 0x14a4e(%rip), %rsi     # 0x1b0b5
movb $0x0, %al
callq 0x2060
jmp 0x6685
movq -0x30(%rbp), %rdi
leaq 0x14238(%rip), %rsi     # 0x1a8b3
callq 0x2120
jmp 0x672a
jmp 0x6687
movq -0x58(%rbp), %rax
movl -0x24(%rbp), %edx
movq 0x170(%rax), %rcx
movl %edx, (%rcx)
movl -0x28(%rbp), %ecx
movq 0x160(%rax), %rax
movl %ecx, (%rax)
jmp 0x672a
movq -0x58(%rbp), %rax
movq 0x148(%rax), %rdi
leaq 0x14202(%rip), %rsi     # 0x1a8bc
callq 0x2120
movq -0x58(%rbp), %rax
movl 0xc0(%rax), %edx
movq 0x160(%rax), %rcx
movl %edx, (%rcx)
movq 0x150(%rax), %rcx
movq %rcx, -0x48(%rbp)
movl 0xc0(%rax), %eax
addl $0x7, %eax
sarl $0x3, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, %eax
jl 0x672a
movq -0x58(%rbp), %rax
movq -0x48(%rbp), %rdi
movslq -0x4c(%rbp), %rcx
movzbl 0xa0(%rax,%rcx), %edx
leaq 0x14922(%rip), %rsi     # 0x1b037
movb $0x0, %al
callq 0x2060
movq -0x48(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x48(%rbp)
jmp 0x66ec
addq $0x60, %rsp
popq %rbp
retq