// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
pushq %rax
cmpl $0xa, 0x48(%rdi)
jle 0xcce9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rdi, %rbx
movss 0x98(%rdi), %xmm0
movss 0x5958(%rip), %xmm1     # 0x12654
ucomiss %xmm0, %xmm1
ja 0xcce2
ucomiss 0x5950(%rip), %xmm0     # 0x12658
ja 0xcce2
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movq 0x38(%rbx), %rax
movss (%rax), %xmm2
cvtss2sd %xmm2, %xmm3
movsd 0x5743(%rip), %xmm4     # 0x12468
mulsd %xmm1, %xmm4
ucomisd %xmm4, %xmm3
ja 0xcce2
addss 0x4(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movsd 0x5398(%rip), %xmm3     # 0x120d8
mulsd %xmm2, %xmm3
ucomisd %xmm3, %xmm1
ja 0xcce2
mulsd 0x5516(%rip), %xmm2     # 0x12268
ucomisd %xmm1, %xmm2
ja 0xcce2
movss 0x58fc(%rip), %xmm1     # 0x1265c
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)
movq $0x0, 0xc0(%rbx)
addq $0x8, %rax
movq %rax, 0xc8(%rbx)
movq %rbx, %rdi
movl $0x13, %esi
callq 0x1018c
testl %eax, %eax
je 0xcce2
movq 0xc8(%rbx), %rax
cmpq 0x40(%rbx), %rax
jne 0xcce2
cmpb $0x6, 0xa2(%rbx)
jb 0xcce2
movq 0x148(%rbx), %rax
movb $0x0, 0x4(%rax)
movl $0x56544350, (%rax)     # imm = 0x56544350
movb 0xa0(%rbx), %al
movb 0xa1(%rbx), %cl
shrb %al
shlb $0x7, %cl
orb %al, %cl
movzbl %cl, %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movb 0xa1(%rbx), %al
movb 0xa2(%rbx), %dl
shrb %al
shlb $0x7, %dl
orb %al, %dl
movzbl %dl, %eax
movq 0x170(%rbx), %rdx
movl %eax, (%rdx)
movq 0x150(%rbx), %rdi
movl (%rcx), %ecx
bswapl %ecx
movl %ecx, %edx
shrl $0x4, %edx
movl $0xf0f0f0f, %esi        # imm = 0xF0F0F0F
andl %esi, %edx
andl %esi, %ecx
shll $0x4, %ecx
orl %edx, %ecx
movl $0x33333333, %edx       # imm = 0x33333333
movl %ecx, %esi
andl %edx, %esi
shrl $0x2, %ecx
andl %edx, %ecx
leal (%rcx,%rsi,4), %edx
movl $0x55000000, %ecx       # imm = 0x55000000
movl %edx, %esi
andl %ecx, %esi
shrl %edx
andl %ecx, %edx
leal (%rdx,%rsi,2), %edx
shrl $0x18, %edx
bswapl %eax
movl %eax, %esi
shll $0x4, %esi
shrl $0x4, %eax
andl $0xf000000, %eax        # imm = 0xF000000
orl %esi, %eax
movl $0x33000000, %esi       # imm = 0x33000000
movl %eax, %r8d
andl %esi, %r8d
shrl $0x2, %eax
andl %esi, %eax
leal (%rax,%r8,4), %eax
movl %eax, %esi
andl %ecx, %esi
shrl %eax
andl %ecx, %eax
leal (%rax,%rsi,2), %ecx
shrl $0x18, %ecx
leaq 0x5b54(%rip), %rsi      # 0x129f9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2060