// File: /workspace/github_cpp_makefile_star2_O3/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 0x84f0
movq 0x20(%r12,%r13), %rax
movq %rax, 0x20(%r15)
movq 0x28(%r12,%r13), %rcx
movq %rcx, 0x28(%r15)
movq 0x30(%r12,%r13), %rcx
movq %rcx, 0x30(%r15)
testq %rcx, %rcx
je 0x3f2d
movq 0xb0a7(%rip), %rdx      # 0xefc0
cmpb $0x0, (%rdx)
je 0x3f23
incl 0x8(%rcx)
jmp 0x3f2d
lock
incl 0x8(%rcx)
movl -0xe8(%rbp), %eax
cmpl $0x4, %eax
ja 0x4082
movl %eax, %eax
leaq 0x70d9(%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 0x84f0
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 0x725c(%rip), %rcx      # 0xb207
movq %rbx, %rdi
callq 0x7ff2
cmpb $0x1, -0x40(%rbp)
jne 0x3fc6
leaq -0x70(%rbp), %rdi
movb $0x0, 0x30(%rdi)
callq 0x722c
cmpb $0x1, -0x78(%rbp)
jne 0x3fdc
leaq -0x90(%rbp), %rdi
movb $0x0, 0x18(%rdi)
callq 0x683e
cmpb $0x1, -0xb0(%rbp)
jne 0x4430
movb $0x0, -0xb0(%rbp)
movq -0xd0(%rbp), %rdi
cmpq %r14, %rdi
jne 0x4421
jmp 0x4430
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 0x71c8(%rip), %rcx      # 0xb207
movq %rbx, %rdi
callq 0x7ff2
jmp 0x43db
leaq 0x719c(%rip), %rsi      # 0xb1ef
leaq -0x108(%rbp), %rdi
callq 0x92f8
testl %eax, %eax
je 0x4235
leaq 0x7183(%rip), %rsi      # 0xb1f1
leaq -0x108(%rbp), %rdi
callq 0x92f8
testl %eax, %eax
je 0x4478
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 0x713e(%rip), %rsi      # 0xb1f3
leaq 0x7146(%rip), %rdx      # 0xb202
leaq -0x180(%rbp), %rdi
callq 0x8c32
leaq -0x1d8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1e8(%rbp), %rdi
callq 0x84f0
movups -0xe8(%rbp), %xmm0
movups %xmm0, -0x1c8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x1b8(%rbp)
testq %rax, %rax
je 0x4341
movq 0xaea4(%rip), %rcx      # 0xefc0
cmpb $0x0, (%rcx)
je 0x433d
incl 0x8(%rax)
jmp 0x4341
xorl %r15d, %r15d
leaq -0xd0(%rbp), %r14
movb %r15b, 0x20(%r14)
movb %r15b, 0x30(%r14)
leaq 0x6f7d(%rip), %rsi      # 0xb0c3
leaq -0x108(%rbp), %rdi
callq 0x92f8
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 0x707e(%rip), %rcx      # 0xb207
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ff2
jmp 0x43db
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 0x459d
movl (%r14), %eax
testl %eax, %eax
je 0x41e5
cmpl $0x22, %eax
jne 0x41e8
leaq 0x7043(%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 0x6fdf(%rip), %rcx      # 0xb207
movq %rbx, %rdi
callq 0x7ff2
jmp 0x43db
leaq -0x1b0(%rbp), %rdi
movq %r14, %rsi
callq 0x68e8
movl -0x2c(%rbp), %edx
incl %edx
leaq -0x160(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x37c0
leaq -0x1b0(%rbp), %rdi
callq 0x6770
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 0x6c90
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 0x84f0
movl -0x140(%rbp), %eax
movl %eax, 0x20(%rbx)
leaq 0x28(%rbx), %rdi
leaq -0xd0(%rbp), %r12
movq %r12, %rsi
callq 0x8046
cmpb $0x1, 0x90(%r12)
jne 0x42f2
leaq -0x70(%rbp), %rdi
movb $0x0, 0x30(%rdi)
callq 0x722c
cmpb $0x1, -0x78(%rbp)
jne 0x4304
movb $0x0, -0x78(%rbp)
movq %r15, %rdi
callq 0x683e
cmpb $0x1, -0xb0(%rbp)
jne 0x4330
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4330
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x683e
jmp 0x457d
lock
incl 0x8(%rax)
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
leaq -0x1e8(%rbp), %rdx
callq 0x35ad
leaq -0xd0(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x160(%rbp), %rcx
movq %rbx, %rdi
callq 0x8184
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4394
movq -0x150(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x1b8(%rbp), %rdi
testq %rdi, %rdi
je 0x43a5
callq 0x6fa2
movq -0x1e8(%rbp), %rdi
cmpq %r15, %rdi
je 0x43c0
movq -0x1d8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x180(%rbp), %rdi
cmpq %r14, %rdi
je 0x43db
movq -0x170(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpb $0x1, -0x40(%rbp)
jne 0x43ee
leaq -0x70(%rbp), %rdi
movb $0x0, 0x30(%rdi)
callq 0x722c
cmpb $0x1, -0x78(%rbp)
jne 0x4404
leaq -0x90(%rbp), %rdi
movb $0x0, 0x18(%rdi)
callq 0x683e
cmpb $0x1, -0xb0(%rbp)
jne 0x4430
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4430
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x4441
callq 0x6fa2
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x4463
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 0x68e8
movl -0x2c(%rbp), %edx
incl %edx
leaq -0x160(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x4711
leaq -0x198(%rbp), %rdi
callq 0x6770
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 0x85d8
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 0x84f0
movl -0x140(%rbp), %eax
movl %eax, 0x20(%rbx)
leaq 0x28(%rbx), %rdi
leaq -0xd0(%rbp), %r13
movq %r13, %rsi
callq 0x8046
cmpb $0x1, 0x90(%r13)
jne 0x4537
movb $0x0, -0x40(%rbp)
movq %r12, %rdi
callq 0x722c
cmpb $0x1, -0x78(%rbp)
jne 0x4549
movb $0x0, -0x78(%rbp)
movq %r15, %rdi
callq 0x683e
cmpb $0x1, -0xb0(%rbp)
jne 0x4575
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4575
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x722c
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4430
movq -0x150(%rbp), %rsi
jmp 0x4428
leaq 0x6c7f(%rip), %rdi      # 0xb223
callq 0x2110
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x6acc
jmp 0x45fb
movq %rax, %rbx
cmpb $0x1, -0x78(%rbp)
jne 0x45cf
movb $0x0, -0x78(%rbp)
movq %r15, %rdi
callq 0x683e
cmpb $0x1, -0xb0(%rbp)
jne 0x45fb
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x45fb
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x160(%rbp), %rdi
callq 0x6b92
jmp 0x46ef
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
jmp 0x4675
jmp 0x4682
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x6acc
jmp 0x465a
movq %rax, %rbx
cmpb $0x1, -0xb0(%rbp)
jne 0x465a
leaq -0xc0(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x465a
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x160(%rbp), %rdi
callq 0x6b5c
jmp 0x46ef
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x6770
jmp 0x46ef
jmp 0x4682
jmp 0x46e0
jmp 0x46e0
movq %rax, %rbx
jmp 0x46ef
jmp 0x46e0
jmp 0x46e0
movq %rax, %rbx
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x46b2
movq -0x150(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x46b2
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x6734
jmp 0x46c3
movq %rax, %rbx
movq -0x180(%rbp), %rdi
cmpq %r14, %rdi
je 0x46e3
movq -0x170(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x46e3
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x6acc
leaq -0x108(%rbp), %rdi
callq 0x6734
movq %rbx, %rdi
callq 0x2290
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x46ef
movl %r13d, (%r14)
jmp 0x46ef