// File: /workspace/github_cpp_makefile_star2_O3/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 $0x138, %rsp            # imm = 0x138
movl %edx, 0x20(%rsp)
movss %xmm1, 0x4(%rsp)
movss %xmm0, 0x1c(%rsp)
movq %rsi, %rbx
movq %rdi, %rbp
callq 0xd770
leaq 0x10(%rbp), %rdi
leaq 0x10(%rbx), %rsi
movq %rdi, 0x28(%rsp)
callq 0xd4e0
movq 0x20(%rbx), %rax
movq %rax, 0x20(%rbp)
movaps 0x30(%rbx), %xmm0
movaps %xmm0, 0x30(%rbp)
movaps 0x40(%rbx), %xmm0
movaps %xmm0, 0x40(%rbp)
movq 0x50(%rbx), %rax
movq %rax, 0x50(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
movss 0x1c(%rsp), %xmm0
callq 0xd680
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rbp)
movb $0x1, 0x48(%rbp)
movq %rbp, %rdi
callq 0xd500
leaq 0xa0(%rsp), %rdi
movq %rbp, %rsi
callq 0xd0a0
movss 0x4(%rsp), %xmm0
mulss %xmm0, %xmm0
movss %xmm0, 0x4(%rsp)
leaq 0x40(%rbp), %rax
movq %rax, 0x30(%rsp)
leaq 0x50(%rsp), %r15
leaq 0xe0(%rsp), %r12
movq $0x0, 0x8(%rsp)
leaq 0xd0(%rsp), %rbx
movq %rbp, 0x10(%rsp)
movl 0x20(%rsp), %ecx
testl %ecx, %ecx
setle %al
movq 0xa0(%rsp), %r14
cmpl %ecx, 0x8(%rsp)
setl %cl
cmpq 0xa8(%rsp), %r14
je 0xfad9
orb %cl, %al
je 0xfad9
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0xd770
leaq 0x10(%r14), %rsi
movq %r15, %rdi
callq 0xd4e0
movq 0x20(%r14), %rax
movq %rax, 0x60(%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 0xa0(%rsp), %rdi
callq 0xd2f0
movss 0x80(%rsp), %xmm1
movss 0x4(%rsp), %xmm0
movss %xmm1, 0x24(%rsp)
ucomiss %xmm1, %xmm0
jae 0xfab4
cmpq $0x5, 0x48(%rsp)
jl 0xfab4
movl 0x8(%rsp), %eax
movq %rax, 0x38(%rsp)
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
callq 0xd770
movq %r12, %rdi
movq %r15, %rsi
callq 0xd4e0
movq 0x60(%rsp), %rax
movq %rax, 0xf0(%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), %rbp
callq 0xd420
movq %r12, %rdi
movl %r14d, %esi
callq 0xd6d0
leaq 0xc8(%rsp), %rdi
movq %rbx, %rsi
movss 0x1c(%rsp), %xmm0
callq 0xd680
movq 0xc8(%rsp), %rax
movq %rax, 0xf0(%rsp)
movb $0x1, 0x118(%rsp)
movq %rbx, %rdi
callq 0xd500
leaq 0xa0(%rsp), %rdi
movq %rbx, %rsi
callq 0xd0a0
movss 0x4(%rsp), %xmm0
ucomiss 0x110(%rsp), %xmm0
jae 0xf859
movl 0x20(%rsp), %r13d
testl %r13d, %r13d
setle %bpl
movq 0xe0(%rsp), %rdi
callq 0xd740
movq 0xd0(%rsp), %rdi
callq 0xd740
leaq 0x1(%r14), %rax
movq 0x38(%rsp), %rcx
addl %r14d, %ecx
incl %ecx
cmpl %r13d, %ecx
setl %cl
cmpq %rax, 0x48(%rsp)
jle 0xf848
orb %cl, %bpl
movq %rax, %r14
jne 0xf746
movq 0x8(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x8(%rsp)
jmp 0xf998
movq 0xd0(%rsp), %rbp
movq 0xd8(%rsp), %rsi
cmpq %rsi, 0x48(%rsp)
je 0xf884
movl $0x2, %edx
leaq 0x40(%rsp), %rdi
callq 0xd0b0
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rax
movq %rsi, %rcx
shrq $0x3f, %rcx
addq %rsi, %rcx
addq %rcx, %rcx
andq $-0x4, %rcx
cmpq $0x2, %rsi
jl 0xf8b4
xorl %edx, %edx
movaps (%rbp,%rdx,4), %xmm0
movaps %xmm0, (%rax,%rdx,4)
addq $0x4, %rdx
cmpq %rcx, %rdx
jl 0xf8a2
addq %rsi, %rsi
cmpq %rsi, %rcx
jge 0xf8cf
movss (%rbp,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rsi
jne 0xf8bc
movq 0xe0(%rsp), %rbp
movq 0xe8(%rsp), %rsi
cmpq %rsi, 0x58(%rsp)
je 0xf8f8
movl $0x1, %edx
movq %r15, %rdi
callq 0xdbd0
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rax
leaq 0x3(%rsi), %rcx
testq %rsi, %rsi
cmovnsq %rsi, %rcx
andq $-0x4, %rcx
cmpq $0x4, %rsi
jl 0xf926
xorl %edx, %edx
movaps (%rbp,%rdx,4), %xmm0
movaps %xmm0, (%rax,%rdx,4)
addq $0x4, %rdx
cmpq %rcx, %rdx
jl 0xf914
cmpq %rsi, %rcx
jge 0xf93e
movss (%rbp,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rsi
jne 0xf92b
movq 0x38(%rsp), %r13
addq %r14, %r13
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movaps 0x100(%rsp), %xmm0
movaps %xmm0, 0x70(%rsp)
movq 0x40(%r12), %rax
movq %rax, 0x40(%r15)
movaps 0x30(%r12), %xmm0
movaps %xmm0, 0x30(%r15)
movq 0xe0(%rsp), %rdi
callq 0xd740
movq 0xd0(%rsp), %rdi
callq 0xd740
movl %r13d, %eax
movq %rax, 0x8(%rsp)
movss 0x80(%rsp), %xmm0
movq 0x30(%rsp), %rax
ucomiss (%rax), %xmm0
movq 0x10(%rsp), %rbp
jae 0xfab4
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %rsi
cmpq %rsi, 0x8(%rbp)
je 0xf9d5
movl $0x2, %edx
movq %rbp, %rdi
callq 0xd0b0
movq 0x8(%rbp), %rsi
movq (%rbp), %rax
movq %rsi, %rcx
shrq $0x3f, %rcx
addq %rsi, %rcx
addq %rcx, %rcx
andq $-0x4, %rcx
cmpq $0x2, %rsi
jl 0xfa04
xorl %edx, %edx
movaps (%r14,%rdx,4), %xmm0
movaps %xmm0, (%rax,%rdx,4)
addq $0x4, %rdx
cmpq %rcx, %rdx
jl 0xf9f2
addq %rsi, %rsi
cmpq %rsi, %rcx
jge 0xfa1f
movss (%r14,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rsi
jne 0xfa0c
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %rsi
cmpq %rsi, 0x18(%rbp)
je 0xfa42
movl $0x1, %edx
movq 0x28(%rsp), %rdi
callq 0xdbd0
movq 0x18(%rbp), %rsi
movq 0x28(%rsp), %rax
movq (%rax), %rax
leaq 0x3(%rsi), %rcx
testq %rsi, %rsi
cmovnsq %rsi, %rcx
andq $-0x4, %rcx
cmpq $0x4, %rsi
jl 0xfa73
xorl %edx, %edx
movaps (%r14,%rdx,4), %xmm0
movaps %xmm0, (%rax,%rdx,4)
addq $0x4, %rdx
cmpq %rcx, %rdx
jl 0xfa61
cmpq %rsi, %rcx
jge 0xfa8b
movss (%r14,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rsi
jne 0xfa78
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x20(%rbp)
movaps 0x70(%rsp), %xmm0
movaps %xmm0, 0x30(%rbp)
movq 0x40(%r15), %rax
movq 0x30(%rsp), %rcx
movq %rax, 0x10(%rcx)
movaps 0x30(%r15), %xmm0
movaps %xmm0, (%rcx)
movq 0x50(%rsp), %rdi
callq 0xd740
movq 0x40(%rsp), %rdi
callq 0xd740
movss 0x24(%rsp), %xmm0
ucomiss 0x4(%rsp), %xmm0
ja 0xf697
movaps 0x30(%rbp), %xmm0
movups 0x34(%rbp), %xmm1
movsd 0x20(%rbp), %xmm2
movss 0x38(%rbp), %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(%rbp), %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(%rbp)
leaq 0xa0(%rsp), %rdi
callq 0xdb90
movq %rbp, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rbp), %rdi
callq 0xd740
jmp 0xfbb5
jmp 0xfb49
movq %rax, %rbx
movq 0x10(%rsp), %rbp
jmp 0xfb72
movq %rax, %rbx
jmp 0xfb96
movq %rax, %rbx
jmp 0xfba0
movq %rax, %rbx
jmp 0xfb8c
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
callq 0xd740
jmp 0xfb68
movq %rax, %rbx
movq 0x10(%rsp), %rbp
jmp 0xfb8c
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
callq 0xd740
movq 0xd0(%rsp), %rdi
callq 0xd740
movq 0x50(%rsp), %rdi
callq 0xd740
movq 0x40(%rsp), %rdi
callq 0xd740
leaq 0xa0(%rsp), %rdi
callq 0xdb90
movq %rbp, %rdi
callq 0xda50
movq %rbx, %rdi
callq 0xdb20
nop