// File: probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::tryF12()
void Signal::tryF12()   //  K=(D:3,H:1,F:8) {37.9k,422}<1,-3|3,-1>(K,-80,K) for H=0. 
						//{37.9k,422}<1,-3|3,-1>(K,-80,K,-208,K,-80,K)+ for H=1. 
		//F32:			//{38k,420, msb}<1,-3|3,-1>(D:8,S:8,F:8,E:8,-100m)* 
{
	if ( nFrameL != 12 && nFrameL != 32 || !framed(nMaxDur*16) )
		return;
    if ( sortBurst.min1 * 1.15 < sortBurst.max1 )
        return;
    nMaxShort = sortBurst.min1 * .4;
    cleanup();
	for (int ndx=0; ndx<nFrameL; ++ndx)
	{
		if (pFrame[2*ndx] > nMaxShort)
		{
			if (pFrame[2*ndx+1] > nMaxShort && ndx<nFrameL-1)
				return;
			cBits[ndx>>3] |= 1 << (ndx&7);
		}
	}
	if (nFrameL == 12) {
		strcpy(pProtocol,"F12");
		*pDevice = getLsb(0,3);
		*pSubDevice = getLsb(3,1);
		*pOBC = getLsb(4,8);
	}
	else {
		strcpy(pProtocol,"F32");
		*pDevice = msb(cBits[0]);
		*pSubDevice =  msb(cBits[1]);
		*pOBC =  msb(cBits[2]);
		sprintf(pMisc, "E = %d",  msb(cBits[3]));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpl $0xc, 0x48(%rax)
je 0x11f24
movq -0x18(%rbp), %rax
cmpl $0x20, 0x48(%rax)
jne 0x11f42
movq -0x18(%rbp), %rdi
movss 0x821c(%rip), %xmm0     # 0x1a14c
mulss 0x9c(%rdi), %xmm0
callq 0x18840
cmpl $0x0, %eax
jne 0x11f47
jmp 0x1217a
movq -0x18(%rbp), %rax
movss 0x1d0(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x8769(%rip), %xmm0     # 0x1a6c8
mulsd %xmm0, %xmm1
movss 0x1dc(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x11f7a
jmp 0x1217a
movq -0x18(%rbp), %rdi
movss 0x1d0(%rdi), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x83c6(%rip), %xmm1     # 0x1a358
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xe8(%rdi)
callq 0x16180
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x48(%rcx), %eax
jge 0x1204e
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rcx
movl -0xc(%rbp), %edx
shll %edx
movslq %edx, %rdx
movss (%rcx,%rdx,4), %xmm0
ucomiss 0xe8(%rax), %xmm0
jbe 0x1203e
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rcx
movl -0xc(%rbp), %edx
shll %edx
addl $0x1, %edx
movslq %edx, %rdx
movss (%rcx,%rdx,4), %xmm0
ucomiss 0xe8(%rax), %xmm0
jbe 0x12013
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
movl 0x48(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x12013
jmp 0x1217a
movq -0x18(%rbp), %rax
movl -0xc(%rbp), %ecx
andl $0x7, %ecx
movl $0x1, %esi
shll %cl, %esi
movl -0xc(%rbp), %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl 0xa0(%rax,%rcx), %edx
orl %esi, %edx
movb %dl, 0xa0(%rax,%rcx)
jmp 0x12040
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x11fae
movq -0x18(%rbp), %rax
cmpl $0xc, 0x48(%rax)
jne 0x120cf
movq -0x18(%rbp), %rax
movq 0x148(%rax), %rdi
leaq 0x8f47(%rip), %rsi      # 0x1afb1
callq 0x2120
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x3, %edx
callq 0x16030
movq -0x18(%rbp), %rdi
movl %eax, %ecx
movq 0x160(%rdi), %rax
movl %ecx, (%rax)
movl $0x3, %esi
movl $0x1, %edx
callq 0x16030
movq -0x18(%rbp), %rdi
movl %eax, %ecx
movq 0x168(%rdi), %rax
movl %ecx, (%rax)
movl $0x4, %esi
movl $0x8, %edx
callq 0x16030
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq 0x170(%rax), %rax
movl %ecx, (%rax)
jmp 0x1217a
movq -0x18(%rbp), %rax
movq 0x148(%rax), %rdi
leaq 0x8ed4(%rip), %rsi      # 0x1afb5
callq 0x2120
movq -0x18(%rbp), %rdi
movzbl 0xa0(%rdi), %esi
movl $0x8, %edx
callq 0x15e70
movq -0x18(%rbp), %rdi
movl %eax, %ecx
movq 0x160(%rdi), %rax
movl %ecx, (%rax)
movzbl 0xa1(%rdi), %esi
movl $0x8, %edx
callq 0x15e70
movq -0x18(%rbp), %rdi
movl %eax, %ecx
movq 0x168(%rdi), %rax
movl %ecx, (%rax)
movzbl 0xa2(%rdi), %esi
movl $0x8, %edx
callq 0x15e70
movq -0x18(%rbp), %rdi
movl %eax, %ecx
movq 0x170(%rdi), %rax
movl %ecx, (%rax)
movq 0x150(%rdi), %rax
movq %rax, -0x20(%rbp)
movzbl 0xa3(%rdi), %esi
movl $0x8, %edx
callq 0x15e70
movq -0x20(%rbp), %rdi
movl %eax, %edx
leaq 0x8d28(%rip), %rsi      # 0x1ae9b
movb $0x0, %al
callq 0x2060
addq $0x20, %rsp
popq %rbp
retq