// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %r14
movq 0x8(%rsi), %r12
movq 0x8(%rdx), %rsi
subq (%rdx), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x402ae
subq %r14, %r12
sarq $0x3, %r12
incq %r12
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x6(%rsp), %rcx
movq %r12, %rsi
callq 0x40338
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2a908
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x1d460
movq (%r15), %r14
movq 0x8(%r15), %r12
movq 0x8(%r13), %rsi
subq (%r13), %rsi
sarq $0x3, %rsi
incq %rsi
leaq 0x20(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x403d0
subq %r14, %r12
sarq $0x3, %r12
incq %r12
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0x40460
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2a965
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x1d460
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rax, %rdx
je 0x2a9e0
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
movq 0x8(%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %esi, %esi
movq 0x1fc13(%rip), %xmm0    # 0x4a5b0
movapd 0x1fc1b(%rip), %xmm1    # 0x4a5c0
xorl %edi, %edi
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 (%rax,%rsi), %r8
movsd %xmm3, (%r8)
movq (%rdx,%rsi), %r8
movl $0x2, (%r8)
incq %rdi
addq $0x18, %rsi
cmpq %rdi, %rcx
jne 0x2a9a7
movq %r13, 0x38(%rsp)
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq $0x2, %rdx
jb 0x2aa43
movq 0x8(%rsp), %rsi
movq (%rsi), %rsi
movl $0x1, %edi
movq 0x1fba2(%rip), %xmm0    # 0x4a5b0
movapd 0x1fbaa(%rip), %xmm1    # 0x4a5c0
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
movsd %xmm3, (%rcx,%rdi,8)
movl $0x1, (%rsi,%rdi,4)
incq %rdi
cmpq %rdi, %rdx
jne 0x2aa16
movq (%r15), %rdx
movq 0x8(%r15), %rcx
movq %rcx, %r15
subq %rdx, %r15
sarq $0x3, %r15
movq %rcx, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
cmpq %rdx, %rcx
je 0x2ab83
movq 0x38(%rsp), %rcx
movq (%rcx), %rsi
movq 0x8(%rcx), %rdi
movq %rdi, %r8
subq %rsi, %r8
sarq $0x3, %r8
cmpq $0x1, %r8
adcq $0x0, %r8
cmpq $0x1, %r15
movq %r15, %r9
adcq $0x0, %r9
xorl %r10d, %r10d
movsd 0x1fb5d(%rip), %xmm0    # 0x4a5f8
movsd 0x1fb4d(%rip), %xmm1    # 0x4a5f0
cmpq %rsi, %rdi
je 0x2ab77
leaq (,%r10,8), %rcx
movq 0x40(%rsp), %rdx
movq (%rdx,%r10,8), %r11
leaq (%rcx,%rcx,2), %r12
leaq (%rax,%r12), %r13
addq $0x18, %r13
leaq (%rcx,%rcx,2), %rbp
addq $0x18, %rbp
addq %rax, %r12
addq 0x8(%rsp), %rbp
xorl %r14d, %r14d
cmpq (%rsi,%r14,8), %r11
jne 0x2aafb
movq (%r12), %rcx
movsd (%rcx,%r14,8), %xmm2
movq (%r13), %rcx
movsd %xmm2, 0x8(%rcx,%r14,8)
xorl %ecx, %ecx
jmp 0x2ab62
movq (%r13), %rcx
movsd (%rcx,%r14,8), %xmm4
movq (%r12), %rdx
movsd (%rdx,%r14,8), %xmm2
movsd 0x8(%rdx,%r14,8), %xmm3
ucomisd %xmm4, %xmm3
jbe 0x2ab34
ucomisd %xmm4, %xmm2
jbe 0x2ab34
addsd %xmm0, %xmm4
movsd %xmm4, 0x8(%rcx,%r14,8)
movl $0x1, %ecx
jmp 0x2ab62
ucomisd %xmm3, %xmm4
jbe 0x2ab52
ucomisd %xmm3, %xmm2
jbe 0x2ab52
addsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rcx,%r14,8)
movl $0x2, %ecx
jmp 0x2ab62
addsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rcx,%r14,8)
movl $0x3, %ecx
movq (%rbp), %rdx
movl %ecx, 0x4(%rdx,%r14,4)
incq %r14
cmpq %r14, %r8
jne 0x2aadc
incq %r10
cmpq %r9, %r10
jne 0x2aaa3
pxor %xmm0, %xmm0
movdqu %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq 0x38(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %r12
movq 0x48(%rsp), %rdx
xorq 0x40(%rsp), %rdx
movq %r12, %rcx
xorq %rax, %rcx
orq %rdx, %rcx
je 0x2ac18
subq %rax, %r12
sarq $0x3, %r12
leaq 0x20(%rsp), %r14
movq 0x8(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax,%r12,4), %eax
movl %eax, 0x20(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2abeb
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2abf6
movq %rbx, %rdi
movq %r14, %rdx
callq 0x46c44
movl 0x20(%rsp), %eax
xorl %ecx, %ecx
cmpl $0x1, %eax
setne %cl
subq %rcx, %r15
xorl %ecx, %ecx
cmpl $0x2, %eax
setne %cl
subq %rcx, %r12
movq %r15, %rax
orq %r12, %rax
jne 0x2abc0
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rcx, %rax
setne %dl
addq $-0x4, %rcx
cmpq %rax, %rcx
seta %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x2ac57
addq $0x4, %rax
movl -0x4(%rax), %edx
movl (%rcx), %esi
movl %esi, -0x4(%rax)
movl %edx, (%rcx)
addq $-0x4, %rcx
leaq 0x4(%rax), %rdx
cmpq %rcx, %rax
movq %rdx, %rax
jb 0x2ac3d
leaq 0x8(%rsp), %rdi
callq 0x404f8
leaq 0x50(%rsp), %rdi
callq 0x40546
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2ace0
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x1d460
jmp 0x2ace0
movq %rax, %r14
jmp 0x2ace0
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2acea
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x1d460
jmp 0x2acea
movq %rax, %r14
jmp 0x2acea
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x2acd6
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x1d460
leaq 0x8(%rsp), %rdi
callq 0x404f8
leaq 0x50(%rsp), %rdi
callq 0x40546
movq %r14, %rdi
callq 0x1d900