// File: /workspace/github_cpp_makefile_star2_O3/probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::trySomfy()
void Signal::trySomfy()
{
    if (   nFrameL < 10
        || nFrameL > 19 )
    {
        return;
    }
    float firstBurst = pFrame[0] + pFrame[1];
    if (   firstBurst < 1.6 * sortBurst.max2
        || sortBurst.max1 > pFrameEnd[0] )
    {
        return;
    }
    float bitTotal = nTotDur - firstBurst;
    if ( bitTotal > 8.7 * sortBurst.max2 )
        return;
    if ( bitTotal < 7. * sortBurst.max2 )
        return;
    cBits[0] = cBits[1] = 0;
	pBit = pFrame+2;
	nBit = 0;
    for (;;)
    {
        float burst = pBit[0] + pBit[1];
        if ( burst * 1.6 > sortBurst.max2 )
        {
            if ( pBit+1 >= pFrameEnd )
            {
                if ( nBit != 8 )
                    return;
                if ( pBit[0] * 2.1 > sortBurst.max2 )
    			    cBits[nBit>>3] |= 1 << (nBit & 7);
                break;
            }
            if ( pBit[0] > pBit[1] )
    			cBits[nBit>>3] |= 1 << (nBit & 7);
            pBit += 2;
        }
        else
        {
            pBit += 2;
            burst += pBit[0];
            if ( pBit+1 >= pFrameEnd )
            {
                if ( nBit != 8 )
                    return;
                if ( burst *2.1 < sortBurst.max2 )
                    return;
                if ( burst > sortBurst.max2 )
                    return;
  			    cBits[nBit>>3] |= 1 << (nBit & 7);
                break;
            }
            burst += pBit[1];
            if (   burst *1.3 < sortBurst.max2
                || burst *.8 > sortBurst.max2
                || burst *.5 < pBit[1] )
            {
                return;
            }
    		cBits[nBit>>3] |= 1 << (nBit & 7);
            pBit += 2;
        }
        if ( ++nBit == 9 )
        {
            return;
        }
    }
    int cmd = getLsb(0,2);
    int dev = getLsb(2,3);
    if ( ( (cmd*4+dev+3) & 15 ) == getLsb(5,4) )
    {
	    strcpy(pProtocol, "Somfy");
	    *pOBC = cmd;
        *pDevice = dev;
    }

}

// Assembly:
movl 0x48(%rdi), %eax
addl $-0x14, %eax
cmpl $-0xa, %eax
jb 0x6682
pushq %rbp
movq %rsp, %rbp
movq 0x38(%rdi), %rax
movss (%rax), %xmm1
addss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm2
cvtss2sd 0x1e0(%rdi), %xmm0
movsd 0xbb5a(%rip), %xmm3     # 0x121c0
mulsd %xmm0, %xmm3
ucomisd %xmm2, %xmm3
ja 0x6681
movss 0x1dc(%rdi), %xmm2
movq 0x40(%rdi), %rcx
ucomiss (%rcx), %xmm2
jbe 0x6683
popq %rbp
retq
movss 0x98(%rdi), %xmm2
subss %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
movsd 0xbb2a(%rip), %xmm2     # 0x121c8
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
ja 0x6681
mulsd 0xbb20(%rip), %xmm0     # 0x121d0
ucomisd %xmm1, %xmm0
ja 0x6681
movw $0x0, 0xa0(%rdi)
addq $0x8, %rax
movq %rax, 0xc8(%rdi)
movl $0x0, 0xc0(%rdi)
xorl %edx, %edx
movsd 0xbae2(%rip), %xmm0     # 0x121c0
movsd 0xbafa(%rip), %xmm1     # 0x121e0
movsd 0xbafa(%rip), %xmm2     # 0x121e8
movsd 0xb9da(%rip), %xmm3     # 0x120d0
movss (%rax), %xmm7
movss 0x4(%rax), %xmm8
movaps %xmm7, %xmm5
addss %xmm8, %xmm5
xorps %xmm9, %xmm9
cvtss2sd %xmm5, %xmm9
mulsd %xmm0, %xmm9
movss 0x1e0(%rdi), %xmm6
xorps %xmm4, %xmm4
cvtss2sd %xmm6, %xmm4
ucomisd %xmm4, %xmm9
jbe 0x6742
addq $0x4, %rax
cmpq 0x40(%rdi), %rax
jae 0x67ea
ucomiss %xmm8, %xmm7
ja 0x67a3
jmp 0x67bc
leaq 0x8(%rax), %rcx
movq %rcx, 0xc8(%rdi)
addss 0x8(%rax), %xmm5
addq $0xc, %rax
cmpq 0x40(%rdi), %rax
jae 0x6810
movss (%rax), %xmm6
addss %xmm6, %xmm5
cvtss2sd %xmm5, %xmm5
movaps %xmm5, %xmm7
mulsd %xmm1, %xmm7
ucomisd %xmm7, %xmm4
movaps %xmm5, %xmm7
mulsd %xmm2, %xmm7
ja 0x6681
ucomisd %xmm4, %xmm7
ja 0x6681
mulsd %xmm3, %xmm5
xorps %xmm4, %xmm4
cvtss2sd %xmm6, %xmm4
ucomisd %xmm5, %xmm4
ja 0x6681
movl %edx, %ecx
andb $0x7, %cl
movl $0x1, %eax
shll %cl, %eax
sarl $0x3, %edx
movslq %edx, %rcx
orb %al, 0xa0(%rdi,%rcx)
movq 0xc8(%rdi), %rax
addq $0x8, %rax
movq %rax, 0xc8(%rdi)
movl 0xc0(%rdi), %edx
incl %edx
movl %edx, 0xc0(%rdi)
cmpl $0x9, %edx
jne 0x66f6
jmp 0x6681
cmpl $0x8, %edx
jne 0x6681
xorps %xmm0, %xmm0
cvtss2sd %xmm7, %xmm0
mulsd 0xb9d6(%rip), %xmm0     # 0x121d8
ucomisd %xmm4, %xmm0
movb 0xa1(%rdi), %al
ja 0x6841
jmp 0x6849
cmpl $0x8, %edx
jne 0x6681
xorps %xmm0, %xmm0
cvtss2sd %xmm5, %xmm0
mulsd 0xb9b0(%rip), %xmm0     # 0x121d8
ucomisd %xmm0, %xmm4
ja 0x6681
ucomiss %xmm6, %xmm5
ja 0x6681
movb 0xa1(%rdi), %al
orb $0x1, %al
movb %al, 0xa1(%rdi)
movzbl 0xa0(%rdi), %edx
movl %edx, %ecx
shrl $0x2, %ecx
andl $0x7, %ecx
leal (%rcx,%rdx,4), %esi
addl $0x3, %esi
andl $0xf, %esi
movl %edx, %r8d
shrl $0x5, %r8d
andb $0x1, %al
movzbl %al, %eax
leal (%r8,%rax,8), %eax
cmpl %eax, %esi
jne 0x6681
andl $0x3, %edx
movq 0x148(%rdi), %rax
movw $0x79, 0x4(%rax)
movl $0x666d6f53, (%rax)     # imm = 0x666D6F53
movq 0x170(%rdi), %rax
movl %edx, (%rax)
movq 0x160(%rdi), %rax
movl %ecx, (%rax)
jmp 0x6681