// File: /workspace/github_cpp_makefile_star2_O2/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 0x6151
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movss (%rax), %xmm1
addss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm2
cvtss2sd 0x1e0(%rdi), %xmm0
movsd 0xb092(%rip), %xmm3     # 0x111c0
mulsd %xmm0, %xmm3
ucomisd %xmm2, %xmm3
ja 0x6149
movss 0x1dc(%rbx), %xmm2
movq 0x40(%rbx), %rcx
ucomiss (%rcx), %xmm2
jbe 0x6152
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movss 0x98(%rbx), %xmm2
subss %xmm1, %xmm2
cvtss2sd %xmm2, %xmm1
movsd 0xb05e(%rip), %xmm2     # 0x111c8
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
ja 0x6149
mulsd 0xb054(%rip), %xmm0     # 0x111d0
ucomisd %xmm1, %xmm0
ja 0x6149
andw $0x0, 0xa0(%rbx)
addq $0x8, %rax
movq %rax, 0xc8(%rbx)
andl $0x0, 0xc0(%rbx)
xorl %esi, %esi
movsd 0xb01a(%rip), %xmm0     # 0x111c0
pushq $0x1
popq %rdx
movsd 0xb02f(%rip), %xmm1     # 0x111e0
movsd 0xb02f(%rip), %xmm2     # 0x111e8
movsd 0xaf0f(%rip), %xmm3     # 0x110d0
movss (%rax), %xmm7
movss 0x4(%rax), %xmm8
movaps %xmm7, %xmm5
addss %xmm8, %xmm5
cvtss2sd %xmm5, %xmm9
mulsd %xmm0, %xmm9
movss 0x1e0(%rbx), %xmm6
cvtss2sd %xmm6, %xmm4
ucomisd %xmm4, %xmm9
jbe 0x6206
addq $0x4, %rax
cmpq 0x40(%rbx), %rax
jae 0x62a8
ucomiss %xmm8, %xmm7
ja 0x6264
jmp 0x627a
leaq 0x8(%rax), %rcx
movq %rcx, 0xc8(%rbx)
addss 0x8(%rax), %xmm5
addq $0xc, %rax
cmpq 0x40(%rbx), %rax
jae 0x62c5
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 0x6149
ucomisd %xmm4, %xmm7
ja 0x6149
mulsd %xmm3, %xmm5
cvtss2sd %xmm6, %xmm4
ucomisd %xmm5, %xmm4
ja 0x6149
movl %esi, %ecx
andb $0x7, %cl
movl %edx, %eax
shll %cl, %eax
sarl $0x3, %esi
movslq %esi, %rcx
orb %al, 0xa0(%rbx,%rcx)
movq 0xc8(%rbx), %rax
addq $0x8, %rax
movq %rax, 0xc8(%rbx)
movl 0xc0(%rbx), %esi
incl %esi
movl %esi, 0xc0(%rbx)
cmpl $0x9, %esi
jne 0x61c1
jmp 0x6149
cmpl $0x8, %esi
jne 0x6149
cvtss2sd %xmm7, %xmm0
mulsd 0xaf1b(%rip), %xmm0     # 0x111d8
ucomisd %xmm4, %xmm0
ja 0x62ed
jmp 0x62f4
cmpl $0x8, %esi
jne 0x6149
cvtss2sd %xmm5, %xmm0
mulsd 0xaefe(%rip), %xmm0     # 0x111d8
ucomisd %xmm0, %xmm4
ja 0x6149
ucomiss %xmm6, %xmm5
ja 0x6149
orb $0x1, 0xa1(%rbx)
movzbl 0xa0(%rbx), %r15d
movl %r15d, %r14d
shrl $0x2, %r14d
andl $0x7, %r14d
leal (%r14,%r15,4), %r12d
addl $0x3, %r12d
andl $0xf, %r12d
pushq $0x5
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0xebd6
cmpl %eax, %r12d
jne 0x6149
andl $0x3, %r15d
movq 0x148(%rbx), %rax
movw $0x79, 0x4(%rax)
movl $0x666d6f53, (%rax)     # imm = 0x666D6F53
movq 0x170(%rbx), %rax
movl %r15d, (%rax)
movq 0x160(%rbx), %rax
movl %r14d, (%rax)
jmp 0x6149