// File: /workspace/github_cpp_makefile_star2_O2/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 $0x218, %rsp            # imm = 0x218
movq %rsi, %r14
movq %rdi, -0x38(%rbp)
leaq -0x2c(%rbp), %rax
movl %edx, (%rax)
xorps %xmm0, %xmm0
leaq -0x70(%rbp), %rax
andq $0x0, 0x10(%rax)
movaps %xmm0, (%rax)
leaq -0xb0(%rbp), %r12
leaq -0x108(%rbp), %r15
leaq -0x240(%rbp), %r13
movslq -0x2c(%rbp), %rcx
movq (%r14), %rsi
movq 0x8(%r14), %rax
subq %rsi, %rax
cqto
pushq $0x38
popq %rdi
idivq %rdi
cmpq %rcx, %rax
jbe 0x4270
imulq $0x38, %rcx, %rax
addq %rax, %rsi
movq %r12, %rdi
callq 0x5956
cmpl $0x2, -0x90(%rbp)
jne 0x41c5
movq %r12, %rdi
leaq 0x4f87(%rip), %rsi      # 0x9103
callq 0x5987
testb %al, %al
jne 0x431a
movq %r12, %rdi
leaq 0x4f72(%rip), %rsi      # 0x9105
callq 0x5987
testb %al, %al
je 0x41b7
movslq -0x2c(%rbp), %rax
incq %rax
movl %eax, -0x2c(%rbp)
imulq $0x38, %rax, %rsi
addq (%r14), %rsi
movq %r12, %rdi
callq 0x5998
jmp 0x41c5
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
jne 0x4341
movq %r15, %rdi
movq %r14, %rsi
callq 0x59f6
movl -0x2c(%rbp), %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x44df
movq %r15, %rdi
callq 0x58ce
movq -0x238(%rbp), %rbx
testq %rbx, %rbx
je 0x4239
movq %rbx, -0x78(%rbp)
movq %r13, %rcx
movq %r14, %rbx
movq %r12, %r14
movq %r15, %r12
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
leaq -0x2c(%rbp), %rdx
callq 0x626a
movq %r15, %rdi
callq 0x59ca
movq %r12, %r15
movq %r14, %r12
movq %rbx, %r14
movq -0x78(%rbp), %rbx
jmp 0x4252
leaq -0x70(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x5a50
movl -0x220(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r13, %rdi
callq 0x5a8e
movq %r12, %rdi
callq 0x5870
testq %rbx, %rbx
je 0x413b
jmp 0x43e2
xorps %xmm0, %xmm0
movaps %xmm0, -0xb0(%rbp)
andq $0x0, -0xa0(%rbp)
leaq 0x4ea4(%rip), %rsi      # 0x912d
leaq -0xd0(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x5820
movslq -0x2c(%rbp), %rax
imulq $0x38, %rax, %rsi
addq (%r14), %rsi
leaq -0x140(%rbp), %rdi
callq 0x5956
leaq -0x240(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x140(%rbp), %rdx
callq 0x3fb8
leaq -0xb0(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x240(%rbp), %rcx
movq -0x38(%rbp), %rdi
callq 0x626a
leaq -0x240(%rbp), %rdi
callq 0x585c
leaq -0x140(%rbp), %rdi
callq 0x5870
leaq -0xd0(%rbp), %rdi
callq 0x585c
leaq -0xb0(%rbp), %rdi
callq 0x59ca
jmp 0x43e2
movl -0x2c(%rbp), %eax
incl %eax
leaq -0x240(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x4ed8(%rip), %rcx      # 0x9207
leaq -0x70(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x620e
jmp 0x43d6
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
leaq 0x4db3(%rip), %rsi      # 0x9107
leaq -0xf0(%rbp), %rdi
leaq -0x2d(%rbp), %rdx
callq 0x5820
leaq -0x178(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x5956
leaq -0x240(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0x178(%rbp), %rdx
callq 0x3fb8
leaq -0x50(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x240(%rbp), %rcx
movq -0x38(%rbp), %rdi
callq 0x626a
leaq -0x240(%rbp), %rdi
callq 0x585c
leaq -0x178(%rbp), %rdi
callq 0x5870
leaq -0xf0(%rbp), %rdi
callq 0x585c
leaq -0x50(%rbp), %rdi
callq 0x59ca
leaq -0xb0(%rbp), %rdi
callq 0x5870
leaq -0x70(%rbp), %rdi
callq 0x59ca
movq -0x38(%rbp), %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
callq 0x585c
jmp 0x4415
movq %rax, %rbx
leaq -0x178(%rbp), %rdi
callq 0x5870
jmp 0x4426
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x585c
jmp 0x4437
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x59ca
jmp 0x44bd
jmp 0x44a9
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
callq 0x585c
jmp 0x4458
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x5870
jmp 0x4469
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x585c
jmp 0x447a
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x59ca
jmp 0x44ce
jmp 0x44a9
movq %rax, %rbx
jmp 0x449b
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x59ca
leaq -0x240(%rbp), %rdi
callq 0x5a8e
jmp 0x44bd
movq %rax, %rbx
jmp 0x44bd
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x58ce
leaq -0xb0(%rbp), %rdi
callq 0x5870
jmp 0x44ce
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x59ca
movq %rbx, %rdi
callq 0x3260