// File: probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::tryAirboard()
void Signal::tryAirboard()
{
	if ( nFrameL < 5 )
		return;
	// Left framing always checked
	if (!framedLeft(22*8*105))
		return;
	// Right framing only checked if outside repeat section
	if (   *pFrameEnd < 22*8*105
		&& pFrameEnd < pDuration+2*nSingle )
	{
		return;
	}
	if (pFrame[2] < 5*105 || pFrame[2] > 8*105)
		return;
	if (nMaxDur > 22*8*105 || nMaxDur < 2*8*105)
		return;
    require( sortOn.max1 < 8*105 )
    require( sortOn.min1 > 5*105 || sortOn.min1 == pFrame[0] )

    double rClock = 1.0 / 105;
	int repByte = -1;
	int bytes = 0;
	int phase = 0;
	cBits[0] = 0;
    float* pX;
	for (pX = pFrame+1; ; pX+=2)
	{
		if ( pX == pDuration+2*nSingle+1 && repByte < 0 )
		{
			repByte = 2*bytes;
			if ( phase )
				--repByte;
		}
		int nb = (int)( floor( *pX * rClock) ) + 2;  // Number of sequential one bits
		int np = (nb >> 3) + phase;                  // New phase after those one bits
		if (np >= 10)                                // End of valid byte
		{
			cBits[bytes] |= (0xFF)<<phase;
			phase = 0;
			cBits[++bytes] = 0;
			if ( pX > pFrameEnd )                // Found a valid byte past requested frame
				return;                          // so requested frame is wrong.
			if ( *pX >= 22*8*105 )
				break;
			if ( pX >= pDuration+2*(nSingle+nRepeat)-1 )
				break;
		}
		else
		{
			if ( pX == pFrameEnd )					 // Frame ends on non byte boundary
				return;                              // so requested frame is wrong.
			if ( np > 7 )                            // Stop bits are wrong
				break;                               //   stop and check if past valid frame
			if ( (nb & 7) >= 5 )                     // Not whole number of bits
				break;                               //   stop and check if past valid frame
			cBits[bytes] |= (1<<np) - (1<<phase);
			phase = np+1;
		}
	}
	if ( pX < pFrameEnd )
		return;
	sprintf(pProtocol, "AirB%d-", bytes);
	for (int nn=0; nn<bytes; ++nn)
	{
		sprintf(pProtocol+strlen(pProtocol),
			(nn==(repByte>>1))
			   ? ( (repByte & 1 ) ? ":%02X" : ";%02X" )
			   : ( nn ? ".%02X" : "%02X" )
			, cBits[nn] );
		*pOBC = cBits[0] & 7;
		*pDevice = cBits[0] >> 3;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x5, 0x48(%rax)
jge 0x12b0f
jmp 0x12eee
movq -0x40(%rbp), %rdi
movss 0x7639(%rip), %xmm0     # 0x1a154
callq 0x18ac0
cmpl $0x0, %eax
jne 0x12b2a
jmp 0x12eee
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
movss 0x761a(%rip), %xmm0     # 0x1a154
ucomiss (%rax), %xmm0
jbe 0x12b64
movq -0x40(%rbp), %rdx
movq 0x40(%rdx), %rax
movq 0x8(%rdx), %rcx
movl 0x20(%rdx), %edx
shll %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x12b64
jmp 0x12eee
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movss 0x74fc(%rip), %xmm0     # 0x1a070
ucomiss 0x8(%rax), %xmm0
ja 0x12b94
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movss 0x8(%rax), %xmm0
movss 0x75c9(%rip), %xmm1     # 0x1a158
ucomiss %xmm1, %xmm0
jbe 0x12b99
jmp 0x12eee
movq -0x40(%rbp), %rax
movss 0x9c(%rax), %xmm0
movss 0x75a7(%rip), %xmm1     # 0x1a154
ucomiss %xmm1, %xmm0
ja 0x12bc7
movq -0x40(%rbp), %rax
movss 0x759e(%rip), %xmm0     # 0x1a15c
ucomiss 0x9c(%rax), %xmm0
jbe 0x12bcc
jmp 0x12eee
movq -0x40(%rbp), %rax
movss 0x7580(%rip), %xmm0     # 0x1a158
ucomiss 0x184(%rax), %xmm0
ja 0x12be6
jmp 0x12eee
movq -0x40(%rbp), %rax
movss 0x180(%rax), %xmm0
movss 0x7476(%rip), %xmm1     # 0x1a070
ucomiss %xmm1, %xmm0
ja 0x12c1d
movq -0x40(%rbp), %rax
movss 0x180(%rax), %xmm0
movq 0x38(%rax), %rax
ucomiss (%rax), %xmm0
jne 0x12c18
jp 0x12c18
jmp 0x12c1d
jmp 0x12eee
movq -0x40(%rbp), %rax
movsd 0x7adf(%rip), %xmm0     # 0x1a708
movsd %xmm0, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movb $0x0, 0xa0(%rax)
movq 0x38(%rax), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rax
movq 0x8(%rdx), %rcx
movl 0x20(%rdx), %edx
shll %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0x12c99
cmpl $0x0, -0x14(%rbp)
jge 0x12c99
movl -0x18(%rbp), %eax
shll %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12c97
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x12c99
movq -0x28(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd -0x10(%rbp), %xmm0
callq 0x2200
cvttsd2si %xmm0, %eax
addl $0x2, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
sarl $0x3, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
cmpl $0xa, -0x30(%rbp)
jl 0x12d60
movl -0x1c(%rbp), %ecx
movl $0xff, %esi
shll %cl, %esi
movq -0x40(%rbp), %rcx
movslq -0x18(%rbp), %rax
movzbl 0xa0(%rcx,%rax), %edx
orl %esi, %edx
movb %dl, 0xa0(%rcx,%rax)
movl $0x0, -0x1c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cltq
movb $0x0, 0xa0(%rcx,%rax)
movq -0x28(%rbp), %rax
cmpq 0x40(%rcx), %rax
jbe 0x12d1b
jmp 0x12eee
movq -0x28(%rbp), %rax
movss (%rax), %xmm0
movss 0x7429(%rip), %xmm1     # 0x1a154
ucomiss %xmm1, %xmm0
jb 0x12d35
jmp 0x12dd5
movq -0x40(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rsi), %rcx
movl 0x20(%rsi), %edx
addl 0x24(%rsi), %edx
shll %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
jb 0x12d5e
jmp 0x12dd5
jmp 0x12dc2
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
cmpq 0x40(%rcx), %rax
jne 0x12d73
jmp 0x12eee
cmpl $0x7, -0x30(%rbp)
jle 0x12d7b
jmp 0x12dd5
movl -0x2c(%rbp), %eax
andl $0x7, %eax
cmpl $0x5, %eax
jl 0x12d88
jmp 0x12dd5
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl $0x1, %esi
shll %cl, %esi
movl -0x1c(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl %ecx, %esi
movslq -0x18(%rbp), %rcx
movzbl 0xa0(%rax,%rcx), %edx
orl %esi, %edx
movb %dl, 0xa0(%rax,%rcx)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x12dc4
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
jmp 0x12c56
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
cmpq 0x40(%rcx), %rax
jae 0x12de8
jmp 0x12eee
movq -0x40(%rbp), %rax
movq 0x148(%rax), %rdi
movl -0x18(%rbp), %edx
leaq 0x82e9(%rip), %rsi      # 0x1b0e6
movb $0x0, %al
callq 0x2060
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x12eee
movq -0x40(%rbp), %rax
movq 0x148(%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x148(%rax), %rdi
callq 0x20a0
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %eax
movl -0x14(%rbp), %ecx
sarl %ecx
cmpl %ecx, %eax
jne 0x12e7b
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x12e64
leaq 0x8290(%rip), %rax      # 0x1b0ee
movq %rax, -0x58(%rbp)
jmp 0x12e71
leaq 0x8289(%rip), %rax      # 0x1b0f4
movq %rax, -0x58(%rbp)
jmp 0x12e71
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x12e97
movl -0x34(%rbp), %edx
leaq 0x81b2(%rip), %rax      # 0x1b037
leaq 0x826e(%rip), %rcx      # 0x1b0fa
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rdi
movq -0x60(%rbp), %rsi
movslq -0x34(%rbp), %rcx
movzbl 0xa0(%rax,%rcx), %edx
movb $0x0, %al
callq 0x2060
movq -0x40(%rbp), %rax
movzbl 0xa0(%rax), %edx
andl $0x7, %edx
movq 0x170(%rax), %rcx
movl %edx, (%rcx)
movzbl 0xa0(%rax), %ecx
sarl $0x3, %ecx
movq 0x160(%rax), %rax
movl %ecx, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x12e0b
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)