// File: /workspace/github_cpp_makefile_star2_O1/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 0x4c67
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movss 0x1e0(%rdi), %xmm1
ucomiss 0x4(%rax), %xmm1
jae 0x4c67
movl 0x48(%rbx), %ecx
addl $-0x15, %ecx
cmpl $-0xf, %ecx
jb 0x4c67
cmpl $0x1, 0x54(%rbx)
jg 0x4c67
movss 0x1d0(%rbx), %xmm1
mulss 0xd947(%rip), %xmm1     # 0x12500
ucomiss %xmm1, %xmm0
ja 0x4c67
xorps %xmm1, %xmm1
movups %xmm1, 0xa0(%rbx)
movq $0x0, 0xc0(%rbx)
cvtss2sd %xmm0, %xmm0
mulsd 0xd56d(%rip), %xmm0     # 0x12150
cvtsd2ss %xmm0, %xmm0
movss 0xd921(%rip), %xmm1     # 0x12510
mulss %xmm0, %xmm1
movss %xmm1, 0xe0(%rbx)
movaps %xmm0, %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0xf4(%rbx)
movss %xmm1, 0xe4(%rbx)
movss 0xd8e6(%rip), %xmm1     # 0x12500
mulss %xmm0, %xmm1
movss %xmm1, 0xf8(%rbx)
movss %xmm1, 0xe8(%rbx)
movss 0xd8d2(%rip), %xmm2     # 0x12508
mulss %xmm0, %xmm2
movss %xmm2, 0xec(%rbx)
mulss 0xd8ca(%rip), %xmm0     # 0x12514
movss %xmm0, 0xf0(%rbx)
leaq 0xc(%rax), %rcx
movq %rcx, 0xc8(%rbx)
movss 0x8(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x4c76
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0xc4(%rbx)
movq %rbx, %rdi
callq 0x10840
testl %eax, %eax
je 0x4c67
movq 0xc8(%rbx), %rax
cmpq 0x40(%rbx), %rax
jne 0x4c80
movl 0xc0(%rbx), %r15d
cmpl $0x8, %r15d
jl 0x4c67
leal -0xf(%r15), %eax
cmpl $0x2, %eax
jae 0x4d86
movl $0x2, 0x5c(%rbx)
movl 0x48(%rbx), %eax
movl %eax, 0x58(%rbx)
movzbl 0xa0(%rbx), %r13d
leal -0x1(%r15), %edx
movq %rbx, %rdi
movl $0x8, %esi
callq 0xfe7e
movl %eax, %r14d
movq 0x148(%rbx), %rdi
incl %r15d
leaq 0xe2a7(%rip), %rsi      # 0x12f94
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 0xfe7e
movl $0x1, %edx
movl %r15d, %ecx
shll %cl, %edx
addl $-0x2, %edx
cmpl %edx, %eax
jne 0x4d72
addq $0x5, %r12
movq %rbx, %rdi
movl %r15d, %esi
callq 0x10b9c
testl %eax, %eax
js 0x4d52
movl %eax, %r15d
movb 0xc0(%rbx), %cl
movl $0x1, %eax
shll %cl, %eax
addl $-0x2, %eax
cmpl %eax, %r15d
jne 0x4f31
movabsq $0x7d7869666572707b, %rax # imm = 0x7D7869666572707B
movq %rax, (%r12)
movb $0x0, 0x8(%r12)
xorl %r15d, %r15d
testb %r15b, %r15b
je 0x4c67
movq 0x170(%rbx), %rax
movl %r13d, (%rax)
movl $0x160, %eax            # imm = 0x160
jmp 0x503d
cmpl $0x9, %r15d
jne 0x4ec0
movl $0x2, 0x5c(%rbx)
movl 0x48(%rbx), %eax
movl %eax, 0x58(%rbx)
movzbl 0xa0(%rbx), %eax
movl %eax, %r12d
andl $0x7f, %r12d
shrl $0x7, %eax
movzbl 0xa1(%rbx), %ecx
andl $0x1, %ecx
leal (%rax,%rcx,2), %r13d
movq 0x148(%rbx), %rax
movups 0xe1ab(%rip), %xmm0     # 0x12f75
movups %xmm0, (%rax)
movzbl 0xa0(%rbx), %eax
movzbl 0xa1(%rbx), %ecx
andl $0x1, %ecx
shll $0x8, %ecx
orl %eax, %ecx
cmpl $0x1ff, %ecx            # imm = 0x1FF
jne 0x4fd8
movq %rbx, %rdi
movl $0x9, %esi
callq 0x10b9c
movl %eax, %r15d
testl %eax, %eax
setns %al
cmpl $0x1ff, %r15d           # imm = 0x1FF
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x4fb9
movb %cl, -0x29(%rbp)
movzbl 0xa0(%rbx), %eax
movl %eax, -0x30(%rbp)
movl %eax, %r12d
andl $0x3f, %r12d
movzbl 0xa1(%rbx), %r13d
shll $0x2, %r13d
andl $0x4, %r13d
xorl %r14d, %r14d
movq 0xc8(%rbx), %rax
subq 0x38(%rbx), %rax
movq %rax, %rcx
shrq $0x2, %rcx
shrq $0x3f, %rax
addq %rcx, %rax
shrq %rax
movl %eax, 0x58(%rbx)
incl %r14d
movq %rbx, %rdi
movl $0x9, %esi
callq 0x10b9c
cmpl %r15d, %eax
je 0x4e40
movl -0x30(%rbp), %eax
shrl $0x6, %eax
orl %r13d, %eax
movl %eax, %r13d
movq 0x148(%rbx), %rax
movabsq $0x6b6e757075616c42, %rcx # imm = 0x6B6E757075616C42
movq %rcx, (%rax)
movw $0x74, 0x8(%rax)
cmpl $0x1, %r14d
je 0x4eb8
movq 0x150(%rbx), %rdi
leaq 0xe0e1(%rip), %rsi      # 0x12f8f
movl %r14d, %edx
xorl %eax, %eax
callq 0x2060
movb -0x29(%rbp), %cl
jmp 0x4fd0
movq 0x148(%rbx), %rax
movb $0x0, 0x2(%rax)
movw $0x5858, (%rax)         # imm = 0x5858
movl 0xc0(%rbx), %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movl 0xc0(%rbx), %eax
addl $0x7, %eax
sarl $0x3, %eax
testl %eax, %eax
jle 0x4c67
movq 0x150(%rbx), %r14
movl %eax, %r12d
leaq 0xe011(%rip), %r15      # 0x12f15
leaq -0x1(%r12), %r13
movzbl 0x9f(%rbx,%r12), %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2060
addq $0x2, %r14
cmpq $0x1, %r12
movq %r13, %r12
jg 0x4f04
jmp 0x4c67
movb $0x0, (%r12)
movzbl 0xa0(%rbx), %r13d
movl 0xc0(%rbx), %edx
addl $-0x8, %edx
movq %rbx, %rdi
movl $0x8, %esi
callq 0xfe7e
movl %eax, %r14d
xorl %r12d, %r12d
movq 0xc8(%rbx), %rax
subq 0x38(%rbx), %rax
movq %rax, %rcx
shrq $0x2, %rcx
shrq $0x3f, %rax
addq %rcx, %rax
shrq %rax
movl %eax, 0x58(%rbx)
incl %r12d
movl 0xc0(%rbx), %esi
movq %rbx, %rdi
callq 0x10b9c
cmpl %r15d, %eax
je 0x4f5a
movb $0x1, %r15b
cmpl $0x1, %r12d
je 0x4d69
movq 0x150(%rbx), %rdi
leaq 0xdfe5(%rip), %rsi      # 0x12f8f
movl %r12d, %edx
xorl %eax, %eax
callq 0x2060
jmp 0x4d69
movq 0x148(%rbx), %rax
movups 0xd81a(%rip), %xmm0     # 0x127e1
movups %xmm0, (%rax)
movw $0x7d, 0x10(%rax)
testb %cl, %cl
je 0x4c67
movq 0x170(%rbx), %rax
movl %r12d, (%rax)
movq 0x160(%rbx), %rax
movl %r13d, (%rax)
bswapl %r12d
movl %r12d, %eax
shll $0x4, %eax
shrl $0x4, %r12d
andl $0x7000000, %r12d       # imm = 0x7000000
orl %eax, %r12d
movl %r12d, %eax
andl $0x33000000, %eax       # imm = 0x33000000
shrl $0x2, %r12d
andl $0x31000000, %r12d      # imm = 0x31000000
leal (%r12,%rax,4), %eax
movl %eax, %ecx
andl $0x55000000, %ecx       # imm = 0x55000000
shrl %eax
andl $0x54000000, %eax       # imm = 0x54000000
leal (%rax,%rcx,2), %r14d
shrl $0x19, %r14d
orl $0x80, %r14d
movl $0x178, %eax            # imm = 0x178
movq (%rbx,%rax), %rax
movl %r14d, (%rax)
jmp 0x4c67
nop