// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1e8, %rsp            # imm = 0x1E8
movl %ecx, %ebx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq -0x210(%rbp), %rdi
callq 0x21f0
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x8d1f(%rip), %rdx      # 0xb207
leaq -0x58(%rbp), %rdi
movq %rdx, %rsi
callq 0x8c74
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x8d04(%rip), %rdx      # 0xb207
leaq -0x78(%rbp), %rdi
movq %rdx, %rsi
callq 0x8c74
movq %r12, -0x80(%rbp)
movq %r14, -0x88(%rbp)
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x261d
movq (%r15), %rcx
movq %rcx, -0x90(%rbp)
decq %rax
movq %rax, -0x98(%rbp)
movl $0x1, -0x34(%rbp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movq $0x0, -0x30(%rbp)
cmpl %ebx, %r13d
jne 0x255d
movl %r13d, %r14d
jmp 0x25fe
movq -0x90(%rbp), %rax
movzbl (%rax,%r12), %eax
cmpl $0x9, %eax
je 0x25b2
cmpl $0xa, %eax
jne 0x25d4
movq -0x50(%rbp), %rdx
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
leaq 0x8c83(%rip), %rcx      # 0xb207
xorl %r8d, %r8d
callq 0x8a08
movq $0x0, -0x30(%rbp)
movq -0x70(%rbp), %rdx
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
leaq 0x8c62(%rip), %rcx      # 0xb207
xorl %r8d, %r8d
callq 0x8a08
incl -0x34(%rbp)
jmp 0x25fa
leaq -0x58(%rbp), %rdi
leaq 0x8ac5(%rip), %rsi      # 0xb082
callq 0x87e6
leaq -0x78(%rbp), %rdi
leaq 0x8ab5(%rip), %rsi      # 0xb082
callq 0x87e6
jmp 0x25f0
movsbl %al, %esi
leaq -0x58(%rbp), %rdi
callq 0x8d0e
leaq -0x78(%rbp), %rdi
leaq 0x8a98(%rip), %rsi      # 0xb083
callq 0x87e6
movq -0x30(%rbp), %rax
incl %eax
movq %rax, -0x30(%rbp)
leal 0x1(%r13), %r14d
cmpl %ebx, %r13d
je 0x262f
leaq 0x1(%r12), %rax
movl %r14d, %r13d
cmpq %r12, -0x98(%rbp)
movq %rax, %r12
jne 0x2550
jmp 0x262f
movl $0x1, -0x34(%rbp)
movq $0x0, -0x30(%rbp)
xorl %r14d, %r14d
leaq -0x58(%rbp), %rbx
movslq %r14d, %rax
cmpq %rax, 0x8(%r15)
jbe 0x265e
movq (%r15), %rcx
movb (%rcx,%rax), %r12b
cmpb $0xa, %r12b
je 0x2658
movsbl %r12b, %esi
movq %rbx, %rdi
callq 0x8d0e
incl %r14d
cmpb $0xa, %r12b
jne 0x2633
movq -0x80(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x210(%rbp), %rdi
callq 0x21e0
movq -0x88(%rbp), %r14
movq %rax, %rbx
leaq 0x89ff(%rip), %rsi      # 0xb085
movl $0x9, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
movl -0x34(%rbp), %esi
callq 0x2280
movq %rax, %rbx
leaq 0x89e7(%rip), %rsi      # 0xb08f
movl $0x9, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
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 -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x210(%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 -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x210(%rbp), %rdi
callq 0x21e0
leaq 0x8955(%rip), %rsi      # 0xb099
movl $0x1, %edx
movq %rax, %rdi
callq 0x21e0
leaq -0x208(%rbp), %rsi
movq %r14, %rdi
callq 0x2150
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
leaq -0x48(%rbp), %rbx
je 0x277d
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2792
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21c0
movq 0xc81f(%rip), %rsi      # 0xefb8
leaq -0x210(%rbp), %rdi
callq 0x20f0
leaq -0x1a0(%rbp), %rdi
callq 0x2080
movq %r14, %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x27f0
movq %rax, %rbx
jmp 0x2809
jmp 0x27d4
jmp 0x27d4
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x27f0
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2809
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21c0
movq 0xc7a8(%rip), %rsi      # 0xefb8
leaq -0x210(%rbp), %rdi
callq 0x20f0
leaq -0x1a0(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2290