// File: probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::processManchesterAtoms(int, int, float, float, float*)
bool Signal::processManchesterAtoms(int burstStart, int numBits, float used, float bitDur, float* pFr)   
{
	int i;
	float delta = 0.1 * bitDur;
	float edge;
	float first[2];
	first[0] = 0.5 * bitDur; first[1] = bitDur; 
	int burstIdx = burstStart;
	int burstMax = pFrameEnd - pFr;
	int bitIdx = 0;
	int (*_abs)( int ) = & std::abs;
	do {	
		for (i=0; i<1; i++) { 
			edge = first[i]; 
			if (_abs(pFr[burstIdx]- used - edge) < delta) { 
				cBits[bitIdx >> 3] |= (burstIdx&1) << (7 - bitIdx&7);
				burstIdx++;
				if (_abs(pFr[burstIdx] - (bitDur - edge)) < delta) {
					used = 0.0;
					burstIdx++;
				}
				else
					used = bitDur - edge;
				break;
			}
			else  
				 return false;
		}
		if (i > 1 || burstIdx > burstMax) 
			return false;  //arrive here if no match found
		bitIdx++;
		if (bitIdx >= sizeof(cBits)*8) 
			return false;  //not enough room in cBits
	} while (bitIdx < numBits);
	pBit = pFr + burstIdx;
	nBit = bitIdx;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movss %xmm1, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movss -0x20(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x331f(%rip), %xmm0     # 0x1a5c8
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x30(%rbp)
movss -0x20(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x2ef9(%rip), %xmm0     # 0x1a1c0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movl -0x14(%rbp), %ecx
movl %ecx, -0x40(%rbp)
movq 0x40(%rax), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq 0x7cac(%rip), %rax      # 0x1efb0
movq %rax, -0x50(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x1, -0x2c(%rbp)
jge 0x173f2
movslq -0x2c(%rbp), %rax
movss -0x3c(%rbp,%rax,4), %xmm0
movss %xmm0, -0x34(%rbp)
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm0
subss -0x1c(%rbp), %xmm0
subss -0x34(%rbp), %xmm0
cvttss2si %xmm0, %edi
callq *%rax
cvtsi2ss %eax, %xmm1
movss -0x30(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x173ec
movq -0x58(%rbp), %rax
movl -0x40(%rbp), %esi
andl $0x1, %esi
movl $0x7, %ecx
subl -0x48(%rbp), %ecx
andl $0x7, %ecx
shll %cl, %esi
movl -0x48(%rbp), %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl 0xa0(%rax,%rcx), %edx
orl %esi, %edx
movb %dl, 0xa0(%rax,%rcx)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm0
movss -0x20(%rbp), %xmm1
subss -0x34(%rbp), %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %edi
callq *%rax
cvtsi2ss %eax, %xmm1
movss -0x30(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x173db
xorps %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x173ea
movss -0x20(%rbp), %xmm0
subss -0x34(%rbp), %xmm0
movss %xmm0, -0x1c(%rbp)
jmp 0x173f2
movb $0x0, -0x1(%rbp)
jmp 0x17456
cmpl $0x1, -0x2c(%rbp)
jg 0x17400
movl -0x40(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0x17406
movb $0x0, -0x1(%rbp)
jmp 0x17456
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movslq -0x48(%rbp), %rax
cmpq $0x80, %rax
jb 0x17421
movb $0x0, -0x1(%rbp)
jmp 0x17456
jmp 0x17423
movl -0x48(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x17308
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x40(%rbp), %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, 0xc8(%rax)
movl -0x48(%rbp), %ecx
movl %ecx, 0xc0(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)