// File: /workspace/github_cpp_makefile_star2_O1/schuyler[P]quickfix/include/quickfix/fix.h
// Function: Beacon<float, 2> Beacon<float, 2>::Fix<Beacon<float, 2>::DifferenceSolver>(float, float, int) const
Beacon<F, D> Beacon<F, D>::Fix(F time, F rmsError, int maxTries) const {
    F mseTarget = rmsError * rmsError;
    Beacon best = *this;
    Heap heap;
    int tries;

    best.estimatePosition<Solver>(time);
    heap.push(best);

    for (tries = 0; !heap.empty() && (maxTries <= 0 || tries < maxTries);) {
        Beacon b = heap.top();
        //qfdebug("Fix: " << b.A.rows() << ": " << b.X << " (" << b.Err << ")");
        heap.pop();
        if (b.Err <= mseTarget) break;
        if (b.A.rows() <= D + 2) continue;

        for (int drop = 0; drop < b.A.rows() && (maxTries <= 0 || tries < maxTries); drop++, tries++) {
            Beacon next = b;
            dropRow<Anchors>(next.A, drop);
            dropRow<Ranges>(next.R, drop);
            next.estimatePosition<Solver>(time);
            heap.push(next);
            if (next.Err <= mseTarget) {
                b = next;
                break;
            }
        }
        if (b < best) best = b;
    }
    qfdebug("Fix took " << tries << " of " <<  maxTries << " tries using " << best.A.rows() << " of " <<  A.rows() << " anchors");
    best.clipToBound();
    return best;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %edx, %ebp
movss %xmm1, 0x4(%rsp)
movss %xmm0, 0x18(%rsp)
movq %rsi, %rbx
movq %rdi, %r13
callq 0xd770
leaq 0x10(%r13), %rdi
leaq 0x10(%rbx), %rsi
movq %rdi, 0xb0(%rsp)
callq 0xd4e0
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r13)
movaps 0x30(%rbx), %xmm0
movaps %xmm0, 0x30(%r13)
movaps 0x40(%rbx), %xmm0
movaps %xmm0, 0x40(%r13)
movq 0x50(%rbx), %rax
movq %rax, 0x50(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movss 0x18(%rsp), %xmm0
callq 0xd680
movq 0x30(%rsp), %rax
movq %rax, 0x20(%r13)
movb $0x1, 0x48(%r13)
movq %r13, %rdi
callq 0xd500
leaq 0x90(%rsp), %rdi
movq %r13, %rsi
callq 0xd0a0
movss 0x4(%rsp), %xmm0
mulss %xmm0, %xmm0
movss %xmm0, 0x4(%rsp)
leaq 0x40(%r13), %rax
movq %rax, 0x20(%rsp)
leaq 0x40(%rsp), %r15
leaq 0xd0(%rsp), %r12
movq $0x0, 0x8(%rsp)
leaq 0xc0(%rsp), %rbx
movq %r13, 0x10(%rsp)
testl %ebp, %ebp
setle %al
movq 0x90(%rsp), %r14
cmpl %ebp, 0x8(%rsp)
setl %cl
cmpq 0x98(%rsp), %r14
je 0xfb21
orb %cl, %al
je 0xfb21
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0xd770
leaq 0x10(%r14), %rsi
movq %r15, %rdi
callq 0xd4e0
movq 0x20(%r14), %rax
movq %rax, 0x50(%rsp)
movaps 0x30(%r14), %xmm0
movaps %xmm0, 0x20(%r15)
movq 0x50(%r14), %rax
movq %rax, 0x40(%r15)
movaps 0x40(%r14), %xmm0
movaps %xmm0, 0x30(%r15)
leaq 0x90(%rsp), %rdi
callq 0xd2f0
movss 0x70(%rsp), %xmm1
movss 0x4(%rsp), %xmm0
movss %xmm1, 0x1c(%rsp)
ucomiss %xmm1, %xmm0
jae 0xfafc
cmpq $0x5, 0x38(%rsp)
jl 0xfafc
testl %ebp, %ebp
setle %al
cmpl %ebp, 0x8(%rsp)
setl %cl
cmpq $0x0, 0x38(%rsp)
jle 0xf9e7
orb %cl, %al
je 0xf9e7
movl 0x8(%rsp), %eax
movq %rax, 0x28(%rsp)
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0xd770
movq %r12, %rdi
movq %r15, %rsi
callq 0xd4e0
movq 0x50(%rsp), %rax
movq %rax, 0xe0(%rsp)
movaps 0x20(%r15), %xmm0
movaps %xmm0, 0x20(%r12)
movq 0x40(%r15), %rax
movq %rax, 0x40(%r12)
movaps 0x30(%r15), %xmm0
movaps %xmm0, 0x30(%r12)
movq %rbx, %rdi
movl %r14d, %esi
movq 0x10(%rsp), %r13
callq 0xd420
movq %r12, %rdi
movl %r14d, %esi
callq 0xd6d0
leaq 0xb8(%rsp), %rdi
movq %rbx, %rsi
movss 0x18(%rsp), %xmm0
callq 0xd680
movq 0xb8(%rsp), %rax
movq %rax, 0xe0(%rsp)
movb $0x1, 0x108(%rsp)
movq %rbx, %rdi
callq 0xd500
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0xd0a0
movss 0x4(%rsp), %xmm0
ucomiss 0x100(%rsp), %xmm0
jae 0xf89f
testl %ebp, %ebp
setle %r13b
movq 0xd0(%rsp), %rdi
callq 0xd740
movq 0xc0(%rsp), %rdi
callq 0xd740
leaq 0x1(%r14), %rax
movq 0x28(%rsp), %rcx
addl %r14d, %ecx
incl %ecx
cmpl %ebp, %ecx
setl %cl
cmpq %rax, 0x38(%rsp)
jle 0xf88e
orb %cl, %r13b
movq %rax, %r14
jne 0xf793
movq 0x8(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x8(%rsp)
jmp 0xf9e2
movq 0xc0(%rsp), %r13
movq 0xc8(%rsp), %rsi
cmpq %rsi, 0x38(%rsp)
je 0xf8c5
movl $0x2, %edx
leaq 0x30(%rsp), %rdi
callq 0xd0b0
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
movq %rcx, %rdx
shrq $0x3f, %rdx
addq %rcx, %rdx
addq %rdx, %rdx
andq $-0x4, %rdx
cmpq $0x2, %rcx
jl 0xf8fb
xorl %esi, %esi
movaps (%r13,%rsi,4), %xmm0
movaps %xmm0, (%rax,%rsi,4)
addq $0x4, %rsi
cmpq %rdx, %rsi
jl 0xf8e8
addq %rcx, %rcx
cmpq %rcx, %rdx
jge 0xf917
movss (%r13,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0xf903
movq 0xd0(%rsp), %r13
movq 0xd8(%rsp), %rsi
cmpq %rsi, 0x48(%rsp)
je 0xf93b
movl $0x1, %edx
movq %r15, %rdi
callq 0xdc00
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
leaq 0x3(%rcx), %rdx
testq %rcx, %rcx
cmovnsq %rcx, %rdx
andq $-0x4, %rdx
cmpq $0x4, %rcx
jl 0xf96f
xorl %esi, %esi
movaps (%r13,%rsi,4), %xmm0
movaps %xmm0, (%rax,%rsi,4)
addq $0x4, %rsi
cmpq %rdx, %rsi
jl 0xf95c
cmpq %rcx, %rdx
jge 0xf988
movss (%r13,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0xf974
movq 0x28(%rsp), %r13
addq %r14, %r13
movsd 0xe0(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movaps 0xf0(%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x40(%r12), %rax
movq %rax, 0x40(%r15)
movaps 0x30(%r12), %xmm0
movaps %xmm0, 0x30(%r15)
movq 0xd0(%rsp), %rdi
callq 0xd740
movq 0xc0(%rsp), %rdi
callq 0xd740
movl %r13d, %eax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %r13
movss 0x70(%rsp), %xmm0
movq 0x20(%rsp), %rax
ucomiss (%rax), %xmm0
jae 0xfafc
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %rsi
cmpq %rsi, 0x8(%r13)
je 0xfa18
movl $0x2, %edx
movq %r13, %rdi
callq 0xd0b0
movq (%r13), %rax
movq 0x8(%r13), %rcx
movq %rcx, %rdx
shrq $0x3f, %rdx
addq %rcx, %rdx
addq %rdx, %rdx
andq $-0x4, %rdx
cmpq $0x2, %rcx
jl 0xfa4b
xorl %esi, %esi
movaps (%r14,%rsi,4), %xmm0
movaps %xmm0, (%rax,%rsi,4)
addq $0x4, %rsi
cmpq %rdx, %rsi
jl 0xfa39
addq %rcx, %rcx
cmpq %rcx, %rdx
jge 0xfa66
movss (%r14,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0xfa53
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %rsi
cmpq %rsi, 0x18(%r13)
je 0xfa88
movl $0x1, %edx
movq 0xb0(%rsp), %rdi
callq 0xdc00
movq 0x10(%r13), %rax
movq 0x18(%r13), %rcx
leaq 0x3(%rcx), %rdx
testq %rcx, %rcx
cmovnsq %rcx, %rdx
andq $-0x4, %rdx
cmpq $0x4, %rcx
jl 0xfab9
xorl %esi, %esi
movaps (%r14,%rsi,4), %xmm0
movaps %xmm0, (%rax,%rsi,4)
addq $0x4, %rsi
cmpq %rdx, %rsi
jl 0xfaa7
cmpq %rcx, %rdx
jge 0xfad1
movss (%r14,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0xfabe
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x20(%r13)
movaps 0x60(%rsp), %xmm0
movaps %xmm0, 0x30(%r13)
movq 0x40(%r15), %rax
movq 0x20(%rsp), %rcx
movq %rax, 0x10(%rcx)
movaps 0x30(%r15), %xmm0
movaps %xmm0, (%rcx)
movq 0x40(%rsp), %rdi
callq 0xd740
movq 0x30(%rsp), %rdi
callq 0xd740
movss 0x1c(%rsp), %xmm0
ucomiss 0x4(%rsp), %xmm0
ja 0xf6cb
movaps 0x30(%r13), %xmm0
movups 0x34(%r13), %xmm1
movsd 0x20(%r13), %xmm2
movss 0x38(%r13), %xmm3
movlhps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm3     # xmm3 = xmm3[2,0],xmm0[2,3]
maxps %xmm2, %xmm3
movss 0x3c(%r13), %xmm0
movlhps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
shufps $0xe2, %xmm1, %xmm0     # xmm0 = xmm0[2,0],xmm1[2,3]
minps %xmm3, %xmm0
movlps %xmm0, 0x20(%r13)
leaq 0x90(%rsp), %rdi
callq 0xdbc0
movq %r13, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%r13), %rdi
callq 0xd740
jmp 0xfc03
movq %rax, %rbx
movq 0x10(%rsp), %r13
jmp 0xfbc0
jmp 0xfb97
movq %rax, %rbx
jmp 0xfbe4
movq %rax, %rbx
jmp 0xfbee
movq %rax, %rbx
jmp 0xfbda
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
callq 0xd740
jmp 0xfbb6
movq %rax, %rbx
movq 0x10(%rsp), %r13
jmp 0xfbda
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
callq 0xd740
movq 0xc0(%rsp), %rdi
callq 0xd740
movq 0x40(%rsp), %rdi
callq 0xd740
movq 0x30(%rsp), %rdi
callq 0xd740
leaq 0x90(%rsp), %rdi
callq 0xdbc0
movq %r13, %rdi
callq 0xda60
movq %rbx, %rdi
callq 0xdb50
nop