// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %rsi, %r15
movq %rdi, %r14
leaq -0x200(%rbp), %rdi
callq 0x21f0
leaq -0x50(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x8d1f(%rip), %rdx      # 0xb207
leaq -0x60(%rbp), %rdi
movq %rdx, %rsi
callq 0x8c32
movq %r14, -0x38(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x8d00(%rip), %rdx      # 0xb207
leaq -0x80(%rbp), %rdi
movq %rdx, %rsi
callq 0x8c32
movq %r15, -0x88(%rbp)
movq 0x8(%r12), %r15
testq %r15, %r15
je 0x25e1
movl %ebx, %r14d
movq %r12, -0x40(%rbp)
movq (%r12), %rbx
xorl %r13d, %r13d
movl $0x1, -0x2c(%rbp)
xorl %r12d, %r12d
cmpl %r13d, %r14d
je 0x25ed
movzbl (%rbx,%r13), %eax
cmpl $0x9, %eax
je 0x2592
cmpl $0xa, %eax
jne 0x25b4
movq -0x58(%rbp), %rdx
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
leaq 0x8c9e(%rip), %rcx      # 0xb207
xorl %r8d, %r8d
callq 0x89ae
xorl %r12d, %r12d
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x8c82(%rip), %rcx      # 0xb207
xorl %r8d, %r8d
callq 0x89ae
incl -0x2c(%rbp)
jmp 0x25d3
leaq -0x60(%rbp), %rdi
leaq 0x8ae5(%rip), %rsi      # 0xb082
callq 0x879a
leaq -0x80(%rbp), %rdi
leaq 0x8ad5(%rip), %rsi      # 0xb082
callq 0x879a
jmp 0x25d0
movsbl %al, %esi
leaq -0x60(%rbp), %rdi
callq 0x8cd0
leaq -0x80(%rbp), %rdi
leaq 0x8ab8(%rip), %rsi      # 0xb083
callq 0x879a
incl %r12d
incq %r13
cmpq %r13, %r15
jne 0x2540
jmp 0x25f0
xorl %r12d, %r12d
movl $0x1, -0x2c(%rbp)
jmp 0x2632
movl %r14d, %r15d
movl %r15d, %r14d
movq -0x40(%rbp), %rax
cmpq %r14, 0x8(%rax)
leaq -0x50(%rbp), %r13
jbe 0x2632
leaq -0x60(%rbp), %rbx
movq -0x38(%rbp), %r15
movq -0x40(%rbp), %rax
movq (%rax), %rax
movb (%rax,%r14), %al
cmpb $0xa, %al
je 0x2636
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8cd0
incq %r14
movq -0x40(%rbp), %rax
cmpq %r14, 0x8(%rax)
ja 0x260d
jmp 0x2636
movq -0x38(%rbp), %r15
movq -0x88(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x200(%rbp), %rdi
callq 0x21e0
movq %rax, %rbx
leaq 0x8a2b(%rip), %rsi      # 0xb085
movl $0x9, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
movl -0x2c(%rbp), %esi
callq 0x2280
movq %rax, %rbx
leaq 0x8a13(%rip), %rsi      # 0xb08f
movl $0x9, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x2280
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x200(%rbp), %rdi
callq 0x21e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
leaq -0x200(%rbp), %rdi
callq 0x21e0
leaq 0x8982(%rip), %rsi      # 0xb099
movl $0x1, %edx
movq %rax, %rdi
callq 0x21e0
leaq -0x1f8(%rbp), %rsi
movq %r15, %rdi
callq 0x2150
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x274c
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x60(%rbp), %rdi
cmpq %r13, %rdi
je 0x2761
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21c0
movq 0xc850(%rip), %rsi      # 0xefb8
leaq -0x200(%rbp), %rdi
callq 0x20f0
leaq -0x190(%rbp), %rdi
callq 0x2080
movq %r15, %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x27bf
movq %rax, %rbx
jmp 0x27d8
jmp 0x27a3
jmp 0x27a3
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x27bf
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x27d8
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21c0
movq 0xc7d9(%rip), %rsi      # 0xefb8
leaq -0x200(%rbp), %rdi
callq 0x20f0
leaq -0x190(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2290