// File: /workspace/github_cpp_makefile_star2_O1/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 0x18d60
leaq -0xa0(%rbp), %r15
movl $0x4, %esi
movl $0x4, %edx
movl $0x1, %ecx
movq %r15, %rdi
callq 0x18d60
leaq -0x80(%rbp), %r14
movl $0x10, %esi
movl $0x4, %edx
movl $0x4, %ecx
movq %r14, %rdi
callq 0x18d60
leaq -0x60(%rbp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x18d60
leaq -0x40(%rbp), %rbx
movl $0x1, %r13d
movl $0x4, %esi
movl $0x4, %edx
movl $0x1, %ecx
movq %rbx, %rdi
callq 0x18d60
movq %r12, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movq %r13, -0x270(%rbp)
movq %r13, -0x268(%rbp)
cmpq $0x0, -0xf8(%rbp)
jle 0x351e
cmpq $0x0, -0xf0(%rbp)
jle 0x351e
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 0x38c2
movabsq $0x3f71697f1f9acffa, %rcx # imm = 0x3F71697F1F9ACFFA
leaq -0xe0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3f4987908299a2d4, %rcx # imm = 0x3F4987908299A2D4
leaq -0xc0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $-0x4027e90ff9724745, %rcx # imm = 0xBFD816F0068DB8BB
leaq -0x140(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3fecfec56d5cfaad, %rcx # imm = 0x3FECFEC56D5CFAAD
leaq -0x2c0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3fc5604189374bc7, %rcx # imm = 0x3FC5604189374BC7
leaq -0x2a0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3fa070b8cfbfc654, %rcx # imm = 0x3FA070B8CFBFC654
leaq -0x188(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3f685f06f6944674, %rcx # imm = 0x3F685F06F6944674
leaq -0x180(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $-0x408d0a24463065f9, %rcx # imm = 0xBF72F5DBB9CF9A07
leaq -0x178(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3feff3b645a1cac1, %rcx # imm = 0x3FEFF3B645A1CAC1
leaq -0x170(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3fa9984a0e410b63, %rcx # imm = 0x3FA9984A0E410B63
leaq -0x168(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3fc0c154c985f06f, %rcx # imm = 0x3FC0C154C985F06F
leaq -0x160(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $-0x4038c7e28240b780, %rcx # imm = 0xBFC7381D7DBF4880
leaq -0x158(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $-0x404fbfc6540cc78f, %rcx # imm = 0xBFB04039ABF33871
leaq -0x150(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3feff141205bc01a, %rcx # imm = 0x3FEFF141205BC01A
leaq -0x148(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movq -0x280(%rbp), %rax
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
cmpq 0x8(%rax), %rcx
je 0x2d93
cmpq $0x0, 0x10(%rax)
jne 0x3516
movq -0x270(%rbp), %rcx
cmpq 0x10(%rax), %rcx
jne 0x3516
movq %r15, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movl $0x1, %eax
movq %rax, -0x270(%rbp)
movq %rax, -0x268(%rbp)
cmpq $0x0, -0x98(%rbp)
jle 0x3520
cmpq $0x0, -0x90(%rbp)
jle 0x3520
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 0x38c2
movabsq $-0x40e7276bffad74c3, %rcx # imm = 0xBF18D89400528B3D
leaq -0xe0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $-0x40b64543d6ef657e, %rcx # imm = 0xBF49BABC29109A82
leaq -0xc0(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
movq -0x280(%rbp), %rax
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
cmpq 0x8(%rax), %rcx
je 0x2e77
cmpq $0x0, 0x10(%rax)
jne 0x3518
movq -0x270(%rbp), %rcx
cmpq 0x10(%rax), %rcx
jne 0x3518
movq %r14, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movl $0x1, %eax
movq %rax, -0x270(%rbp)
movq %rax, -0x268(%rbp)
cmpq $0x0, -0x78(%rbp)
jle 0x3522
cmpq $0x0, -0x70(%rbp)
jle 0x3522
movq -0x80(%rbp), %rax
xorl %ecx, %ecx
movq %rcx, (%rax)
leaq -0x3b0(%rbp), %rsi
movq %rcx, (%rsi)
leaq -0x280(%rbp), %rdi
callq 0x38c2
leaq -0xe0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0xc0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x140(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x2c0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x2a0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x188(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x180(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x178(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
leaq -0x170(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x168(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x160(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x158(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x150(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0x148(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
movq -0x280(%rbp), %rax
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
cmpq 0x8(%rax), %rcx
je 0x3042
cmpq $0x0, 0x10(%rax)
jne 0x351a
movq -0x270(%rbp), %rcx
cmpq 0x10(%rax), %rcx
jne 0x351a
movq -0x58(%rbp), %rax
testq %rax, %rax
jle 0x3524
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
jle 0x3524
movq -0x60(%rbp), %rdx
movabsq $0x4059000000000000, %rsi # imm = 0x4059000000000000
movq %rsi, (%rdx)
cmpq $0x1, %rax
jne 0x3526
cmpq $0x1, %rcx
jne 0x3526
movq %rbx, -0x280(%rbp)
movq $0x0, -0x278(%rbp)
movl $0x1, %eax
movq %rax, -0x270(%rbp)
movq %rax, -0x268(%rbp)
cmpq $0x0, -0x38(%rbp)
jle 0x3545
cmpq $0x0, -0x30(%rbp)
jle 0x3545
movq -0x40(%rbp), %rax
xorl %ecx, %ecx
movq %rcx, (%rax)
leaq -0x3b0(%rbp), %rsi
movq %rcx, (%rsi)
leaq -0x280(%rbp), %rdi
callq 0x38c2
leaq -0xe0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
leaq -0xc0(%rbp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x38c2
movq -0x280(%rbp), %rax
movq -0x268(%rbp), %rcx
addq -0x278(%rbp), %rcx
cmpq 0x8(%rax), %rcx
je 0x313e
cmpq $0x0, 0x10(%rax)
jne 0x351c
movq -0x270(%rbp), %rcx
cmpq 0x10(%rax), %rcx
jne 0x351c
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 0x16ec8(%rip), %xmm0    # 0x1a040
callq 0x231c
movl $0x1, %r14d
testb %al, %al
je 0x34c2
leaq -0x270(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x17139(%rip), %rsi     # 0x1a2d6
leaq 0x17134(%rip), %rdx     # 0x1a2d8
leaq -0x280(%rbp), %rdi
callq 0x3de0
leaq -0xd0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x17117(%rip), %rsi     # 0x1a2d9
leaq 0x17111(%rip), %rdx     # 0x1a2da
leaq -0xe0(%rbp), %rdi
callq 0x3de0
leaq -0xb0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x170f4(%rip), %rsi     # 0x1a2db
leaq 0x170ee(%rip), %rdx     # 0x1a2dc
leaq -0xc0(%rbp), %rdi
callq 0x3de0
leaq -0x130(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x20127(%rip), %rsi     # 0x23333
leaq 0x20121(%rip), %rdx     # 0x23334
leaq -0x140(%rbp), %r14
movq %r14, %rdi
callq 0x3de0
leaq -0x2b0(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x170a6(%rip), %rdx     # 0x1a2da
leaq -0x2c0(%rbp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3de0
leaq -0x290(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x17082(%rip), %rdx     # 0x1a2da
leaq -0x2a0(%rbp), %r12
movq %r12, %rdi
movq %rdx, %rsi
callq 0x3de0
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 0x39ce
addq $0x20, %rsp
movq -0x2a0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x32af
callq 0x2120
movq -0x2c0(%rbp), %rdi
cmpq %r13, %rdi
leaq -0x270(%rbp), %rbx
je 0x32c7
callq 0x2120
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x32df
callq 0x2120
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x32f7
callq 0x2120
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x330f
callq 0x2120
movq -0x280(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3320
callq 0x2120
movq 0x3eca9(%rip), %rdi     # 0x41fd0
leaq 0x16faf(%rip), %rsi     # 0x1a2dd
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 0x18e20
movq -0x280(%rbp), %rsi
movq 0x3ec69(%rip), %rdi     # 0x41fd0
movq %r14, %rdx
callq 0x19007
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 0x33ae
callq 0x2120
leaq -0x1c8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33c3
callq 0x2120
leaq -0x1e8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33d8
callq 0x2120
leaq -0x208(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33ed
callq 0x2120
leaq -0x228(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3402
callq 0x2120
leaq -0x248(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3417
callq 0x2120
leaq -0x268(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x342c
callq 0x2120
leaq -0x2e0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3441
callq 0x2120
leaq -0x300(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3456
callq 0x2120
leaq -0x320(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x346b
callq 0x2120
leaq -0x340(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3480
callq 0x2120
leaq -0x360(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3495
callq 0x2120
leaq -0x380(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34aa
callq 0x2120
leaq -0x3a0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34bf
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 0x3526
jmp 0x3526
jmp 0x3526
jmp 0x3526
jmp 0x3545
jmp 0x3545
jmp 0x3545
jmp 0x3545
leaq 0x39730(%rip), %rdi     # 0x3cc5d
leaq 0x39662(%rip), %rsi     # 0x3cb96
leaq 0x397c0(%rip), %rcx     # 0x3ccfb
movl $0x7c, %edx
callq 0x2090
leaq 0x395ee(%rip), %rdi     # 0x3cb3a
leaq 0x39643(%rip), %rsi     # 0x3cb96
leaq 0x39672(%rip), %rcx     # 0x3cbcc
movl $0x25, %edx
callq 0x2090
jmp 0x3566
movq %rax, %r14
jmp 0x36be
movq %rax, %r14
movq -0x2a0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3587
callq 0x2120
jmp 0x3587
movq %rax, %r14
movq -0x2c0(%rbp), %rdi
cmpq %r13, %rdi
je 0x359d
callq 0x2120
jmp 0x359d
movq %rax, %r14
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x35ba
callq 0x2120
jmp 0x35ba
movq %rax, %r14
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x35d7
callq 0x2120
jmp 0x35d7
movq %rax, %r14
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x35f4
callq 0x2120
jmp 0x35f4
movq %rax, %r14
movq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rax
cmpq %rax, %rdi
je 0x3668
callq 0x2120
jmp 0x3668
jmp 0x36cc
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
jmp 0x3659
movq %rax, %r14
leaq -0x280(%rbp), %rdi
callq 0x3988
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 0x3c02
leaq -0x3b0(%rbp), %rdi
callq 0x3ca4
jmp 0x3668
movq %rax, %r14
jmp 0x3668
nop