// File: /workspace/github_cpp_makefile_star2_O2/probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::tryPCTV()
void Signal::tryPCTV()
{
	// {38.4k,832}<0,-1|1,-0>(2,-8,1,D:8,F:8,2,-???)

	if ( nFrameL > 10 )
		return;

	// nTotDur is nominal 29
	if (   nTotDur < 27.*832.
		|| nTotDur > 31.*832. )
	{
		return;
	}
	if ( pFrame[0] > (2.3/29.) * nTotDur )
		return;
	double nominal10 = pFrame[0]+pFrame[1];
	if (   nTotDur > 3.0 * nominal10      
		|| nTotDur < 2.8 * nominal10 )
	{
		return;
	}
	m_rawUnit =  29. / nTotDur;
	m_rawPulseAdjust = .5;  // Pulse from -.5 to +.25
	m_rawGapAdjust = .25;   // Gap from -.25 to +.5
	m_rawErrorLimit = .75;

	cleanup();
	pBit += 2;
	if ( ! decodeRaw(19) || pBit != pFrameEnd )
	{
		return;
	}
	if ( cBits[2]<6 )
		return;
	strcpy(pProtocol,"PCTV");
	*pDevice = getLsb(1,8);
	*pOBC = getLsb(9,8);
	sprintf(pMisc,"h=%02X %02X", msb(*pDevice), msb(*pOBC));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $0xa, 0x48(%rdi)
jle 0xbfbb
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movss 0x98(%rdi), %xmm0
movss 0x5682(%rip), %xmm1     # 0x11650
ucomiss %xmm0, %xmm1
ja 0xbfb0
ucomiss 0x567a(%rip), %xmm0     # 0x11654
ja 0xbfb0
cvtss2sd %xmm0, %xmm1
movq 0x38(%rbx), %rax
movss (%rax), %xmm2
cvtss2sd %xmm2, %xmm3
movsd 0x5474(%rip), %xmm4     # 0x11468
mulsd %xmm1, %xmm4
ucomisd %xmm4, %xmm3
ja 0xbfb0
addss 0x4(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movsd 0x50c9(%rip), %xmm3     # 0x110d8
mulsd %xmm2, %xmm3
ucomisd %xmm3, %xmm1
ja 0xbfb0
mulsd 0x5247(%rip), %xmm2     # 0x11268
ucomisd %xmm1, %xmm2
ja 0xbfb0
movss 0x5629(%rip), %xmm1     # 0x11658
divss %xmm0, %xmm1
movss %xmm1, 0xfc(%rbx)
movabsq $0x3e8000003f000000, %rcx # imm = 0x3E8000003F000000
movq %rcx, 0x100(%rbx)
movl $0x3f400000, 0x108(%rbx) # imm = 0x3F400000
xorps %xmm0, %xmm0
movups %xmm0, 0xa0(%rbx)
andq $0x0, 0xc0(%rbx)
addq $0x8, %rax
movq %rax, 0xc8(%rbx)
pushq $0x13
popq %rsi
movq %rbx, %rdi
callq 0xeebe
testl %eax, %eax
je 0xbfb0
movq 0xc8(%rbx), %rax
cmpq 0x40(%rbx), %rax
jne 0xbfb0
cmpb $0x6, 0xa2(%rbx)
jb 0xbfb0
movq 0x148(%rbx), %rax
movb $0x0, 0x4(%rax)
movl $0x56544350, (%rax)     # imm = 0x56544350
pushq $0x1
popq %rsi
pushq $0x8
popq %r14
movq %rbx, %rdi
movl %r14d, %edx
callq 0xebd6
movq 0x160(%rbx), %r15
movl %eax, (%r15)
pushq $0x9
popq %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0xebd6
movq 0x170(%rbx), %rcx
movl %eax, (%rcx)
movq 0x150(%rbx), %rdi
movl (%r15), %edx
bswapl %edx
movl %edx, %ecx
shrl $0x4, %ecx
movl $0xf0f0f0f, %r8d        # imm = 0xF0F0F0F
andl %r8d, %ecx
andl %r8d, %edx
shll $0x4, %edx
orl %ecx, %edx
movl $0x33333333, %ecx       # imm = 0x33333333
movl %edx, %esi
andl %ecx, %esi
shrl $0x2, %edx
andl %ecx, %edx
leal (%rdx,%rsi,4), %edx
movl $0x55000000, %esi       # imm = 0x55000000
movl %edx, %r9d
andl %esi, %r9d
shrl %edx
andl %esi, %edx
leal (%rdx,%r9,2), %edx
shrl $0x18, %edx
bswapl %eax
movl %eax, %r9d
shrl $0x4, %r9d
andl %r8d, %r9d
andl %r8d, %eax
shll $0x4, %eax
orl %r9d, %eax
movl %eax, %r8d
andl %ecx, %r8d
shrl $0x2, %eax
andl %ecx, %eax
leal (%rax,%r8,4), %eax
movl %eax, %ecx
andl %esi, %ecx
shrl %eax
andl %esi, %eax
leal (%rax,%rcx,2), %ecx
shrl $0x18, %ecx
leaq 0x5886(%rip), %rsi      # 0x119f0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2060
nop