// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r15
movq %rdi, %r13
movq (%rsi), %rbx
movq 0x8(%rsi), %r12
movq 0x8(%rdx), %rsi
movq %rdx, 0x8(%rsp)
subq (%rdx), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x3cfcc
subq %rbx, %r12
sarq $0x3, %r12
incq %r12
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x6(%rsp), %rcx
movq %r12, %rsi
callq 0x3d01e
leaq 0x10(%rsp), %rdi
callq 0x4216a
movq (%r15), %rbx
movq 0x8(%r15), %r12
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0x28(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x3d074
subq %rbx, %r12
sarq $0x3, %r12
incq %r12
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0x3d0c6
leaq 0x28(%rsp), %rdi
callq 0x42430
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %rax
subq %rbx, %rax
pushq $0x18
popq %rsi
cqto
idivq %rsi
xorl %edx, %edx
movq 0x10(%rsp), %rsi
movq 0x16bcb(%rip), %xmm0    # 0x465a0
movapd 0x16bd3(%rip), %xmm1    # 0x465b0
xorl %edi, %edi
cmpq %rdi, %rax
je 0x2fa1a
movq %rdi, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movq (%rbx,%rdx), %r8
movsd %xmm3, (%r8)
movq (%rsi,%rdx), %r8
movl $0x2, (%r8)
incq %rdi
addq $0x18, %rdx
jmp 0x2f9df
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
pushq $0x1
popq %rsi
movq 0x10(%rsp), %rdi
cmpq %rdx, %rsi
jae 0x2fa63
movq %rsi, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movsd %xmm3, (%rax,%rsi,8)
movq (%rdi), %r8
movl $0x1, (%r8,%rsi,4)
incq %rsi
jmp 0x2fa30
movq (%r15), %rax
movq 0x8(%r15), %r15
subq %rax, %r15
sarq $0x3, %r15
movq 0x8(%rsp), %rcx
movq (%rcx), %rdx
movq 0x8(%rcx), %rsi
subq %rdx, %rsi
sarq $0x3, %rsi
xorl %edi, %edi
movsd 0x16b6a(%rip), %xmm0    # 0x465f8
pushq $0x1
popq %r8
movsd 0x16b56(%rip), %xmm1    # 0x465f0
cmpq %r15, %rdi
je 0x2fb74
movq %r13, %r9
leaq 0x1(%rdi), %r11
imulq $0x18, %rdi, %r12
leaq (%rbx,%r12), %r13
addq $0x18, %r13
movq %rbx, %r10
leaq (%rbx,%r12), %rbp
addq $0x18, %r12
addq 0x10(%rsp), %r12
xorl %r14d, %r14d
cmpq %r14, %rsi
je 0x2fb66
movq (%rax,%rdi,8), %rbx
cmpq (%rdx,%r14,8), %rbx
jne 0x2faf5
movq (%rbp), %rbx
movsd (%rbx,%r14,8), %xmm2
movq (%r13), %rbx
movsd %xmm2, 0x8(%rbx,%r14,8)
xorl %ebx, %ebx
jmp 0x2fb55
movq (%r13), %rbx
movsd (%rbx,%r14,8), %xmm4
movq (%rbp), %rcx
movsd (%rcx,%r14,8), %xmm2
movsd 0x8(%rcx,%r14,8), %xmm3
ucomisd %xmm4, %xmm3
jbe 0x2fb2c
ucomisd %xmm4, %xmm2
jbe 0x2fb2c
addsd %xmm0, %xmm4
movsd %xmm4, 0x8(%rbx,%r14,8)
movl %r8d, %ebx
jmp 0x2fb55
ucomisd %xmm3, %xmm4
jbe 0x2fb47
ucomisd %xmm3, %xmm2
jbe 0x2fb47
addsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rbx,%r14,8)
pushq $0x2
jmp 0x2fb54
addsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rbx,%r14,8)
pushq $0x3
popq %rbx
movq (%r12), %rcx
movl %ebx, 0x4(%rcx,%r14,4)
incq %r14
jmp 0x2fac9
movq %r11, %rdi
movq %r9, %r13
movq %r10, %rbx
jmp 0x2fa9a
xorpd %xmm0, %xmm0
movupd %xmm0, (%r13)
andq $0x0, 0x10(%r13)
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r12
subq (%rax), %r12
sarq $0x3, %r12
leaq 0x28(%rsp), %r14
movq %r15, %rax
orq %r12, %rax
je 0x2fbdc
movq 0x10(%rsp), %rax
imulq $0x18, %r15, %rcx
movq (%rax,%rcx), %rax
movl (%rax,%r12,4), %eax
movl %eax, 0x28(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x3d11c
movl 0x28(%rsp), %eax
xorl %ecx, %ecx
cmpl $0x1, %eax
setne %cl
subq %rcx, %r15
xorl %ecx, %ecx
cmpl $0x2, %eax
setne %cl
subq %rcx, %r12
jmp 0x2fb98
movq (%r13), %rdi
movq 0x8(%r13), %rsi
callq 0x427cd
leaq 0x10(%rsp), %rdi
callq 0x3d13a
leaq 0x40(%rsp), %rdi
callq 0x3d15c
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2fc39
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x42430
jmp 0x2fc4e
movq %rax, %r14
jmp 0x2fc4e
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x4216a
jmp 0x2fc58
movq %rax, %r14
jmp 0x2fc58
movq %r13, %rdi
movq %rax, %r14
callq 0x42430
leaq 0x10(%rsp), %rdi
callq 0x3d13a
leaq 0x40(%rsp), %rdi
callq 0x3d15c
movq %r14, %rdi
callq 0x25930