// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml.c
// Function: parse_select
static int parse_select(context_t *ctx) {
  assert(ctx->tok.tok == LBRACKET);

  /* true if [[ */
  int llb = (ctx->tok.ptr + 1 < ctx->stop && ctx->tok.ptr[1] == '[');
  /* need to detect '[[' on our own because next_token() will skip whitespace,
     and '[ [' would be taken as '[[', which is wrong. */

  /* eat [ or [[ */
  if (eat_token(ctx, LBRACKET, 1, FLINE))
    return -1;
  if (llb) {
    assert(ctx->tok.tok == LBRACKET);
    if (eat_token(ctx, LBRACKET, 1, FLINE))
      return -1;
  }

  if (fill_tabpath(ctx))
    return -1;

  /* For [x.y.z] or [[x.y.z]], remove z from tpath.
   */
  token_t z = ctx->tpath.tok[ctx->tpath.top - 1];
  xfree(ctx->tpath.key[ctx->tpath.top - 1]);
  ctx->tpath.top--;

  /* set up ctx->curtab */
  if (walk_tabpath(ctx))
    return -1;

  if (!llb) {
    /* [x.y.z] -> create z = {} in x.y */
    toml_table_t *curtab = create_keytable_in_table(ctx, ctx->curtab, z);
    if (!curtab)
      return -1;
    ctx->curtab = curtab;
  } else {
    /* [[x.y.z]] -> create z = [] in x.y */
    toml_array_t *arr = 0;
    {
      char *zstr = normalize_key(ctx, z);
      if (!zstr)
        return -1;
      arr = toml_array_in(ctx->curtab, zstr);
      xfree(zstr);
    }
    if (!arr) {
      arr = create_keyarray_in_table(ctx, ctx->curtab, z, 't');
      if (!arr)
        return -1;
    }
    if (arr->kind != 't')
      return e_syntax(ctx, z.lineno, "array mismatch");

    /* add to z[] */
    toml_table_t *dest;
    {
      toml_table_t *t = create_table_in_array(ctx, arr);
      if (!t)
        return -1;

      if (0 == (t->key = STRDUP("__anon__")))
        return e_outofmemory(ctx, FLINE);

      dest = t;
    }

    ctx->curtab = dest;
  }

  if (ctx->tok.tok != RBRACKET) {
    return e_syntax(ctx, ctx->tok.lineno, "expects ]");
  }
  if (llb) {
    if (!(ctx->tok.ptr + 1 < ctx->stop && ctx->tok.ptr[1] == ']')) {
      return e_syntax(ctx, ctx->tok.lineno, "expects ]]");
    }
    if (eat_token(ctx, RBRACKET, 1, FLINE))
      return -1;
  }

  if (eat_token(ctx, RBRACKET, 1, FLINE))
    return -1;

  if (ctx->tok.tok != NEWLINE)
    return e_syntax(ctx, ctx->tok.lineno, "extra chars after ] or ]]");

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x7, 0x20(%rax)
jne 0x30db
jmp 0x30fa
leaq 0x53ff(%rip), %rdi      # 0x84e1
leaq 0x5246(%rip), %rsi      # 0x832f
movl $0x521, %edx            # imm = 0x521
leaq 0x5405(%rip), %rcx      # 0x84fa
callq 0x10f0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq -0x10(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x59(%rbp)
jae 0x312a
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x5b, %eax
sete %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl $0x7, %esi
movl $0x1, %edx
leaq 0x53ce(%rip), %rcx      # 0x8518
callq 0x3060
cmpl $0x0, %eax
je 0x3160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
cmpl $0x0, -0x14(%rbp)
je 0x31be
movq -0x10(%rbp), %rax
cmpl $0x7, 0x20(%rax)
jne 0x3172
jmp 0x3191
leaq 0x5368(%rip), %rdi      # 0x84e1
leaq 0x51af(%rip), %rsi      # 0x832f
movl $0x52c, %edx            # imm = 0x52C
leaq 0x536e(%rip), %rcx      # 0x84fa
callq 0x10f0
movq -0x10(%rbp), %rdi
movl $0x7, %esi
movl $0x1, %edx
leaq 0x537e(%rip), %rcx      # 0x8524
callq 0x3060
cmpl $0x0, %eax
je 0x31bc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
jmp 0x31be
movq -0x10(%rbp), %rdi
callq 0x6d10
cmpl $0x0, %eax
je 0x31d8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
movq -0x10(%rbp), %rax
addq $0x48, %rax
addq $0x58, %rax
movq -0x10(%rbp), %rcx
movl 0x48(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x48(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq 0x50(%rax,%rcx,8), %rdi
callq 0x3500
movq -0x10(%rbp), %rax
movl 0x48(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x48(%rax)
movq -0x10(%rbp), %rdi
callq 0x6f10
cmpl $0x0, %eax
je 0x3251
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
cmpl $0x0, -0x14(%rbp)
jne 0x32ad
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x5c20
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x329c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x33f5
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x59c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x32f2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x48(%rbp), %rsi
callq 0x3b00
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rdi
callq 0x3500
cmpq $0x0, -0x40(%rbp)
jne 0x3363
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x30(%rbp), %rax
movl $0x74, %edx
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x5fc0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x3361
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
jmp 0x3363
movq -0x40(%rbp), %rax
cmpl $0x74, 0x8(%rax)
je 0x3388
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq 0x51b5(%rip), %rdx      # 0x8530
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x34e6
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x6b80
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x33ac
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
leaq 0x518c(%rip), %rdi      # 0x853f
callq 0x7160
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x33e1
movq -0x10(%rbp), %rdi
leaq 0x5174(%rip), %rsi      # 0x8548
callq 0x2910
movl %eax, -0x4(%rbp)
jmp 0x34e6
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
cmpl $0x8, 0x20(%rax)
je 0x341e
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x24(%rax), %esi
leaq 0x5143(%rip), %rdx      # 0x8554
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x34e6
cmpl $0x0, -0x14(%rbp)
je 0x3491
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x1, %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x344b
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x5d, %eax
je 0x3467
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x24(%rax), %esi
leaq 0x5101(%rip), %rdx      # 0x855e
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x34e6
movq -0x10(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
leaq 0x50ed(%rip), %rcx      # 0x8569
callq 0x3060
cmpl $0x0, %eax
je 0x348f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
jmp 0x3491
movq -0x10(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
leaq 0x50cf(%rip), %rcx      # 0x8575
callq 0x3060
cmpl $0x0, %eax
je 0x34b9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34e6
movq -0x10(%rbp), %rax
cmpl $0x6, 0x20(%rax)
je 0x34df
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x24(%rax), %esi
leaq 0x50ac(%rip), %rdx      # 0x8581
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x34e6
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)