// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/unittest/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 0x1f8e8
subq %rbx, %r12
sarq $0x3, %r12
incq %r12
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x6(%rsp), %rcx
movq %r12, %rsi
callq 0x1f93a
leaq 0x10(%rsp), %rdi
callq 0x24b8a
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 0x1f990
subq %rbx, %r12
sarq $0x3, %r12
incq %r12
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0x1f9e2
leaq 0x28(%rsp), %rdi
callq 0x24e50
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 0x30f1f(%rip), %xmm0    # 0x43010
movapd 0x30f27(%rip), %xmm1    # 0x43020
xorl %edi, %edi
cmpq %rdi, %rax
je 0x12136
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 0x120fb
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 0x1217f
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 0x1214c
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 0x30ebe(%rip), %xmm0    # 0x43068
pushq $0x1
popq %r8
movsd 0x30eaa(%rip), %xmm1    # 0x43060
cmpq %r15, %rdi
je 0x12290
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 0x12282
movq (%rax,%rdi,8), %rbx
cmpq (%rdx,%r14,8), %rbx
jne 0x12211
movq (%rbp), %rbx
movsd (%rbx,%r14,8), %xmm2
movq (%r13), %rbx
movsd %xmm2, 0x8(%rbx,%r14,8)
xorl %ebx, %ebx
jmp 0x12271
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 0x12248
ucomisd %xmm4, %xmm2
jbe 0x12248
addsd %xmm0, %xmm4
movsd %xmm4, 0x8(%rbx,%r14,8)
movl %r8d, %ebx
jmp 0x12271
ucomisd %xmm3, %xmm4
jbe 0x12263
ucomisd %xmm3, %xmm2
jbe 0x12263
addsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rbx,%r14,8)
pushq $0x2
jmp 0x12270
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 0x121e5
movq %r11, %rdi
movq %r9, %r13
movq %r10, %rbx
jmp 0x121b6
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 0x122f8
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 0x1fa38
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 0x122b4
movq (%r13), %rdi
movq 0x8(%r13), %rsi
callq 0x251ed
leaq 0x10(%rsp), %rdi
callq 0x1fa56
leaq 0x40(%rsp), %rdi
callq 0x1fa78
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12355
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x24e50
jmp 0x1236a
movq %rax, %r14
jmp 0x1236a
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x24b8a
jmp 0x12374
movq %rax, %r14
jmp 0x12374
movq %r13, %rdi
movq %rax, %r14
callq 0x24e50
leaq 0x10(%rsp), %rdi
callq 0x1fa56
leaq 0x40(%rsp), %rdi
callq 0x1fa78
movq %r14, %rdi
callq 0xdbf0