// File: /workspace/github_cpp_makefile_star2_O3/probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::tryHumax()
void Signal::tryHumax()   //  {56k,105, msb}<-2,2|-3,1|1,-3|2,-2>(T=0,(2,-2,D:7, S:5,T:2,F:6:1,(F:1+1):2),^95m,T=1)+) DAR 2012 
{
	static int M = 0;	// toggle mask or previous T	
	int T;
	static int FC = 0;	// count of bypassed frames
	bool success;
	if (( nFrameL < 7 ) || !framed(420*12) )
		return;
	if (sortOff.max1 > 1.5 * 630) 
		return;
    //if ( sortOn.min1 * 3.6 < sortOff.min1 )
        //return;
	 //if ( sortOff.min1 * 2.5 < sortBurst.min1  || sortOff.min1 * 1.8 > sortBurst.max3)
        //return;
	cleanup();
	success = processHumaxAtoms(0, pFrame, pFrameEnd - pFrame);
	if (!success)
		return;
	float* pFrameEnd2 = pFrameEnd + 1;
	for ( ; pFrameEnd2 < pMainLimit; pFrameEnd2++ ) {
		if ( *pFrameEnd2 > 2000. ) break; // about 3 time the max duration
	};
	success = processHumaxAtoms(12, pFrameEnd + 1, pFrameEnd2 - pFrameEnd); //check for second signal
	setPreempt(prAsync	);  // avoid an Async decode
	makeMsb();
	if (success)  {
		T = getMsb(14,2) ^ getMsb(38,2);				// difference between the toggle values
		if	(( (M == 0) ^ (T == 0) )					// exactly one of M and T must be zero
			&&	getMsb(0,13) == getMsb(24,13)			// all bits other than toggle must be equal
			&&	getMsb(16,8) == getMsb(40,8) )
		{
			M = 1;										// next frame is valid repeat
			if ( FC == 0 ) setzContext();				// save the context value
			FC++;										// increment count of bypassed frames
			return;										// wait for repeat to come round
		}
	}
	strcpy(pProtocol,"Humax 4Phase"); 
    *pDevice = getMsb(2,6);
	*pSubDevice = getMsb(8,6);
	int tog = getMsb(14,2);
	sprintf(pMisc, "T=%d", tog);
	*pOBC = getMsb(16,7);
	nNote_out = 4;
	strcpy( pMisc, M == 0 ? (nNote_out = 1, nAuxNote_out = 1, "no start frame") : "");
	nFrameCount = FC;
	FC = 0;		// reset static variables
	M = 0;	
}

// Assembly:
cmpl $0x7, 0x48(%rdi)
jl 0xecdd
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movss 0x140(%rdi), %xmm0
ucomiss 0x3c63(%rip), %xmm0     # 0x126c0
jb 0xecd9
movss 0x190(%rbx), %xmm0
ucomiss 0x3c52(%rip), %xmm0     # 0x126c4
ja 0xecd9
xorps %xmm0, %xmm0
movups %xmm0, 0xa0(%rbx)
movq 0x38(%rbx), %rdx
movq 0x40(%rbx), %rcx
movq %rdx, 0xc8(%rbx)
movq $0x0, 0xc0(%rbx)
subq %rdx, %rcx
shrq $0x2, %rcx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x108bc
testb %al, %al
je 0xecd9
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rdx
movl $0x4, %esi
movss 0x3a82(%rip), %xmm0     # 0x1254c
movq %rsi, %rcx
addq %rdx, %rsi
cmpq %rax, %rsi
jae 0xeae2
movss (%rsi), %xmm1
leaq 0x4(%rcx), %rsi
ucomiss %xmm0, %xmm1
jbe 0xeaca
addq $0x4, %rdx
shrq $0x2, %rcx
movq %rbx, %rdi
movl $0xc, %esi
callq 0x108bc
movl 0x54(%rbx), %ecx
testl %ecx, %ecx
jle 0xeb0d
cmpl $0x1, %ecx
jne 0xeb1a
movl 0x48(%rbx), %ecx
cmpl 0x50(%rbx), %ecx
jg 0xeb10
jmp 0xeb1a
movl 0x48(%rbx), %ecx
movl $0x1, 0x54(%rbx)
movl %ecx, 0x50(%rbx)
movl 0xc0(%rbx), %ecx
addl $0x7, %ecx
sarl $0x3, %ecx
testl %ecx, %ecx
jle 0xeb88
movl %ecx, %ecx
movl $0x33000000, %edx       # imm = 0x33000000
movl $0x55000000, %esi       # imm = 0x55000000
movzbl 0x9f(%rbx,%rcx), %edi
bswapl %edi
movl %edi, %r8d
shll $0x4, %r8d
shrl $0x4, %edi
andl $0xf000000, %edi        # imm = 0xF000000
orl %r8d, %edi
movl %edi, %r8d
andl %edx, %r8d
shrl $0x2, %edi
andl %edx, %edi
leal (%rdi,%r8,4), %edi
movl %edi, %r8d
andl %esi, %r8d
shrl %edi
andl %esi, %edi
leal (%rdi,%r8,2), %edi
shrl $0x18, %edi
movb %dil, 0x9f(%rbx,%rcx)
leaq -0x1(%rcx), %rdi
cmpq $0x1, %rcx
movq %rdi, %rcx
ja 0xeb36
testb %al, %al
je 0xec06
movzbl 0xa1(%rbx), %eax
movzbl 0xa4(%rbx), %ecx
movl %ecx, %edx
xorl %eax, %edx
testb $0x3, %dl
setne %dl
cmpb %dl, 0x7762(%rip)       # 0x1630c
je 0xec06
movzbl 0xa0(%rbx), %edx
shll $0x5, %edx
shrl $0x3, %eax
orl %edx, %eax
movzbl 0xa3(%rbx), %edx
shll $0x5, %edx
shrl $0x3, %ecx
orl %edx, %ecx
cmpl %ecx, %eax
jne 0xec06
movb 0xa2(%rbx), %al
cmpb 0xa5(%rbx), %al
jne 0xec06
movb $0x1, 0x7729(%rip)      # 0x1630c
movl 0x7726(%rip), %r14d     # 0x16310
testl %r14d, %r14d
jne 0xebf7
movq %rbx, %rdi
callq 0x26e8
incl %r14d
movl %r14d, 0x770f(%rip)     # 0x16310
jmp 0xecd9
movq 0x148(%rbx), %rax
movabsq $0x65736168503420, %rcx # imm = 0x65736168503420
movq %rcx, 0x5(%rax)
movabsq $0x50342078616d7548, %rcx # imm = 0x50342078616D7548
movq %rcx, (%rax)
movzbl 0xa0(%rbx), %eax
andl $0x3f, %eax
movq 0x160(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa1(%rbx), %eax
shrl $0x2, %eax
movq 0x168(%rbx), %rcx
movl %eax, (%rcx)
movzbl 0xa1(%rbx), %edx
andl $0x3, %edx
movq 0x150(%rbx), %rdi
leaq 0x422b(%rip), %rsi      # 0x12e91
xorl %eax, %eax
callq 0x2060
movzbl 0xa2(%rbx), %eax
shrl %eax
movq 0x170(%rbx), %rcx
movl %eax, (%rcx)
movl $0x4, 0x88(%rbx)
movq 0x150(%rbx), %rdi
cmpb $0x0, 0x7675(%rip)      # 0x1630c
je 0xeca2
leaq 0x4465(%rip), %rsi      # 0x13105
jmp 0xecba
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x88(%rbx)
leaq 0x406d(%rip), %rsi      # 0x12d27
callq 0x2100
movl 0x764b(%rip), %eax      # 0x16310
movl %eax, 0x60(%rbx)
movl $0x0, 0x763e(%rip)      # 0x16310
movb $0x0, 0x7633(%rip)      # 0x1630c
popq %rbx
popq %r14
popq %rbp
retq