// File: /workspace/github_cpp_makefile_star2_O3/schlagenhauf[P]lqr_solve/lqr_solve.cpp
// Function: main
int main() {
  Mtx A;
  Mtx B;
  Mtx Q;
  Mtx R;
  Mtx N;
  Mtx K;
  A.resize(4, 4);
  B.resize(4, 1);
  Q.resize(4, 4);
  R.resize(1, 1);
  N.resize(4, 1);

  A << 0.9904, 0.04772, 0.004251, 0.0007791, -0.3764, 0.9061, 0.167, 0.03211,
      0.002975, -0.004629, 0.9985, 0.04999, 0.1309, -0.1814, -0.06348, 0.9982;
  B << -0.00241, -0.09491, -9.478e-05, -0.0007852;
  Q << 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0;
  R << 100;
  N << 0, 0, 0, 0;

  if (!compGainMatrix(A, B, Q, R, N, &K))
    return 1;

  Eigen::IOFormat fmt(4, 0, ", ", "\n", "[", "]");
  std::cout << "K: " << K.format(fmt) << std::endl;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
xorps %xmm0, %xmm0
leaq -0x100(%rbp), %r12
movaps %xmm0, (%r12)
xorl %eax, %eax
movq %rax, 0x10(%r12)
movq %rax, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movq %rax, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movq %rax, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movq %rax, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movq %rax, -0x110(%rbp)
movaps %xmm0, -0x120(%rbp)
movl $0x10, %esi
movl $0x4, %edx
movl $0x4, %ecx
movq %r12, %rdi
callq 0x185ac
leaq -0xa0(%rbp), %r15
movl $0x4, %esi
movl $0x4, %edx
movl $0x1, %ecx
movq %r15, %rdi
callq 0x185ac
leaq -0x80(%rbp), %r14
movl $0x10, %esi
movl $0x4, %edx
movl $0x4, %ecx
movq %r14, %rdi
callq 0x185ac
leaq -0x60(%rbp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x185ac
leaq -0x40(%rbp), %rbx
movl $0x1, %r13d
movl $0x4, %esi
movl $0x4, %edx
movl $0x1, %ecx
movq %rbx, %rdi
callq 0x185ac
movq %r12, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movq %r13, -0x270(%rbp)
movq %r13, -0x268(%rbp)
cmpq $0x0, -0xf8(%rbp)
jle 0x3509
cmpq $0x0, -0xf0(%rbp)
jle 0x3509
movq -0x100(%rbp), %rax
movabsq $0x3fefb15b573eab36, %rcx # imm = 0x3FEFB15B573EAB36
movq %rcx, (%rax)
movabsq $0x3fa86ec17ebaf102, %rax # imm = 0x3FA86EC17EBAF102
leaq -0x3b0(%rbp), %rsi
movq %rax, (%rsi)
leaq -0x280(%rbp), %rdi
callq 0x380e
movabsq $0x3f71697f1f9acffa, %rcx # imm = 0x3F71697F1F9ACFFA
leaq -0xe0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3f4987908299a2d4, %rcx # imm = 0x3F4987908299A2D4
leaq -0xc0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $-0x4027e90ff9724745, %rcx # imm = 0xBFD816F0068DB8BB
leaq -0x140(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3fecfec56d5cfaad, %rcx # imm = 0x3FECFEC56D5CFAAD
leaq -0x2c0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3fc5604189374bc7, %rcx # imm = 0x3FC5604189374BC7
leaq -0x2a0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3fa070b8cfbfc654, %rcx # imm = 0x3FA070B8CFBFC654
leaq -0x188(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3f685f06f6944674, %rcx # imm = 0x3F685F06F6944674
leaq -0x180(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $-0x408d0a24463065f9, %rcx # imm = 0xBF72F5DBB9CF9A07
leaq -0x178(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3feff3b645a1cac1, %rcx # imm = 0x3FEFF3B645A1CAC1
leaq -0x170(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3fa9984a0e410b63, %rcx # imm = 0x3FA9984A0E410B63
leaq -0x168(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3fc0c154c985f06f, %rcx # imm = 0x3FC0C154C985F06F
leaq -0x160(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $-0x4038c7e28240b780, %rcx # imm = 0xBFC7381D7DBF4880
leaq -0x158(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $-0x404fbfc6540cc78f, %rcx # imm = 0xBFB04039ABF33871
leaq -0x150(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3feff141205bc01a, %rcx # imm = 0x3FEFF141205BC01A
leaq -0x148(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
movq -0x280(%rbp), %rdx
movq 0x10(%rdx), %rax
cmpq 0x8(%rdx), %rcx
je 0x2d82
testq %rax, %rax
jne 0x3501
xorl %eax, %eax
cmpq %rax, -0x270(%rbp)
jne 0x3501
movq %r15, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movl $0x1, %eax
movq %rax, -0x270(%rbp)
movq %rax, -0x268(%rbp)
cmpq $0x0, -0x98(%rbp)
jle 0x350b
cmpq $0x0, -0x90(%rbp)
jle 0x350b
movq -0xa0(%rbp), %rax
movabsq $-0x409c41dd1a21ea36, %rcx # imm = 0xBF63BE22E5DE15CA
movq %rcx, (%rax)
movabsq $-0x4047b3fa6defc7a4, %rax # imm = 0xBFB84C059210385C
leaq -0x3b0(%rbp), %rsi
movq %rax, (%rsi)
leaq -0x280(%rbp), %rdi
callq 0x380e
movabsq $-0x40e7276bffad74c3, %rcx # imm = 0xBF18D89400528B3D
leaq -0xe0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $-0x40b64543d6ef657e, %rcx # imm = 0xBF49BABC29109A82
leaq -0xc0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
movq -0x280(%rbp), %rdx
movq 0x10(%rdx), %rax
cmpq 0x8(%rdx), %rcx
je 0x2e66
testq %rax, %rax
jne 0x3503
xorl %eax, %eax
cmpq %rax, -0x270(%rbp)
jne 0x3503
movq %r14, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movl $0x1, %eax
movq %rax, -0x270(%rbp)
movq %rax, -0x268(%rbp)
cmpq $0x0, -0x78(%rbp)
jle 0x350d
cmpq $0x0, -0x70(%rbp)
jle 0x350d
movq -0x80(%rbp), %rax
xorl %ecx, %ecx
movq %rcx, (%rax)
leaq -0x3b0(%rbp), %rsi
movq %rcx, (%rsi)
leaq -0x280(%rbp), %rdi
callq 0x380e
leaq -0xe0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0xc0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x140(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x2c0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x2a0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x188(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x180(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x178(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
leaq -0x170(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x168(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x160(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x158(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x150(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0x148(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
movq -0x280(%rbp), %rdx
movq 0x10(%rdx), %rax
cmpq 0x8(%rdx), %rcx
je 0x3031
testq %rax, %rax
jne 0x3505
xorl %eax, %eax
cmpq %rax, -0x270(%rbp)
jne 0x3505
movq -0x58(%rbp), %rax
testq %rax, %rax
jle 0x350f
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
jle 0x350f
movq -0x60(%rbp), %rdx
movabsq $0x4059000000000000, %rsi # imm = 0x4059000000000000
movq %rsi, (%rdx)
cmpq $0x1, %rax
jne 0x3511
cmpq $0x1, %rcx
jne 0x3511
movq %rbx, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movl $0x1, %eax
movq %rax, -0x270(%rbp)
movq %rax, -0x268(%rbp)
cmpq $0x0, -0x38(%rbp)
jle 0x3530
cmpq $0x0, -0x30(%rbp)
jle 0x3530
movq -0x40(%rbp), %rax
xorl %ecx, %ecx
movq %rcx, (%rax)
leaq -0x3b0(%rbp), %rsi
movq %rcx, (%rsi)
leaq -0x280(%rbp), %rdi
callq 0x380e
leaq -0xe0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
leaq -0xc0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x380e
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
movq -0x280(%rbp), %rdx
movq 0x10(%rdx), %rax
cmpq 0x8(%rdx), %rcx
je 0x312d
testq %rax, %rax
jne 0x3507
xorl %eax, %eax
cmpq %rax, -0x270(%rbp)
jne 0x3507
leaq -0x100(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0x80(%rbp), %rdx
leaq -0x60(%rbp), %rcx
leaq -0x40(%rbp), %r8
leaq -0x120(%rbp), %r9
movsd 0x15edd(%rip), %xmm0    # 0x19040
callq 0x231c
movl $0x1, %r14d
testb %al, %al
je 0x34ad
leaq -0x270(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1614e(%rip), %rsi     # 0x192d6
leaq 0x16149(%rip), %rdx     # 0x192d8
leaq -0x280(%rbp), %rdi
callq 0x3d32
leaq -0xd0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1612c(%rip), %rsi     # 0x192d9
leaq 0x16126(%rip), %rdx     # 0x192da
leaq -0xe0(%rbp), %rdi
callq 0x3d32
leaq -0xb0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x16109(%rip), %rsi     # 0x192db
leaq 0x16103(%rip), %rdx     # 0x192dc
leaq -0xc0(%rbp), %rdi
callq 0x3d32
leaq -0x130(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1ed45(%rip), %rsi     # 0x21f3c
leaq 0x1ed3f(%rip), %rdx     # 0x21f3d
leaq -0x140(%rbp), %r14
movq %r14, %rdi
callq 0x3d32
leaq -0x2b0(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x160bb(%rip), %rdx     # 0x192da
leaq -0x2c0(%rbp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3d32
leaq -0x290(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x16097(%rip), %rdx     # 0x192da
leaq -0x2a0(%rbp), %r12
movq %r12, %rdi
movq %rdx, %rsi
callq 0x3d32
leaq -0x3b0(%rbp), %rdi
leaq -0x280(%rbp), %rcx
leaq -0xe0(%rbp), %r8
leaq -0xc0(%rbp), %r9
movl $0x4, %esi
xorl %edx, %edx
pushq $0x20
pushq %r12
pushq %r15
pushq %r14
callq 0x391c
addq $0x20, %rsp
movq -0x2a0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x329a
callq 0x2120
movq -0x2c0(%rbp), %rdi
cmpq %r13, %rdi
leaq -0x270(%rbp), %rbx
je 0x32b2
callq 0x2120
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x32ca
callq 0x2120
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x32e2
callq 0x2120
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x32fa
callq 0x2120
movq -0x280(%rbp), %rdi
cmpq %rbx, %rdi
je 0x330b
callq 0x2120
movq 0x3ccbe(%rip), %rdi     # 0x3ffd0
leaq 0x15fc4(%rip), %rsi     # 0x192dd
movl $0x3, %edx
callq 0x2140
leaq -0x120(%rbp), %rax
leaq -0x278(%rbp), %r14
movq %rax, -0x8(%r14)
leaq -0x3b0(%rbp), %rsi
movq %r14, %rdi
callq 0x1866c
movq -0x280(%rbp), %rsi
movq 0x3cc7e(%rip), %rdi     # 0x3ffd0
movq %r14, %rdx
callq 0x18853
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
leaq -0x1a8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3399
callq 0x2120
leaq -0x1c8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33ae
callq 0x2120
leaq -0x1e8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33c3
callq 0x2120
leaq -0x208(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33d8
callq 0x2120
leaq -0x228(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33ed
callq 0x2120
leaq -0x248(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3402
callq 0x2120
leaq -0x268(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3417
callq 0x2120
leaq -0x2e0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x342c
callq 0x2120
leaq -0x300(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3441
callq 0x2120
leaq -0x320(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3456
callq 0x2120
leaq -0x340(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x346b
callq 0x2120
leaq -0x360(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3480
callq 0x2120
leaq -0x380(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3495
callq 0x2120
leaq -0x3a0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34aa
callq 0x2120
xorl %r14d, %r14d
movq -0x120(%rbp), %rdi
callq 0x2150
movq -0x40(%rbp), %rdi
callq 0x2150
movq -0x60(%rbp), %rdi
callq 0x2150
movq -0x80(%rbp), %rdi
callq 0x2150
movq -0xa0(%rbp), %rdi
callq 0x2150
movq -0x100(%rbp), %rdi
callq 0x2150
movl %r14d, %eax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3511
jmp 0x3511
jmp 0x3511
jmp 0x3511
jmp 0x3530
jmp 0x3530
jmp 0x3530
jmp 0x3530
leaq 0x36cdf(%rip), %rdi     # 0x3a1f7
leaq 0x36c11(%rip), %rsi     # 0x3a130
leaq 0x36d6f(%rip), %rcx     # 0x3a295
movl $0x7c, %edx
callq 0x2090
leaq 0x36b9d(%rip), %rdi     # 0x3a0d4
leaq 0x36bf2(%rip), %rsi     # 0x3a130
leaq 0x36c21(%rip), %rcx     # 0x3a166
movl $0x25, %edx
callq 0x2090
jmp 0x3551
movq %rax, %r14
jmp 0x36a9
movq %rax, %r14
movq -0x2a0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3572
callq 0x2120
jmp 0x3572
movq %rax, %r14
movq -0x2c0(%rbp), %rdi
cmpq %r13, %rdi
je 0x3588
callq 0x2120
jmp 0x3588
movq %rax, %r14
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x35a5
callq 0x2120
jmp 0x35a5
movq %rax, %r14
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x35c2
callq 0x2120
jmp 0x35c2
movq %rax, %r14
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x35df
callq 0x2120
jmp 0x35df
movq %rax, %r14
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rax
cmpq %rax, %rdi
je 0x3653
callq 0x2120
jmp 0x3653
jmp 0x36b7
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
jmp 0x3644
movq %rax, %r14
leaq -0x280(%rbp), %rdi
callq 0x38d6
movq -0x120(%rbp), %rdi
callq 0x2150
movq -0x40(%rbp), %rdi
callq 0x2150
movq -0x60(%rbp), %rdi
callq 0x2150
movq -0x80(%rbp), %rdi
callq 0x2150
movq -0xa0(%rbp), %rdi
callq 0x2150
movq -0x100(%rbp), %rdi
callq 0x2150
movq %r14, %rdi
callq 0x21b0
movq %rax, %r14
leaq -0x280(%rbp), %rdi
callq 0x3b50
leaq -0x3b0(%rbp), %rdi
callq 0x3bf2
jmp 0x3653
movq %rax, %r14
jmp 0x3653