// File: /workspace/github_c_makefile_star2_O1/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 $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 0x28fd6
subq %r14, %r12
sarq $0x3, %r12
incq %r12
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x6(%rsp), %rcx
movq %r12, %rsi
callq 0x29060
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x133e0
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0xc600
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 0x290f8
subq %r14, %r12
sarq $0x3, %r12
incq %r12
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0x29188
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1343d
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0xc600
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rax, %rdx
je 0x134b8
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 0x3eb9b(%rip), %xmm0    # 0x52010
movapd 0x3eba3(%rip), %xmm1    # 0x52020
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 0x1347f
movq %r13, 0x38(%rsp)
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq $0x2, %rdx
jb 0x1351b
movq 0x8(%rsp), %rsi
movq (%rsi), %rsi
movl $0x1, %edi
movq 0x3eb2a(%rip), %xmm0    # 0x52010
movapd 0x3eb32(%rip), %xmm1    # 0x52020
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 0x134ee
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 0x1365b
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 0x3eaf5(%rip), %xmm0    # 0x52068
movsd 0x3eae5(%rip), %xmm1    # 0x52060
cmpq %rsi, %rdi
je 0x1364f
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 0x135d3
movq (%r12), %rcx
movsd (%rcx,%r14,8), %xmm2
movq (%r13), %rcx
movsd %xmm2, 0x8(%rcx,%r14,8)
xorl %ecx, %ecx
jmp 0x1363a
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 0x1360c
ucomisd %xmm4, %xmm2
jbe 0x1360c
addsd %xmm0, %xmm4
movsd %xmm4, 0x8(%rcx,%r14,8)
movl $0x1, %ecx
jmp 0x1363a
ucomisd %xmm3, %xmm4
jbe 0x1362a
ucomisd %xmm3, %xmm2
jbe 0x1362a
addsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rcx,%r14,8)
movl $0x2, %ecx
jmp 0x1363a
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 0x135b4
incq %r10
cmpq %r9, %r10
jne 0x1357b
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 0x136f0
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 0x136c3
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x136ce
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2f92c
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 0x13698
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 0x1372f
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 0x13715
leaq 0x8(%rsp), %rdi
callq 0x29220
leaq 0x50(%rsp), %rdi
callq 0x2926e
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 0x137b8
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0xc600
jmp 0x137b8
movq %rax, %r14
jmp 0x137b8
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x137c2
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0xc600
jmp 0x137c2
movq %rax, %r14
jmp 0x137c2
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x137ae
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0xc600
leaq 0x8(%rsp), %rdi
callq 0x29220
leaq 0x50(%rsp), %rdi
callq 0x2926e
movq %r14, %rdi
callq 0xcbb0