// File: schuyler[P]quickfix/include/quickfix/difference.h
// Function: Beacon<float, 2>::DifferenceSolver::setCoefficients()
void Beacon<F, D>::DifferenceSolver::setCoefficients() {
    int n = B.A.rows();

    Matrix<F, Dynamic, 1> K(n, 1);
    K = B.A.array().pow(2.0).matrix().rowwise().sum();

    Matrix<F, Dynamic, D+1> G_(n, D+1);
    G_ << B.A, B.R;

    Matrix<F, 1, D+1> G_0 = G_.row(0);
    G_ = G_.rowwise() - G_0;

    Matrix<F, Dynamic, 1> h_(n, 1);
    h_ << -(1.0 / 2.0) * (
        ((B.R.array() - B.R[0]).pow(2.0) + K(0, 0)).matrix() - K
    );

    G = G_.bottomRows(n-1);
    h = h_.bottomRows(n-1);
}

// Assembly:
subq $0x4a8, %rsp            # imm = 0x4A8
movq %rdi, 0x4a0(%rsp)
movq 0x4a0(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x8(%rax), %rdi
callq 0x2b9410
movl %eax, 0x49c(%rsp)
movl $0x1, 0x484(%rsp)
leaq 0x488(%rsp), %rdi
leaq 0x49c(%rsp), %rsi
leaq 0x484(%rsp), %rdx
callq 0x2b22a0
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2acc30
movq %rax, 0x30(%rsp)
jmp 0x2bd609
movq 0x30(%rsp), %rax
movq %rax, 0x3e8(%rsp)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x3d0(%rsp)
leaq 0x3f0(%rsp), %rdi
leaq 0x3e8(%rsp), %rsi
leaq 0x3d0(%rsp), %rdx
callq 0x2ae320
jmp 0x2bd647
leaq 0x410(%rsp), %rdi
leaq 0x3f0(%rsp), %rsi
callq 0x2b4960
jmp 0x2bd65e
leaq 0x430(%rsp), %rdi
leaq 0x410(%rsp), %rsi
callq 0x2b1640
jmp 0x2bd675
leaq 0x450(%rsp), %rdi
leaq 0x430(%rsp), %rsi
callq 0x2a3280
jmp 0x2bd68c
leaq 0x488(%rsp), %rdi
leaq 0x450(%rsp), %rsi
callq 0x2ae380
jmp 0x2bd6a3
movl $0x3, 0x3bc(%rsp)
leaq 0x3c0(%rsp), %rdi
leaq 0x49c(%rsp), %rsi
leaq 0x3bc(%rsp), %rdx
callq 0x296ec0
jmp 0x2bd6cd
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x398(%rsp), %rdi
leaq 0x3c0(%rsp), %rsi
callq 0x29c620
jmp 0x2bd6ed
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
addq $0x10, %rsi
leaq 0x398(%rsp), %rdi
callq 0x2b31c0
jmp 0x2bd709
leaq 0x398(%rsp), %rdi
callq 0x2ae5e0
xorl %eax, %eax
movl %eax, %edx
leaq 0x358(%rsp), %rdi
leaq 0x3c0(%rsp), %rsi
callq 0x2b8c80
jmp 0x2bd731
leaq 0x38c(%rsp), %rdi
leaq 0x358(%rsp), %rsi
callq 0x293dc0
jmp 0x2bd748
leaq 0x3c0(%rsp), %rdi
callq 0x2aaca0
movq %rax, 0x20(%rsp)
jmp 0x2bd75c
movq 0x20(%rsp), %rax
movq %rax, 0x328(%rsp)
leaq 0x330(%rsp), %rdi
leaq 0x328(%rsp), %rsi
leaq 0x38c(%rsp), %rdx
callq 0x2a2620
jmp 0x2bd788
leaq 0x3c0(%rsp), %rdi
leaq 0x330(%rsp), %rsi
callq 0x298660
jmp 0x2bd79f
movl $0x1, 0x314(%rsp)
leaq 0x318(%rsp), %rdi
leaq 0x49c(%rsp), %rsi
leaq 0x314(%rsp), %rdx
callq 0x2b22a0
jmp 0x2bd7c9
movq 0x28(%rsp), %rax
movabsq $-0x4020000000000000, %rcx # imm = 0xBFE0000000000000
movq %rcx, 0x250(%rsp)
movq 0x8(%rax), %rdi
addq $0x10, %rdi
callq 0x2ad130
movq %rax, 0x18(%rsp)
jmp 0x2bd7f4
movq 0x28(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, 0xb0(%rsp)
movq 0x8(%rax), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2b49d0
movq %rax, 0x10(%rsp)
jmp 0x2bd81e
movq 0x10(%rsp), %rdx
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2a24b0
jmp 0x2bd83a
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0xa8(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x2a6fb0
jmp 0x2bd86b
xorl %eax, %eax
movl %eax, %edx
leaq 0x488(%rsp), %rdi
movq %rdx, %rsi
callq 0x2a7f30
movq %rax, 0x8(%rsp)
jmp 0x2bd886
movq 0x8(%rsp), %rdx
leaq 0x118(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x2948d0
jmp 0x2bd8a2
leaq 0x178(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x2a5d60
jmp 0x2bd8b9
leaq 0x1d8(%rsp), %rdi
leaq 0x178(%rsp), %rsi
leaq 0x488(%rsp), %rdx
callq 0x2b2c70
jmp 0x2bd8d8
leaq 0x258(%rsp), %rdi
leaq 0x250(%rsp), %rsi
leaq 0x1d8(%rsp), %rdx
callq 0x2ae8e0
jmp 0x2bd8f7
leaq 0x2f0(%rsp), %rdi
leaq 0x318(%rsp), %rsi
leaq 0x258(%rsp), %rdx
callq 0x2b0e50
jmp 0x2bd916
leaq 0x2f0(%rsp), %rdi
callq 0x2b0550
movl 0x49c(%rsp), %edx
decl %edx
leaq 0x70(%rsp), %rdi
leaq 0x3c0(%rsp), %rsi
callq 0x29e730
jmp 0x2bd940
movq 0x28(%rsp), %rdi
addq $0x10, %rdi
leaq 0x70(%rsp), %rsi
callq 0x2ae920
jmp 0x2bd955
movl 0x49c(%rsp), %edx
decl %edx
leaq 0x38(%rsp), %rdi
leaq 0x318(%rsp), %rsi
callq 0x2ae1c0
jmp 0x2bd972
movq 0x28(%rsp), %rdi
addq $0x20, %rdi
leaq 0x38(%rsp), %rsi
callq 0x2aed50
jmp 0x2bd987
leaq 0x318(%rsp), %rdi
callq 0x2b19b0
leaq 0x3c0(%rsp), %rdi
callq 0x2a5d80
leaq 0x488(%rsp), %rdi
callq 0x2b19b0
addq $0x4a8, %rsp            # imm = 0x4A8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3e0(%rsp)
movl %eax, 0x3dc(%rsp)
jmp 0x2bda33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3e0(%rsp)
movl %eax, 0x3dc(%rsp)
jmp 0x2bda26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3e0(%rsp)
movl %eax, 0x3dc(%rsp)
leaq 0x398(%rsp), %rdi
callq 0x2ae5e0
jmp 0x2bda26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3e0(%rsp)
movl %eax, 0x3dc(%rsp)
leaq 0x318(%rsp), %rdi
callq 0x2b19b0
leaq 0x3c0(%rsp), %rdi
callq 0x2a5d80
leaq 0x488(%rsp), %rdi
callq 0x2b19b0
movq 0x3e0(%rsp), %rdi
callq 0x2b6590
nopl (%rax)