// File: interimadd[P]M5Stack-PixelArt/test/lib/googletest/googletest/src/gtest.cc
// Function: testing::internal::edit_distance::CreateUnifiedDiff(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, unsigned long)
std::string CreateUnifiedDiff(const std::vector<std::string>& left,
                              const std::vector<std::string>& right,
                              size_t context) {
  const std::vector<EditType> edits = CalculateOptimalEdits(left, right);

  size_t l_i = 0, r_i = 0, edit_i = 0;
  std::stringstream ss;
  while (edit_i < edits.size()) {
    // Find first edit.
    while (edit_i < edits.size() && edits[edit_i] == kMatch) {
      ++l_i;
      ++r_i;
      ++edit_i;
    }

    // Find the first line to include in the hunk.
    const size_t prefix_context = std::min(l_i, context);
    Hunk hunk(l_i - prefix_context + 1, r_i - prefix_context + 1);
    for (size_t i = prefix_context; i > 0; --i) {
      hunk.PushLine(' ', left[l_i - i].c_str());
    }

    // Iterate the edits until we found enough suffix for the hunk or the input
    // is over.
    size_t n_suffix = 0;
    for (; edit_i < edits.size(); ++edit_i) {
      if (n_suffix >= context) {
        // Continue only if the next hunk is very close.
        std::vector<EditType>::const_iterator it = edits.begin() + edit_i;
        while (it != edits.end() && *it == kMatch) ++it;
        if (it == edits.end() || (it - edits.begin()) - edit_i >= context) {
          // There is no next edit or it is too far away.
          break;
        }
      }

      EditType edit = edits[edit_i];
      // Reset count when a non match is found.
      n_suffix = edit == kMatch ? n_suffix + 1 : 0;

      if (edit == kMatch || edit == kRemove || edit == kReplace) {
        hunk.PushLine(edit == kMatch ? ' ' : '-', left[l_i].c_str());
      }
      if (edit == kAdd || edit == kReplace) {
        hunk.PushLine('+', right[r_i].c_str());
      }

      // Advance indices, depending on edit type.
      l_i += edit != kAdd;
      r_i += edit != kRemove;
    }

    if (!hunk.has_edits()) {
      // We are done. We don't want this hunk.
      break;
    }

    hunk.PrintTo(&ss);
  }
  return ss.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x2b0(%rbp)
movq %rdi, %rax
movq %rax, -0x2a8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x38(%rbp), %rdi
callq 0x70740
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x52400
jmp 0x70a63
jmp 0x70a65
movq -0x50(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8a1c0
movq %rax, %rcx
movq -0x2b8(%rbp), %rax
cmpq %rcx, %rax
jae 0x70f14
jmp 0x70a8e
movq -0x50(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8a1c0
movq -0x2c8(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x2b9(%rbp)
jae 0x70ad2
movq -0x50(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8a1e0
cmpl $0x0, (%rax)
sete %al
movb %al, -0x2b9(%rbp)
movb -0x2b9(%rbp), %al
testb $0x1, %al
jne 0x70ade
jmp 0x70b1b
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x70a8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e0(%rbp)
movl %eax, -0x1e4(%rbp)
jmp 0x70f64
leaq -0x40(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x57c50
movq %rax, -0x2d0(%rbp)
jmp 0x70b31
movq -0x2d0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1f0(%rbp)
movq -0x40(%rbp), %rsi
movq -0x1f0(%rbp), %rax
subq %rax, %rsi
incq %rsi
movq -0x48(%rbp), %rdx
subq %rax, %rdx
incq %rdx
leaq -0x260(%rbp), %rdi
callq 0x70f80
jmp 0x70b6b
movq -0x1f0(%rbp), %rax
movq %rax, -0x268(%rbp)
cmpq $0x0, -0x268(%rbp)
jbe 0x70c0c
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x268(%rbp), %rax
subq %rax, %rsi
callq 0x88f30
movq %rax, %rdi
callq 0x52230
movq %rax, %rdx
leaq -0x260(%rbp), %rdi
movl $0x20, %esi
callq 0x70ff0
jmp 0x70bbc
jmp 0x70bbe
movq -0x268(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x268(%rbp)
jmp 0x70b79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e0(%rbp)
movl %eax, -0x1e4(%rbp)
jmp 0x70f58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e0(%rbp)
movl %eax, -0x1e4(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x71230
jmp 0x70f58
movq $0x0, -0x270(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8a1c0
movq %rax, %rcx
movq -0x2d8(%rbp), %rax
cmpq %rcx, %rax
jae 0x70e82
movq -0x270(%rbp), %rax
cmpq -0x20(%rbp), %rax
jb 0x70d55
leaq -0x38(%rbp), %rdi
callq 0x8a200
movq %rax, -0x280(%rbp)
movq -0x50(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x8a230
movq %rax, -0x278(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8a2b0
movq %rax, -0x288(%rbp)
leaq -0x278(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x8a270
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x2d9(%rbp)
jne 0x70caa
jmp 0x70cc2
leaq -0x278(%rbp), %rdi
callq 0x8a2e0
cmpl $0x0, (%rax)
sete %al
movb %al, -0x2d9(%rbp)
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x70cce
jmp 0x70cdc
leaq -0x278(%rbp), %rdi
callq 0x8a300
jmp 0x70c76
leaq -0x38(%rbp), %rdi
callq 0x8a2b0
movq %rax, -0x290(%rbp)
leaq -0x278(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x8a320
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x2da(%rbp)
jne 0x70d42
leaq -0x38(%rbp), %rdi
callq 0x8a200
movq %rax, -0x298(%rbp)
leaq -0x278(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x8a360
subq -0x50(%rbp), %rax
cmpq -0x20(%rbp), %rax
setae %al
movb %al, -0x2da(%rbp)
movb -0x2da(%rbp), %al
testb $0x1, %al
jne 0x70d4e
jmp 0x70d53
jmp 0x70e82
jmp 0x70d55
movq -0x50(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8a1e0
movl (%rax), %eax
movl %eax, -0x29c(%rbp)
cmpl $0x0, -0x29c(%rbp)
jne 0x70d87
movq -0x270(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2e8(%rbp)
jmp 0x70d92
xorl %eax, %eax
movq %rax, -0x2e8(%rbp)
jmp 0x70d92
movq -0x2e8(%rbp), %rax
movq %rax, -0x270(%rbp)
cmpl $0x0, -0x29c(%rbp)
je 0x70dbb
cmpl $0x2, -0x29c(%rbp)
je 0x70dbb
cmpl $0x3, -0x29c(%rbp)
jne 0x70e04
movl -0x29c(%rbp), %eax
movl %eax, -0x2ec(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x88f30
movq %rax, %rdi
callq 0x52230
movq %rax, %rdx
movl -0x2ec(%rbp), %eax
testl %eax, %eax
movl $0x20, %eax
movl $0x2d, %esi
cmovel %eax, %esi
leaq -0x260(%rbp), %rdi
callq 0x70ff0
jmp 0x70e02
jmp 0x70e04
cmpl $0x1, -0x29c(%rbp)
je 0x70e16
cmpl $0x3, -0x29c(%rbp)
jne 0x70e43
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x88f30
movq %rax, %rdi
callq 0x52230
movq %rax, %rdx
leaq -0x260(%rbp), %rdi
movl $0x2b, %esi
callq 0x70ff0
jmp 0x70e41
jmp 0x70e43
cmpl $0x1, -0x29c(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x2, -0x29c(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x70c17
leaq -0x260(%rbp), %rdi
callq 0x71110
movb %al, -0x2ed(%rbp)
jmp 0x70e96
movb -0x2ed(%rbp), %al
testb $0x1, %al
jne 0x70eae
jmp 0x70ea2
movl $0x3, -0x2a0(%rbp)
jmp 0x70ef5
xorl %eax, %eax
leaq -0x1d8(%rbp), %rcx
cmpq $0x0, %rcx
movq %rax, -0x2f8(%rbp)
je 0x70ed6
leaq -0x1d8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x2f8(%rbp)
movq -0x2f8(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0x71150
jmp 0x70eeb
movl $0x0, -0x2a0(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x71230
movl -0x2a0(%rbp), %eax
testl %eax, %eax
je 0x70f0f
jmp 0x70f0d
jmp 0x70f14
jmp 0x70a65
movq -0x2b0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x525a0
jmp 0x70f29
movl $0x1, -0x2a0(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x52450
leaq -0x38(%rbp), %rdi
callq 0x89d90
movq -0x2a8(%rbp), %rax
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x1d8(%rbp), %rdi
callq 0x52450
leaq -0x38(%rbp), %rdi
callq 0x89d90
movq -0x1e0(%rbp), %rdi
callq 0x52bc0
nopl (%rax)