// File: fpavetic[P]lcskpp/lcskpp.cpp
// Function: lcskpp_slow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int*)
void lcskpp_slow(const string& a, const string& b, const int K,
                 int* lcskpp_length) {
  vector<vector<int> > dp(a.size()+1, 
                          vector<int>(b.size()+1));

  for (int i = 0; i <= a.size(); ++i) dp[i][0] = 0;
  for (int j = 0; j <= b.size(); ++j) dp[0][j] = 0;

  for (int i = 1; i <= a.size(); ++i) {
    for (int j = 1; j <= b.size(); ++j) {
      dp[i][j] = max(dp[i-1][j], dp[i][j-1]);

      // 2*K is good enough limit because everything bigger is 
      // covered by some precedent matching interval.
      for (int k = 1; k <= min3(i, j, 2*K); ++k) {
        char aa = a[i-k];
        char bb = b[j-k];
        if (aa != bb) {
          break;
        }

        if (k >= K) {
          dp[i][j] = max(dp[i][j], dp[i-k][j-k]+k);
        }
      }
    }
  }

  *lcskpp_length = dp[a.size()][b.size()];
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movl %edx, 0x104(%rsp)
movq %rcx, 0xf8(%rsp)
movq 0x110(%rsp), %rdi
callq 0x2110
incq %rax
movq %rax, 0x78(%rsp)
movq 0x108(%rsp), %rdi
callq 0x2110
incq %rax
movq %rax, 0x80(%rsp)
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x7460
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x7470
jmp 0x6817
leaq 0xb3(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x74f0
movq 0x78(%rsp), %rsi
movq 0x70(%rsp), %rcx
leaq 0xe0(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x7500
jmp 0x684a
leaq 0xb3(%rsp), %rdi
callq 0x7580
leaq 0xc8(%rsp), %rdi
callq 0x7590
leaq 0xc7(%rsp), %rdi
callq 0x75f0
movl $0x0, 0xac(%rsp)
movslq 0xac(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x110(%rsp), %rdi
callq 0x2110
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
ja 0x6937
movslq 0xac(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x7600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7620
movl $0x0, (%rax)
movl 0xac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0x687c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
jmp 0x6925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0xb3(%rsp), %rdi
callq 0x7580
leaq 0xc8(%rsp), %rdi
callq 0x7590
leaq 0xc7(%rsp), %rdi
callq 0x75f0
jmp 0x6d06
movl $0x0, 0xa8(%rsp)
movslq 0xa8(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x108(%rsp), %rdi
callq 0x2110
movq %rax, %rcx
movq 0x60(%rsp), %rax
cmpq %rcx, %rax
ja 0x69a3
leaq 0xe0(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7600
movq %rax, %rdi
movslq 0xa8(%rsp), %rsi
callq 0x7620
movl $0x0, (%rax)
movl 0xa8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa8(%rsp)
jmp 0x6942
movl $0x1, 0xa4(%rsp)
movslq 0xa4(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x110(%rsp), %rdi
callq 0x2110
movq %rax, %rcx
movq 0x58(%rsp), %rax
cmpq %rcx, %rax
ja 0x6cab
movl $0x1, 0xa0(%rsp)
movslq 0xa0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x108(%rsp), %rdi
callq 0x2110
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
ja 0x6c93
movl 0xa4(%rsp), %eax
decl %eax
movslq %eax, %rsi
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x7600
movq %rax, %rdi
movslq 0xa0(%rsp), %rsi
callq 0x7620
movq 0x38(%rsp), %rdi
movq %rax, 0x40(%rsp)
movslq 0xa4(%rsp), %rsi
callq 0x7600
movq %rax, %rdi
movl 0xa0(%rsp), %eax
decl %eax
movslq %eax, %rsi
callq 0x7620
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x7640
movq %rax, 0x48(%rsp)
jmp 0x6a7c
movq 0x48(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x34(%rsp)
movslq 0xa4(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x7600
movq %rax, %rdi
movslq 0xa0(%rsp), %rsi
callq 0x7620
movl 0x34(%rsp), %ecx
movl %ecx, (%rax)
movl $0x1, 0x9c(%rsp)
movl 0x9c(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0xa4(%rsp), %edi
movl 0xa0(%rsp), %esi
movl 0x104(%rsp), %edx
addl %edx, %edx
callq 0x6d20
movl %eax, 0x30(%rsp)
jmp 0x6aea
movl 0x2c(%rsp), %eax
movl 0x30(%rsp), %ecx
cmpl %ecx, %eax
jg 0x6c7b
movq 0x110(%rsp), %rdi
movl 0xa4(%rsp), %eax
subl 0x9c(%rsp), %eax
movslq %eax, %rsi
callq 0x21a0
movb (%rax), %al
movb %al, 0x9b(%rsp)
movq 0x108(%rsp), %rdi
movl 0xa0(%rsp), %eax
subl 0x9c(%rsp), %eax
movslq %eax, %rsi
callq 0x21a0
movb (%rax), %al
movb %al, 0x9a(%rsp)
movsbl 0x9b(%rsp), %eax
movsbl 0x9a(%rsp), %ecx
cmpl %ecx, %eax
je 0x6b87
jmp 0x6c7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x7680
jmp 0x6d06
movl 0x9c(%rsp), %eax
cmpl 0x104(%rsp), %eax
jl 0x6c63
movslq 0xa4(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7600
movq %rax, %rdi
movslq 0xa0(%rsp), %rsi
callq 0x7620
movq 0x10(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl 0xa4(%rsp), %eax
movl 0x9c(%rsp), %ecx
subl %ecx, %eax
movslq %eax, %rsi
callq 0x7600
movq %rax, %rdi
movl 0xa0(%rsp), %eax
movl 0x9c(%rsp), %ecx
subl %ecx, %eax
movslq %eax, %rsi
callq 0x7620
movq 0x18(%rsp), %rdi
movl (%rax), %eax
movl 0x9c(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x94(%rsp)
leaq 0x94(%rsp), %rsi
callq 0x7640
movq %rax, 0x20(%rsp)
jmp 0x6c2d
movq 0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movslq 0xa4(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x7600
movq %rax, %rdi
movslq 0xa0(%rsp), %rsi
callq 0x7620
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x6c65
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0x6abd
jmp 0x6c7d
movl 0xa0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0x69e4
jmp 0x6c95
movl 0xa4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa4(%rsp)
jmp 0x69ae
movq 0x110(%rsp), %rdi
callq 0x2110
movq %rax, %rsi
leaq 0xe0(%rsp), %rdi
callq 0x7600
movq %rax, (%rsp)
movq 0x108(%rsp), %rdi
callq 0x2110
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x7620
movl (%rax), %ecx
movq 0xf8(%rsp), %rax
movl %ecx, (%rax)
leaq 0xe0(%rsp), %rdi
callq 0x7680
addq $0x118, %rsp            # imm = 0x118
retq
movq 0xb8(%rsp), %rdi
callq 0x2270
nopw %cs:(%rax,%rax)