// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpl $0x7, 0x48(%rax)
jl 0x143b0
movq -0x28(%rbp), %rdi
movss 0x5e06(%rip), %xmm0     # 0x1a1ac
callq 0x18840
cmpl $0x0, %eax
jne 0x143b5
jmp 0x146bc
movq -0x28(%rbp), %rax
movss 0x190(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x634b(%rip), %xmm1     # 0x1a718
ucomisd %xmm1, %xmm0
jbe 0x143d8
jmp 0x146bc
movq -0x28(%rbp), %rdi
callq 0x16180
movq -0x28(%rbp), %rdi
movq 0x38(%rdi), %rdx
movq 0x40(%rdi), %rax
movq 0x38(%rdi), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, %ecx
xorl %esi, %esi
callq 0x17470
andb $0x1, %al
movb %al, -0xd(%rbp)
testb $0x1, -0xd(%rbp)
jne 0x14411
jmp 0x146bc
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
cmpq 0x10(%rcx), %rax
jae 0x1445b
movq -0x18(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x5e9d(%rip), %xmm1     # 0x1a2e0
ucomisd %xmm1, %xmm0
jbe 0x1444b
jmp 0x1445b
jmp 0x1444d
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
jmp 0x14421
movq -0x28(%rbp), %rdi
movq 0x40(%rdi), %rdx
addq $0x4, %rdx
movq -0x18(%rbp), %rax
movq 0x40(%rdi), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, %ecx
movl $0xc, %esi
callq 0x17470
movq -0x28(%rbp), %rdi
andb $0x1, %al
movb %al, -0xd(%rbp)
movl $0x1, %esi
callq 0x2810
movq -0x28(%rbp), %rdi
callq 0x16110
testb $0x1, -0xd(%rbp)
je 0x14595
movq -0x28(%rbp), %rdi
movl $0xe, %esi
movl $0x2, %edx
callq 0x15f50
movq -0x28(%rbp), %rdi
movl %eax, -0x2c(%rbp)
movl $0x26, %esi
movl $0x2, %edx
callq 0x15f50
movl %eax, %ecx
movl -0x2c(%rbp), %eax
xorl %ecx, %eax
movl %eax, -0xc(%rbp)
cmpl $0x0, 0xae2e(%rip)      # 0x1f310
sete %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, -0xc(%rbp)
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
xorl %ecx, %eax
cmpl $0x0, %eax
je 0x14593
movq -0x28(%rbp), %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0x15f50
movq -0x28(%rbp), %rdi
movl %eax, -0x30(%rbp)
movl $0x18, %esi
movl $0xd, %edx
callq 0x15f50
movl %eax, %ecx
movl -0x30(%rbp), %eax
cmpl %ecx, %eax
jne 0x14593
movq -0x28(%rbp), %rdi
movl $0x10, %esi
movl $0x8, %edx
callq 0x15f50
movq -0x28(%rbp), %rdi
movl %eax, -0x34(%rbp)
movl $0x28, %esi
movl $0x8, %edx
callq 0x15f50
movl %eax, %ecx
movl -0x34(%rbp), %eax
cmpl %ecx, %eax
jne 0x14593
movl $0x1, 0xada3(%rip)      # 0x1f310
cmpl $0x0, 0xada0(%rip)      # 0x1f314
jne 0x1457f
movq -0x28(%rbp), %rdi
callq 0x2860
movl 0xad8f(%rip), %eax      # 0x1f314
addl $0x1, %eax
movl %eax, 0xad86(%rip)      # 0x1f314
jmp 0x146bc
jmp 0x14595
movq -0x28(%rbp), %rax
movq 0x148(%rax), %rdi
leaq 0x6a1f(%rip), %rsi      # 0x1afc6
callq 0x2120
movq -0x28(%rbp), %rdi
movl $0x2, %esi
movl $0x6, %edx
callq 0x15f50
movq -0x28(%rbp), %rdi
movl %eax, %ecx
movq 0x160(%rdi), %rax
movl %ecx, (%rax)
movl $0x8, %esi
movl $0x6, %edx
callq 0x15f50
movq -0x28(%rbp), %rdi
movl %eax, %ecx
movq 0x168(%rdi), %rax
movl %ecx, (%rax)
movl $0xe, %esi
movl $0x2, %edx
callq 0x15f50
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, -0x1c(%rbp)
movq 0x150(%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x6997(%rip), %rsi      # 0x1afac
movb $0x0, %al
callq 0x2060
movq -0x28(%rbp), %rdi
movl $0x10, %esi
movl $0x7, %edx
callq 0x15f50
movl %eax, %edx
movq -0x28(%rbp), %rax
movq 0x170(%rax), %rcx
movl %edx, (%rcx)
movl $0x4, 0x88(%rax)
movq 0x150(%rax), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, 0xacb6(%rip)      # 0x1f310
jne 0x14681
movq -0x28(%rbp), %rax
movl $0x1, 0x88(%rax)
movl $0x1, 0x8c(%rax)
leaq 0x67b7(%rip), %rax      # 0x1ae32
movq %rax, -0x48(%rbp)
jmp 0x1468e
leaq 0x6bab(%rip), %rax      # 0x1b233
movq %rax, -0x48(%rbp)
jmp 0x1468e
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x2120
movq -0x28(%rbp), %rax
movl 0xac6f(%rip), %ecx      # 0x1f314
movl %ecx, 0x60(%rax)
movl $0x0, 0xac62(%rip)      # 0x1f314
movl $0x0, 0xac54(%rip)      # 0x1f310
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)