// File: /workspace/github_cpp_makefile_star2_O2/eatonphil[P]cpp-json/json.cpp
// Function: json::format_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
std::string format_error(std::string base, std::string source, int index) {
  std::ostringstream s;
  int counter = 0;
  int line = 1;
  int column = 0;
  std::string lastline = "";
  std::string whitespace = "";
  for (auto c : source) {
    if (counter == index) {
      break;
    }

    if (c == '\n') {
      line++;
      column = 0;
      lastline = "";
      whitespace = "";
    } else if (c == '\t') {
      column++;
      lastline += "  ";
      whitespace += "  ";
    } else {
      column++;
      lastline += c;
      whitespace += " ";
    }

    counter++;
  }

  // Continue accumulating the lastline for debugging
  while (counter < source.size()) {
    auto c = source[counter];
    if (c == '\n') {
      break;
    }
    lastline += c;
    counter++;
  }

  s << base << " at line " << line << ", column " << column << std::endl;
  s << lastline << std::endl;
  s << whitespace << "^";

  return s.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movl %ecx, %ebx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq -0x200(%rbp), %rdi
callq 0x31c0
leaq 0x5dbd(%rip), %rsi      # 0x9207
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x5820
movq %r12, -0x38(%rbp)
movq %r14, -0x40(%rbp)
leaq 0x5d9e(%rip), %rsi      # 0x9207
leaq -0x68(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5820
movl %ebx, %r14d
movq (%r15), %rax
movq %rax, -0x48(%rbp)
movq 0x8(%r15), %r12
pushq $0x1
popq %rax
movl %eax, -0x30(%rbp)
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpq %rbx, %r12
je 0x3530
cmpl %ebx, %r14d
je 0x352d
movq -0x48(%rbp), %rax
movzbl (%rax,%rbx), %eax
cmpl $0x9, %eax
je 0x34de
cmpl $0xa, %eax
jne 0x3503
leaq -0x88(%rbp), %rdi
leaq 0x5d46(%rip), %rsi      # 0x9207
callq 0x7a7c
leaq -0x68(%rbp), %rdi
leaq 0x5d36(%rip), %rsi      # 0x9207
callq 0x7a7c
incl -0x30(%rbp)
xorl %r13d, %r13d
jmp 0x3525
leaq -0x88(%rbp), %rdi
leaq 0x5b96(%rip), %rsi      # 0x9082
callq 0x74e6
leaq -0x68(%rbp), %rdi
leaq 0x5b86(%rip), %rsi      # 0x9082
callq 0x74e6
jmp 0x3522
movsbl %al, %esi
leaq -0x88(%rbp), %rdi
callq 0x7ab6
leaq -0x68(%rbp), %rdi
leaq 0x5b66(%rip), %rsi      # 0x9083
callq 0x74e6
incl %r13d
incq %rbx
jmp 0x348f
movl %r14d, %r12d
movl %r12d, %r14d
leaq -0x88(%rbp), %rbx
movq -0x40(%rbp), %r12
cmpq %r14, 0x8(%r15)
jbe 0x355f
movq (%r15), %rax
movb (%rax,%r14), %al
cmpb $0xa, %al
je 0x355f
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7ab6
incq %r14
jmp 0x353e
leaq -0x200(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3170
leaq 0x5b0f(%rip), %rsi      # 0x9085
movq %rax, %rdi
callq 0x3180
movq %rax, %rdi
movl -0x30(%rbp), %esi
callq 0x3250
leaq 0x5aff(%rip), %rsi      # 0x908f
movq %rax, %rdi
callq 0x3180
movq %rax, %rdi
movl %r13d, %esi
callq 0x3250
movq %rax, %rdi
callq 0x30c0
leaq -0x200(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3170
movq %rax, %rdi
callq 0x30c0
leaq -0x200(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3170
leaq 0x5abc(%rip), %rsi      # 0x9099
movq %rax, %rdi
callq 0x3180
leaq -0x1f8(%rbp), %rsi
movq %r12, %rdi
callq 0x3130
leaq -0x68(%rbp), %rdi
callq 0x585c
leaq -0x88(%rbp), %rdi
callq 0x585c
leaq -0x200(%rbp), %rdi
callq 0x3060
movq %r12, %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3644
movq %rax, %rbx
jmp 0x3650
jmp 0x3638
jmp 0x3638
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x585c
leaq -0x88(%rbp), %rdi
callq 0x585c
leaq -0x200(%rbp), %rdi
callq 0x3060
movq %rbx, %rdi
callq 0x3260