// File: interimadd[P]M5Stack-PixelArt/test/lib/googletest/googletest/src/gtest.cc
// Function: testing::internal::edit_distance::CalculateOptimalEdits(std::vector<unsigned long, std::allocator<unsigned long>> const&, std::vector<unsigned long, std::allocator<unsigned long>> const&)
std::vector<EditType> CalculateOptimalEdits(const std::vector<size_t>& left,
                                            const std::vector<size_t>& right) {
  std::vector<std::vector<double> > costs(
      left.size() + 1, std::vector<double>(right.size() + 1));
  std::vector<std::vector<EditType> > best_move(
      left.size() + 1, std::vector<EditType>(right.size() + 1));

  // Populate for empty right.
  for (size_t l_i = 0; l_i < costs.size(); ++l_i) {
    costs[l_i][0] = static_cast<double>(l_i);
    best_move[l_i][0] = kRemove;
  }
  // Populate for empty left.
  for (size_t r_i = 1; r_i < costs[0].size(); ++r_i) {
    costs[0][r_i] = static_cast<double>(r_i);
    best_move[0][r_i] = kAdd;
  }

  for (size_t l_i = 0; l_i < left.size(); ++l_i) {
    for (size_t r_i = 0; r_i < right.size(); ++r_i) {
      if (left[l_i] == right[r_i]) {
        // Found a match. Consume it.
        costs[l_i + 1][r_i + 1] = costs[l_i][r_i];
        best_move[l_i + 1][r_i + 1] = kMatch;
        continue;
      }

      const double add = costs[l_i + 1][r_i];
      const double remove = costs[l_i][r_i + 1];
      const double replace = costs[l_i][r_i];
      if (add < remove && add < replace) {
        costs[l_i + 1][r_i + 1] = add + 1;
        best_move[l_i + 1][r_i + 1] = kAdd;
      } else if (remove < add && remove < replace) {
        costs[l_i + 1][r_i + 1] = remove + 1;
        best_move[l_i + 1][r_i + 1] = kRemove;
      } else {
        // We make replace a little more expensive than add/remove to lower
        // their priority.
        costs[l_i + 1][r_i + 1] = replace + 1.00001;
        best_move[l_i + 1][r_i + 1] = kReplace;
      }
    }
  }

  // Reconstruct the best path. We do it in reverse order.
  std::vector<EditType> best_path;
  for (size_t l_i = left.size(), r_i = right.size(); l_i > 0 || r_i > 0;) {
    EditType move = best_move[l_i][r_i];
    best_path.push_back(move);
    l_i -= move != kAdd;
    r_i -= move != kRemove;
  }
  std::reverse(best_path.begin(), best_path.end());
  return best_path;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x128(%rbp)
movq %rdi, %rax
movq %rax, -0x120(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x89a50
incq %rax
movq %rax, -0x118(%rbp)
movq -0x18(%rbp), %rdi
callq 0x89a50
incq %rax
movq %rax, -0x110(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x89a70
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x89a90
jmp 0x6fed7
leaq -0x5d(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x89b00
movq -0x118(%rbp), %rsi
movq -0x130(%rbp), %rcx
leaq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x89b20
jmp 0x6ff04
leaq -0x5d(%rbp), %rdi
callq 0x89ba0
leaq -0x48(%rbp), %rdi
callq 0x89bc0
leaq -0x49(%rbp), %rdi
callq 0x89c20
movq -0x10(%rbp), %rdi
callq 0x89a50
incq %rax
movq %rax, -0x148(%rbp)
movq -0x18(%rbp), %rdi
callq 0x89a50
incq %rax
movq %rax, -0x140(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x89c40
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0x89c60
jmp 0x6ff74
leaq -0x92(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x89cd0
movq -0x148(%rbp), %rsi
movq -0x150(%rbp), %rcx
leaq -0x78(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0x89cf0
jmp 0x6ffa7
leaq -0x92(%rbp), %rdi
callq 0x89d70
leaq -0x90(%rbp), %rdi
callq 0x89d90
leaq -0x91(%rbp), %rdi
callq 0x89df0
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x89e10
movq %rax, %rcx
movq -0x158(%rbp), %rax
cmpq %rcx, %rax
jae 0x70110
movaps 0x385a9(%rip), %xmm1    # 0xa85b0
movq -0xa0(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x385a5(%rip), %xmm1    # 0xa85c0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x160(%rbp)
movq -0xa0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89e60
movsd -0x160(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0xa0(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x89e80
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89ea0
movl $0x2, (%rax)
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x6ffd6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x700bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x5d(%rbp), %rdi
callq 0x89ba0
leaq -0x48(%rbp), %rdi
callq 0x89bc0
leaq -0x49(%rbp), %rdi
callq 0x89c20
jmp 0x70736
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x700ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x92(%rbp), %rdi
callq 0x89d70
leaq -0x90(%rbp), %rdi
callq 0x89d90
leaq -0x91(%rbp), %rdi
callq 0x89df0
jmp 0x7072d
movq $0x1, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89e40
movq %rax, %rdi
callq 0x89ec0
movq %rax, %rcx
movq -0x168(%rbp), %rax
cmpq %rcx, %rax
jae 0x701e4
movaps 0x38458(%rip), %xmm1    # 0xa85b0
movq -0xa8(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x38454(%rip), %xmm1    # 0xa85c0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x170(%rbp)
leaq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89e40
movq %rax, %rdi
movq -0xa8(%rbp), %rsi
callq 0x89e60
movsd -0x170(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x78(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89e80
movq %rax, %rdi
movq -0xa8(%rbp), %rsi
callq 0x89ea0
movl $0x1, (%rax)
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x7011b
movq $0x0, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x10(%rbp), %rdi
callq 0x89a50
movq %rax, %rcx
movq -0x178(%rbp), %rax
cmpq %rcx, %rax
jae 0x705a7
movq $0x0, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x18(%rbp), %rdi
callq 0x89a50
movq %rax, %rcx
movq -0x180(%rbp), %rax
cmpq %rcx, %rax
jae 0x7058e
movq -0x10(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0x89ee0
movq (%rax), %rax
movq %rax, -0x188(%rbp)
movq -0x18(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x89ee0
movq %rax, %rcx
movq -0x188(%rbp), %rax
cmpq (%rcx), %rax
jne 0x7031b
movq -0xb0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
callq 0x89e60
movsd (%rax), %xmm0
movsd %xmm0, -0x190(%rbp)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89e60
movsd -0x190(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x78(%rbp), %rdi
callq 0x89e80
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89ea0
movl $0x0, (%rax)
jmp 0x70577
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
callq 0x89e60
movsd (%rax), %xmm0
movsd %xmm0, -0xc0(%rbp)
movq -0xb0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89e60
movsd (%rax), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq -0xb0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
callq 0x89e60
movsd (%rax), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0xc0(%rbp), %xmm1
movsd -0xc8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x70451
movsd -0xc0(%rbp), %xmm1
movsd -0xd0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x70451
movsd 0x381c4(%rip), %xmm0    # 0xa85a0
addsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x198(%rbp)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89e60
movsd -0x198(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x78(%rbp), %rdi
callq 0x89e80
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89ea0
movl $0x1, (%rax)
jmp 0x70575
movsd -0xc8(%rbp), %xmm1
movsd -0xc0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x704fb
movsd -0xc8(%rbp), %xmm1
movsd -0xd0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x704fb
movsd 0x38117(%rip), %xmm0    # 0xa85a0
addsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89e60
movsd -0x1a0(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x78(%rbp), %rdi
callq 0x89e80
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89ea0
movl $0x2, (%rax)
jmp 0x70573
movsd 0x38095(%rip), %xmm0    # 0xa8598
addsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x1a8(%rbp)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x30(%rbp), %rdi
callq 0x89e40
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89e60
movsd -0x1a8(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0xb0(%rbp), %rsi
addq $0x1, %rsi
leaq -0x78(%rbp), %rdi
callq 0x89e80
movq %rax, %rdi
movq -0xb8(%rbp), %rsi
addq $0x1, %rsi
callq 0x89ea0
movl $0x3, (%rax)
jmp 0x70575
jmp 0x70577
movq -0xb8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x70224
jmp 0x70590
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
jmp 0x701ef
movq -0x128(%rbp), %rdi
movb $0x0, -0xd1(%rbp)
callq 0x89f00
movq -0x10(%rbp), %rdi
callq 0x89a50
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x89a50
movq %rax, -0xe8(%rbp)
movb $0x1, %al
cmpq $0x0, -0xe0(%rbp)
movb %al, -0x1a9(%rbp)
ja 0x705fd
cmpq $0x0, -0xe8(%rbp)
seta %al
movb %al, -0x1a9(%rbp)
movb -0x1a9(%rbp), %al
testb $0x1, %al
jne 0x7060c
jmp 0x706b4
movq -0xe0(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x89e80
movq %rax, %rdi
movq -0xe8(%rbp), %rsi
callq 0x89ea0
movq -0x128(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xec(%rbp)
leaq -0xec(%rbp), %rsi
callq 0x89f20
jmp 0x70648
cmpl $0x1, -0xec(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, %ecx
movq -0xe0(%rbp), %rax
subq %rcx, %rax
movq %rax, -0xe0(%rbp)
cmpl $0x2, -0xec(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, %ecx
movq -0xe8(%rbp), %rax
subq %rcx, %rax
movq %rax, -0xe8(%rbp)
jmp 0x705da
movq -0x128(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x89d90
leaq -0x78(%rbp), %rdi
callq 0x8a030
jmp 0x7072d
movq -0x128(%rbp), %rdi
callq 0x89fd0
movq -0x128(%rbp), %rdi
movq %rax, -0xf8(%rbp)
callq 0x8a000
movq %rax, -0x100(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x100(%rbp), %rsi
callq 0x89f90
jmp 0x706ef
movb $0x1, -0xd1(%rbp)
testb $0x1, -0xd1(%rbp)
jne 0x7070b
movq -0x128(%rbp), %rdi
callq 0x89d90
leaq -0x78(%rbp), %rdi
callq 0x8a030
leaq -0x30(%rbp), %rdi
callq 0x8a090
movq -0x120(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x8a090
movq -0x58(%rbp), %rdi
callq 0x52bc0
nop