// File: /workspace/github_cpp_makefile_star2_O1/eatonphil[P]cpp-json/json.cpp
// Function: json::parse[abi:cxx11](std::vector<json::JSONToken, std::allocator<json::JSONToken>>, int)
std::tuple<JSONValue, int, std::string> parse(std::vector<JSONToken> tokens,
                                              int index) {
  auto token = tokens[index];
  switch (token.type) {
  case JSONTokenType::Number: {
    auto n = std::stod(token.value);
    return {JSONValue{.number = n, .type = JSONValueType::Number}, index + 1,
            ""};
  }
  case JSONTokenType::Boolean:
    return {JSONValue{.boolean = token.value == "true",
                      .type = JSONValueType::Boolean},
            index + 1, ""};
  case JSONTokenType::Null:
    return {JSONValue{.type = JSONValueType::Null}, index + 1, ""};
  case JSONTokenType::String:
    return {JSONValue{.string = token.value, .type = JSONValueType::String},
            index + 1, ""};
  case JSONTokenType::Syntax:
    if (token.value == "[") {
      auto [array, new_index, error] = parse_array(tokens, index + 1);
      return {JSONValue{.array = array, .type = JSONValueType::Array},
              new_index, error};
    }

    if (token.value == "{") {
      auto [object, new_index, error] = parse_object(tokens, index + 1);
      return {JSONValue{.object = std::optional(object),
                        .type = JSONValueType::Object},
              new_index, error};
    }
  }

  return {{}, index, format_parse_error("Failed to parse", token)};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %r14
movq %rdi, %rbx
movl %edx, -0x2c(%rbp)
movslq %edx, %rax
movq (%rsi), %r12
imulq $0x38, %rax, %r13
leaq -0xf8(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r12,%r13), %rsi
movq 0x8(%r12,%r13), %rdx
addq %rsi, %rdx
leaq -0x108(%rbp), %r15
movq %r15, %rdi
callq 0x853e
movq 0x20(%r12,%r13), %rax
movq %rax, 0x20(%r15)
movq 0x28(%r12,%r13), %rax
movq %rax, 0x28(%r15)
movq 0x30(%r12,%r13), %rax
movq %rax, 0x30(%r15)
testq %rax, %rax
je 0x3f5a
movq 0xb074(%rip), %rcx      # 0xefc0
cmpb $0x0, (%rcx)
je 0x3f56
incl 0x8(%rax)
jmp 0x3f5a
lock
incl 0x8(%rax)
movl -0xe8(%rbp), %eax
cmpq $0x4, %rax
ja 0x40b4
leaq 0x70a7(%rip), %rcx      # 0xb018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0xc0(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x853e
leaq -0xd0(%rbp), %rsi
movb $0x1, 0x20(%rsi)
xorl %eax, %eax
movb %al, 0x30(%rsi)
movb %al, 0x39(%rsi)
movb %al, 0x58(%rsi)
movb %al, 0x90(%rsi)
movl $0x0, 0x98(%rsi)
movl -0x2c(%rbp), %eax
incl %eax
leaq -0x160(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x722a(%rip), %rcx      # 0xb207
movq %rbx, %rdi
callq 0x8038
cmpb $0x1, -0x40(%rbp)
jne 0x3ff8
leaq -0x70(%rbp), %rdi
movb $0x0, 0x30(%rdi)
callq 0x727c
cmpb $0x1, -0x78(%rbp)
jne 0x400e
leaq -0x90(%rbp), %rdi
movb $0x0, 0x18(%rdi)
callq 0x6896
cmpb $0x1, -0xb0(%rbp)
jne 0x4462
movb $0x0, -0xb0(%rbp)
movq -0xd0(%rbp), %rdi
cmpq %r14, %rdi
jne 0x4453
jmp 0x4462
xorl %eax, %eax
leaq -0xd0(%rbp), %rsi
movb %al, 0x20(%rsi)
movb %al, 0x30(%rsi)
movb %al, 0x39(%rsi)
movb %al, 0x58(%rsi)
movb %al, 0x90(%rsi)
movl $0x5, 0x98(%rsi)
movl -0x2c(%rbp), %eax
incl %eax
leaq -0x160(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x7196(%rip), %rcx      # 0xb207
movq %rbx, %rdi
callq 0x8038
jmp 0x440d
leaq 0x716a(%rip), %rsi      # 0xb1ef
leaq -0x108(%rbp), %rdi
callq 0x9336
testl %eax, %eax
je 0x4267
leaq 0x7151(%rip), %rsi      # 0xb1f1
leaq -0x108(%rbp), %rdi
callq 0x9336
testl %eax, %eax
je 0x44aa
xorl %eax, %eax
movb %al, -0xb0(%rbp)
movb %al, -0xa0(%rbp)
movb %al, -0x97(%rbp)
movb %al, -0x78(%rbp)
movb %al, -0x40(%rbp)
movl $0x0, -0x38(%rbp)
leaq -0x170(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x710c(%rip), %rsi      # 0xb1f3
leaq 0x7114(%rip), %rdx      # 0xb202
leaq -0x180(%rbp), %rdi
callq 0x8c74
leaq -0x1d8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1e8(%rbp), %rdi
callq 0x853e
movups -0xe8(%rbp), %xmm0
movups %xmm0, -0x1c8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x1b8(%rbp)
testq %rax, %rax
je 0x4373
movq 0xae72(%rip), %rcx      # 0xefc0
cmpb $0x0, (%rcx)
je 0x436f
incl 0x8(%rax)
jmp 0x4373
xorl %r15d, %r15d
leaq -0xd0(%rbp), %r14
movb %r15b, 0x20(%r14)
movb %r15b, 0x30(%r14)
leaq 0x6f4b(%rip), %rsi      # 0xb0c3
leaq -0x108(%rbp), %rdi
callq 0x9336
testl %eax, %eax
sete 0x38(%r14)
movb $0x1, 0x39(%r14)
movb %r15b, 0x58(%r14)
movb %r15b, 0x90(%r14)
movl $0x4, 0x98(%r14)
movl -0x2c(%rbp), %eax
incl %eax
leaq -0x160(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x704c(%rip), %rcx      # 0xb207
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8038
jmp 0x440d
movq -0x108(%rbp), %r15
callq 0x2040
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
leaq -0xd0(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2160
cmpq %r15, (%r12)
je 0x45cf
movl (%r14), %eax
testl %eax, %eax
je 0x4217
cmpl $0x22, %eax
jne 0x421a
leaq 0x7011(%rip), %rdi      # 0xb223
callq 0x2210
movl %r13d, (%r14)
xorl %eax, %eax
leaq -0xd0(%rbp), %rsi
movb %al, 0x20(%rsi)
movsd %xmm0, 0x28(%rsi)
movb $0x1, 0x30(%rsi)
movb %al, 0x39(%rsi)
movb %al, 0x58(%rsi)
movb %al, 0x90(%rsi)
movl $0x1, 0x98(%rsi)
movl -0x2c(%rbp), %eax
incl %eax
leaq -0x160(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x6fad(%rip), %rcx      # 0xb207
movq %rbx, %rdi
callq 0x8038
jmp 0x440d
leaq -0x1b0(%rbp), %rdi
movq %r14, %rsi
callq 0x693c
movl -0x2c(%rbp), %edx
incl %edx
leaq -0x160(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x3800
leaq -0x1b0(%rbp), %rdi
callq 0x67c8
leaq -0x138(%rbp), %r14
xorl %eax, %eax
leaq -0x90(%rbp), %r15
movb %al, -0x20(%r15)
movb %al, -0x10(%r15)
movb %al, -0x7(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x6ce4
movb $0x1, -0x78(%rbp)
movb $0x0, -0x40(%rbp)
movl $0x3, -0x38(%rbp)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x853e
movl -0x140(%rbp), %eax
movl %eax, 0x20(%rbx)
leaq 0x28(%rbx), %rdi
leaq -0xd0(%rbp), %r12
movq %r12, %rsi
callq 0x808c
cmpb $0x1, 0x90(%r12)
jne 0x4324
leaq -0x70(%rbp), %rdi
movb $0x0, 0x30(%rdi)
callq 0x727c
cmpb $0x1, -0x78(%rbp)
jne 0x4336
movb $0x0, -0x78(%rbp)
movq %r15, %rdi
callq 0x6896
cmpb $0x1, -0xb0(%rbp)
jne 0x4362
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4362
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x6896
jmp 0x45af
lock
incl 0x8(%rax)
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
leaq -0x1e8(%rbp), %rdx
callq 0x35ed
leaq -0xd0(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x160(%rbp), %rcx
movq %rbx, %rdi
callq 0x81d2
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43c6
movq -0x150(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x1b8(%rbp), %rdi
testq %rdi, %rdi
je 0x43d7
callq 0x6ff2
movq -0x1e8(%rbp), %rdi
cmpq %r15, %rdi
je 0x43f2
movq -0x1d8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x180(%rbp), %rdi
cmpq %r14, %rdi
je 0x440d
movq -0x170(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpb $0x1, -0x40(%rbp)
jne 0x4420
leaq -0x70(%rbp), %rdi
movb $0x0, 0x30(%rdi)
callq 0x727c
cmpb $0x1, -0x78(%rbp)
jne 0x4436
leaq -0x90(%rbp), %rdi
movb $0x0, 0x18(%rdi)
callq 0x6896
cmpb $0x1, -0xb0(%rbp)
jne 0x4462
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4462
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x4473
callq 0x6ff2
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x4495
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x198(%rbp), %rdi
movq %r14, %rsi
callq 0x693c
movl -0x2c(%rbp), %edx
incl %edx
leaq -0x160(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x4743
leaq -0x198(%rbp), %rdi
callq 0x67c8
leaq -0x138(%rbp), %r14
xorl %eax, %eax
leaq -0x90(%rbp), %r15
movb %al, -0x20(%r15)
movb %al, -0x10(%r15)
movb %al, -0x7(%r15)
movb %al, 0x18(%r15)
leaq -0x70(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x8624
movb $0x1, -0x40(%rbp)
movl $0x2, -0x38(%rbp)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x853e
movl -0x140(%rbp), %eax
movl %eax, 0x20(%rbx)
leaq 0x28(%rbx), %rdi
leaq -0xd0(%rbp), %r13
movq %r13, %rsi
callq 0x808c
cmpb $0x1, 0x90(%r13)
jne 0x4569
movb $0x0, -0x40(%rbp)
movq %r12, %rdi
callq 0x727c
cmpb $0x1, -0x78(%rbp)
jne 0x457b
movb $0x0, -0x78(%rbp)
movq %r15, %rdi
callq 0x6896
cmpb $0x1, -0xb0(%rbp)
jne 0x45a7
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x45a7
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x727c
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4462
movq -0x150(%rbp), %rsi
jmp 0x445a
leaq 0x6c4d(%rip), %rdi      # 0xb223
callq 0x2110
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x6b20
jmp 0x462d
movq %rax, %rbx
cmpb $0x1, -0x78(%rbp)
jne 0x4601
movb $0x0, -0x78(%rbp)
movq %r15, %rdi
callq 0x6896
cmpb $0x1, -0xb0(%rbp)
jne 0x462d
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x462d
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x160(%rbp), %rdi
callq 0x6be6
jmp 0x4721
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
jmp 0x46a7
jmp 0x46b4
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x6b20
jmp 0x468c
movq %rax, %rbx
cmpb $0x1, -0xb0(%rbp)
jne 0x468c
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x468c
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x160(%rbp), %rdi
callq 0x6bb0
jmp 0x4721
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x67c8
jmp 0x4721
jmp 0x46b4
jmp 0x4712
jmp 0x4712
movq %rax, %rbx
jmp 0x4721
jmp 0x4712
jmp 0x4712
movq %rax, %rbx
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x46e4
movq -0x150(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x46e4
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x678c
jmp 0x46f5
movq %rax, %rbx
movq -0x180(%rbp), %rdi
cmpq %r14, %rdi
je 0x4715
movq -0x170(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x4715
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x6b20
leaq -0x108(%rbp), %rdi
callq 0x678c
movq %rbx, %rdi
callq 0x2290
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x4721
movl %r13d, (%r14)
jmp 0x4721