// File: /workspace/github_cpp_makefile_star2_O1/eatonphil[P]cpp-json/json.cpp
// Function: json::parse_array[abi:cxx11](std::vector<json::JSONToken, std::allocator<json::JSONToken>>, int)
std::tuple<std::vector<JSONValue>, int, std::string>
parse_array(std::vector<JSONToken> tokens, int index) {
  std::vector<JSONValue> children = {};
  while (index < tokens.size()) {
    auto t = tokens[index];
    if (t.type == JSONTokenType::Syntax) {
      if (t.value == "]") {
        return {children, index + 1, ""};
      }

      if (t.value == ",") {
        index++;
        t = tokens[index];
      } else if (children.size() > 0) {
        return {{},
                index,
                format_parse_error("Expected comma after element in array", t)};
      }
    }

    auto [child, new_index, error] = parse(tokens, index);
    if (error.size()) {
      return {{}, index, error};
    }

    children.push_back(child);
    index = new_index;
  }

  return {
      {},
      index,
      format_parse_error("Unexpected EOF while parsing array", tokens[index])};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %r14
movq %rdi, -0x38(%rbp)
leaq -0x2c(%rbp), %rax
movl %edx, (%rax)
xorps %xmm0, %xmm0
leaq -0xb0(%rbp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq -0x70(%rbp), %r13
leaq -0x248(%rbp), %r12
leaq -0x90(%rbp), %r15
movq %rsi, -0xb8(%rbp)
movslq -0x2c(%rbp), %rax
movq (%r14), %rbx
movq 0x8(%r14), %rcx
subq %rbx, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
cmpq %rax, %rcx
jbe 0x3aa2
movq %r12, %r14
movq %r13, %rdi
movq %r15, %r12
imulq $0x38, %rax, %r15
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq (%rbx,%r15), %rsi
movq 0x8(%rbx,%r15), %rdx
addq %rsi, %rdx
callq 0x853e
addq %r15, %rbx
movq 0x20(%rbx), %rax
movq %rax, -0x50(%rbp)
movq 0x28(%rbx), %rax
movq %rax, -0x48(%rbp)
movq 0x30(%rbx), %rax
movq %rax, -0x40(%rbp)
testq %rax, %rax
movq %r12, %r15
movq %r14, %r12
movq -0xb8(%rbp), %r14
je 0x38e0
movq 0xb6ee(%rip), %rcx      # 0xefc0
cmpb $0x0, (%rcx)
je 0x38dc
incl 0x8(%rax)
jmp 0x38e0
lock
incl 0x8(%rax)
cmpl $0x2, -0x50(%rbp)
jne 0x3961
movq %r13, %rdi
leaq 0x7813(%rip), %rsi      # 0xb103
callq 0x9336
testl %eax, %eax
je 0x3b49
movq %r13, %rdi
leaq 0x77fe(%rip), %rsi      # 0xb105
callq 0x9336
testl %eax, %eax
je 0x3925
movq -0xa8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
je 0x3961
jmp 0x3b73
movslq -0x2c(%rbp), %rax
incq %rax
movl %eax, -0x2c(%rbp)
imulq $0x38, %rax, %rbx
addq (%r14), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8d70
movq 0x20(%rbx), %rax
movq %rax, -0x50(%rbp)
movq 0x28(%rbx), %rax
movq %rax, -0x48(%rbp)
addq $0x30, %rbx
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x6fac
movq %r12, %rdi
movq %r14, %rsi
callq 0x693c
movl -0x2c(%rbp), %edx
leaq -0x1c0(%rbp), %rdi
movq %r12, %rsi
callq 0x3ed8
movq %r12, %rdi
callq 0x67c8
movq -0x1b8(%rbp), %rbx
testq %rbx, %rbx
je 0x39c5
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x38(%rbp), %rdi
movq %r15, %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x1c0(%rbp), %rcx
callq 0x713c
movq %r15, %rdi
callq 0x6896
jmp 0x39e1
leaq -0xb0(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x69de
movl -0x1a0(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpb $0x1, -0x108(%rbp)
jne 0x39fd
movb $0x0, -0x108(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x727c
cmpb $0x1, -0x140(%rbp)
jne 0x3a19
movb $0x0, -0x140(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x6896
cmpb $0x1, -0x178(%rbp)
jne 0x3a4b
movb $0x0, -0x178(%rbp)
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0x3a4b
movq -0x188(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0x3a6d
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3a7b
callq 0x6ff2
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3a94
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21c0
testq %rbx, %rbx
je 0x384f
jmp 0x3d85
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x766a(%rip), %rsi      # 0xb12d
leaq 0x7685(%rip), %rdx      # 0xb14f
leaq -0xd8(%rbp), %rdi
callq 0x8c74
movslq -0x2c(%rbp), %rax
movq (%r14), %r14
imulq $0x38, %rax, %r12
leaq -0x1e8(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%r14,%r12), %rsi
movq 0x8(%r14,%r12), %rdx
addq %rsi, %rdx
leaq -0x1f8(%rbp), %rdi
callq 0x853e
addq %r12, %r14
movq 0x20(%r14), %rax
movq %rax, -0x1d8(%rbp)
movq 0x28(%r14), %rax
movq %rax, -0x1d0(%rbp)
movq 0x30(%r14), %rax
movq %rax, -0x1c8(%rbp)
testq %rax, %rax
je 0x3c07
movq 0xb488(%rip), %rcx      # 0xefc0
cmpb $0x0, (%rcx)
je 0x3c03
incl 0x8(%rax)
jmp 0x3c07
movl -0x2c(%rbp), %eax
incl %eax
leaq -0x1c0(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x76a9(%rip), %rcx      # 0xb207
leaq -0xb0(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x70c4
jmp 0x3d5e
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
movq $0x0, -0x80(%rbp)
leaq -0xe8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x7570(%rip), %rsi      # 0xb107
leaq 0x758e(%rip), %rdx      # 0xb12c
leaq -0xf8(%rbp), %rdi
callq 0x8c74
leaq -0x220(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x230(%rbp), %rdi
callq 0x853e
movups -0x50(%rbp), %xmm0
movups %xmm0, -0x210(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x200(%rbp)
testq %rax, %rax
je 0x3cb4
movq 0xb3ce(%rip), %rcx      # 0xefc0
cmpb $0x0, (%rcx)
je 0x3cb0
incl 0x8(%rax)
jmp 0x3cb4
lock
incl 0x8(%rax)
leaq -0x1c0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0x1f8(%rbp), %rdx
callq 0x35ed
leaq -0x70(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x1c0(%rbp), %rcx
movq -0x38(%rbp), %rdi
callq 0x713c
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0x3c5b
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x1c8(%rbp), %rdi
testq %rdi, %rdi
je 0x3c6c
callq 0x6ff2
movq -0x1f8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3c87
movq -0x1e8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x3ca2
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x70(%rbp), %rdi
callq 0x6896
jmp 0x3d85
lock
incl 0x8(%rax)
leaq -0x1c0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0x230(%rbp), %rdx
callq 0x35ed
leaq -0x90(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x1c0(%rbp), %rcx
movq -0x38(%rbp), %rdi
callq 0x713c
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0x3d0b
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x200(%rbp), %rdi
testq %rdi, %rdi
je 0x3d1c
callq 0x6ff2
movq -0x230(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3d37
movq -0x220(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d52
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x90(%rbp), %rdi
callq 0x6896
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3d6c
callq 0x6ff2
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3d85
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0xb0(%rbp), %rdi
callq 0x6896
movq -0x38(%rbp), %rax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0x3dd1
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3dd1
movq %rax, %rbx
leaq -0x230(%rbp), %rdi
callq 0x678c
jmp 0x3de2
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3e02
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3e02
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x6896
jmp 0x3eb6
jmp 0x3ea2
movq %rax, %rbx
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0x3e42
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3e42
movq %rax, %rbx
leaq -0x1f8(%rbp), %rdi
callq 0x678c
jmp 0x3e53
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x3e73
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3e73
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x6896
jmp 0x3ec4
jmp 0x3ea2
movq %rax, %rbx
jmp 0x3e94
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x6896
leaq -0x1c0(%rbp), %rdi
callq 0x6a1c
jmp 0x3eb6
movq %rax, %rbx
jmp 0x3eb6
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
callq 0x67c8
leaq -0x70(%rbp), %rdi
callq 0x678c
jmp 0x3ec4
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x6896
movq %rbx, %rdi
callq 0x2290