// File: /workspace/github_c_makefile_star2_O3/cktan[P]tomlc99/toml.c
// Function: toml_parse
toml_table_t *toml_parse(char *conf, char *errbuf, int errbufsz) {
  context_t ctx;

  // clear errbuf
  if (errbufsz <= 0)
    errbufsz = 0;
  if (errbufsz > 0)
    errbuf[0] = 0;

  // init context
  memset(&ctx, 0, sizeof(ctx));
  ctx.start = conf;
  ctx.stop = ctx.start + strlen(conf);
  ctx.errbuf = errbuf;
  ctx.errbufsz = errbufsz;

  // start with an artificial newline of length 0
  ctx.tok.tok = NEWLINE;
  ctx.tok.lineno = 1;
  ctx.tok.ptr = conf;
  ctx.tok.len = 0;

  // make a root table
  if (0 == (ctx.root = CALLOC(1, sizeof(*ctx.root)))) {
    e_outofmemory(&ctx, FLINE);
    // Do not goto fail, root table not set up yet
    return 0;
  }

  // set root as default table
  ctx.curtab = ctx.root;

  /* Scan forward until EOF */
  for (token_t tok = ctx.tok; !tok.eof; tok = ctx.tok) {
    switch (tok.tok) {

    case NEWLINE:
      if (next_token(&ctx, 1))
        goto fail;
      break;

    case STRING:
      if (parse_keyval(&ctx, ctx.curtab))
        goto fail;

      if (ctx.tok.tok != NEWLINE) {
        e_syntax(&ctx, ctx.tok.lineno, "extra chars after value");
        goto fail;
      }

      if (eat_token(&ctx, NEWLINE, 1, FLINE))
        goto fail;
      break;

    case LBRACKET: /* [ x.y.z ] or [[ x.y.z ]] */
      if (parse_select(&ctx))
        goto fail;
      break;

    default:
      e_syntax(&ctx, tok.lineno, "syntax error");
      goto fail;
    }
  }

  /* success */
  for (int i = 0; i < ctx.tpath.top; i++)
    xfree(ctx.tpath.key[i]);
  return ctx.root;

fail:
  // Something bad has happened. Free resources and return error.
  for (int i = 0; i < ctx.tpath.top; i++)
    xfree(ctx.tpath.key[i]);
  toml_free(ctx.root);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
testl %edx, %edx
cmovgl %edx, %ebp
jle 0x20b1
movb $0x0, (%rbx)
leaq 0x80(%rsp), %r15
movl $0x178, %edx            # imm = 0x178
movq %r15, %rdi
xorl %esi, %esi
callq 0x1100
movq %r14, -0x18(%r15)
movq %r14, %rdi
callq 0x10b0
addq %r14, %rax
movq %rax, -0x10(%r15)
movq %rbx, -0x8(%r15)
movl %ebp, (%r15)
movabsq $0x100000006, %rax      # imm = 0x100000006
movq %rax, 0x8(%r15)
movq %r14, 0x10(%r15)
movl $0x38, %edi
callq *0x7011(%rip)           # 0x9110
testq %rax, %rax
je 0x26bc
leaq 0x88(%rsp), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq $0x0, 0x30(%rax)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movl $0x1, %ecx
movl $0x6, %eax
leaq 0x68(%rsp), %r13
leaq 0x436f(%rip), %r15      # 0x64b3
leaq 0x437f(%rip), %r12      # 0x64ca
cmpl $0x9, %eax
je 0x21c5
cmpl $0x7, %eax
je 0x2163
cmpl $0x6, %eax
je 0x21eb
jmp 0x2797
movq 0x90(%rsp), %rax
incq %rax
cmpq 0x70(%rsp), %rax
jae 0x2221
movb (%rax), %bpl
movq %r13, %rdi
movl $0x1, %esi
callq 0x2988
testl %eax, %eax
jne 0x2707
cmpb $0x5b, %bpl
jne 0x2236
cmpl $0x7, 0x88(%rsp)
jne 0x2969
movq %r13, %rdi
movl $0x1, %esi
callq 0x2988
movb $0x1, %cl
movl %ecx, 0x1c(%rsp)
testl %eax, %eax
je 0x223e
jmp 0x2707
movq 0xa8(%rsp), %rsi
movq %r13, %rdi
callq 0x2fe0
testl %eax, %eax
jne 0x2707
cmpl $0x6, 0x88(%rsp)
jne 0x27b7
movq %r13, %rdi
movl $0x1, %esi
callq 0x2988
testl %eax, %eax
jne 0x2707
movl 0x88(%rsp), %eax
movl 0x8c(%rsp), %ecx
cmpl $0x0, 0x9c(%rsp)
je 0x214b
jmp 0x275e
movq %r13, %rdi
movl $0x1, %esi
callq 0x2988
testl %eax, %eax
jne 0x2707
movl $0x0, 0x1c(%rsp)
movl 0x8c(%rsp), %ebp
movl 0xb0(%rsp), %eax
testl %eax, %eax
jle 0x2284
xorl %r14d, %r14d
movq 0xb8(%rsp,%r14,8), %rdi
testq %rdi, %rdi
je 0x226d
callq *0x6eb2(%rip)           # 0x9118
movl 0xb0(%rsp), %eax
movq $0x0, 0xb8(%rsp,%r14,8)
incq %r14
movslq %eax, %rcx
cmpq %rcx, %r14
jl 0x2253
movl $0x0, 0xb0(%rsp)
cmpl $0x9, 0x88(%rsp)
jne 0x26e7
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
callq 0x487c
testq %rax, %rax
je 0x2707
movslq 0xb0(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rbx), %rdx
movq %rdx, 0x90(%rbx,%rcx,8)
movups (%rbx), %xmm0
movups %xmm0, 0x80(%rbx,%rcx,8)
movslq 0xb0(%rsp), %rcx
movq %rax, 0xb8(%rsp,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0xb0(%rsp)
movq %r13, %rdi
movl $0x1, %esi
callq 0x2988
testl %eax, %eax
jne 0x2707
movl 0x88(%rsp), %eax
cmpl $0x1, %eax
jne 0x2344
movq %r13, %rdi
movl $0x1, %esi
callq 0x2988
testl %eax, %eax
jne 0x2707
cmpl $0x9, 0xb0(%rsp)
jle 0x228f
jmp 0x26e0
cmpl $0x8, %eax
jne 0x26db
movl 0xb0(%rsp), %eax
testl %eax, %eax
jle 0x28a4
leal -0x1(%rax), %r12d
leaq (%r12,%r12,2), %rcx
movq 0x90(%rbx,%rcx,8), %rdx
movq %rdx, 0x30(%rsp)
movups 0x80(%rbx,%rcx,8), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0xb8(%rsp,%r12,8), %rdi
testq %rdi, %rdi
je 0x239c
callq *0x6d87(%rip)           # 0x9118
movl 0xb0(%rsp), %eax
leal -0x1(%rax), %r12d
movl %r12d, 0xb0(%rsp)
movq 0xa0(%rsp), %rbp
cmpl $0x2, %eax
jl 0x2521
leaq 0x10c(%rsp), %r14
xorl %r15d, %r15d
movq 0xb8(%rsp,%r15,8), %rsi
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movq %rax, 0x50(%rsp)
movq %rax, 0x48(%rsp)
movq %rbp, %rdi
movq %rsi, 0x58(%rsp)
leaq 0x60(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x48(%rsp), %r8
callq 0x53fd
cmpl $0x61, %eax
je 0x24e5
cmpl $0x74, %eax
je 0x24de
cmpl $0x76, %eax
je 0x27de
movq %rbp, %rax
movslq 0x28(%rbp), %rbp
movq %rax, 0x40(%rsp)
movq 0x30(%rax), %r13
leaq 0x8(,%rbp,8), %rdi
callq *0x6ce2(%rip)           # 0x9110
testq %rax, %rax
je 0x281e
movq %rax, %r12
movq $0x0, (%rax,%rbp,8)
testq %r13, %r13
je 0x2463
leaq (,%rbp,8), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x1180
movq %r13, %rdi
callq *0x6cb5(%rip)           # 0x9118
movq 0x40(%rsp), %rax
movq %r12, 0x30(%rax)
movl $0x38, %edi
callq *0x6c99(%rip)           # 0x9110
testq %rax, %rax
je 0x2858
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq $0x0, 0x30(%rax)
movq %rax, (%r12,%rbp,8)
movq 0x58(%rsp), %rdi
callq 0x562e
movq (%r12,%rbp,8), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x287d
movq 0x40(%rsp), %rsi
movq 0x30(%rsi), %rax
movslq 0x28(%rsi), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x28(%rsi)
movq (%rax,%rcx,8), %rbp
movb $0x1, 0x8(%rbp)
movl 0xb0(%rsp), %r12d
leaq 0x68(%rsp), %r13
jmp 0x250e
movq 0x48(%rsp), %rbp
jmp 0x250e
movq 0x50(%rsp), %rax
cmpl $0x74, 0x8(%rax)
jne 0x2801
movslq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x283b
movq 0x18(%rax), %rax
shlq $0x5, %rcx
movq -0x8(%rax,%rcx), %rbp
incq %r15
movslq %r12d, %rax
addq $0x18, %r14
cmpq %rax, %r15
jl 0x23c0
movq %rbp, 0xa8(%rsp)
cmpb $0x0, 0x1c(%rsp)
je 0x2641
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
callq 0x487c
testq %rax, %rax
je 0x2707
movq %rax, %r12
movq 0xa8(%rsp), %rdi
movq %rax, %rsi
callq 0x3728
movq %rax, %r15
movq %r12, %rdi
callq *0x6ba1(%rip)           # 0x9118
testq %r15, %r15
jne 0x25b0
movq 0xa8(%rsp), %rsi
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movl $0x74, %edx
callq 0x4d57
testq %rax, %rax
je 0x2707
movq %rax, %r15
cmpl $0x74, 0x8(%r15)
jne 0x2925
movq %r13, %rdi
movq %r15, %rsi
callq 0x5511
testq %rax, %rax
je 0x2707
movq %rax, %r15
leaq 0x3e53(%rip), %rdi      # 0x642c
callq 0x562e
movq %rax, (%r15)
testq %rax, %rax
je 0x2949
movq %r15, 0xa8(%rsp)
cmpl $0x8, 0x88(%rsp)
jne 0x28b0
movq 0x90(%rsp), %rax
incq %rax
cmpq 0x70(%rsp), %rax
jae 0x28d7
cmpb $0x5d, (%rax)
jne 0x28d7
movq %r13, %rdi
movl $0x8, %esi
movl $0x1, %edx
leaq 0x3e23(%rip), %rcx      # 0x6456
callq 0x32ec
testl %eax, %eax
je 0x267e
jmp 0x2707
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4a57
testq %rax, %rax
je 0x2707
movq %rax, 0xa8(%rsp)
cmpl $0x8, 0x88(%rsp)
jne 0x28b0
movq %r13, %rdi
movl $0x8, %esi
movl $0x1, %edx
leaq 0x3dd0(%rip), %rcx      # 0x6462
callq 0x32ec
testl %eax, %eax
jne 0x2707
cmpl $0x6, 0x88(%rsp)
jne 0x28fe
leaq 0x3e03(%rip), %r15      # 0x64b3
leaq 0x3e13(%rip), %r12      # 0x64ca
jmp 0x2200
movl %ebp, %esi
leaq 0x3b19(%rip), %rdx      # 0x61de
leaq 0x3abc(%rip), %rcx      # 0x6188
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10e0
jmp 0x2749
movq %r12, %r15
jmp 0x26e7
leaq 0x3da1(%rip), %r15      # 0x6488
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3b91(%rip), %rdx      # 0x628c
movl %ebp, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x10e0
movl 0xb0(%rsp), %eax
testl %eax, %eax
jle 0x2739
xorl %ebx, %ebx
movq 0xb8(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x272e
callq *0x69f1(%rip)           # 0x9118
movl 0xb0(%rsp), %eax
incq %rbx
movslq %eax, %rcx
cmpq %rcx, %rbx
jl 0x2714
movq 0xa0(%rsp), %rdi
callq 0x3506
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0xb0(%rsp)
jle 0x278d
xorl %ebx, %ebx
movq 0xb8(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x277d
callq *0x699b(%rip)           # 0x9118
incq %rbx
movslq 0xb0(%rsp), %rax
cmpq %rax, %rbx
jl 0x276a
movq 0xa0(%rsp), %r14
jmp 0x2749
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3ae1(%rip), %rdx      # 0x628c
leaq 0x39fa(%rip), %r8       # 0x61ac
jmp 0x2700
movl 0x8c(%rsp), %ecx
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3aba(%rip), %rdx      # 0x628c
leaq 0x39bb(%rip), %r8       # 0x6194
jmp 0x2700
movl (%r14), %ecx
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3ae0(%rip), %rdx      # 0x62d5
xorl %eax, %eax
callq 0x10e0
jmp 0x2707
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3bbd(%rip), %rdx      # 0x63d2
leaq 0x3ccf(%rip), %rcx      # 0x64eb
jmp 0x2898
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x39ac(%rip), %rdx      # 0x61de
leaq 0x3cca(%rip), %rcx      # 0x6503
jmp 0x2898
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3b83(%rip), %rdx      # 0x63d2
leaq 0x3ca1(%rip), %rcx      # 0x64f7
jmp 0x2898
movq $0x0, (%r12,%rbp,8)
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x396a(%rip), %rdx      # 0x61de
leaq 0x3c94(%rip), %rcx      # 0x650f
jmp 0x2898
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x394d(%rip), %rdx      # 0x61de
leaq 0x3c83(%rip), %rcx      # 0x651b
xorl %eax, %eax
callq 0x10e0
jmp 0x2707
leaq 0x3c2b(%rip), %r15      # 0x64d6
jmp 0x26e7
movl 0x8c(%rsp), %ecx
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x39c1(%rip), %rdx      # 0x628c
leaq 0x3b6f(%rip), %r8       # 0x6441
jmp 0x2700
movl 0x8c(%rsp), %ecx
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x399a(%rip), %rdx      # 0x628c
leaq 0x3b52(%rip), %r8       # 0x644b
jmp 0x2700
movl 0x8c(%rsp), %ecx
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3973(%rip), %rdx      # 0x628c
leaq 0x3b4e(%rip), %r8       # 0x646e
jmp 0x2700
movl 0x24(%rsp), %ecx
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x394f(%rip), %rdx      # 0x628c
leaq 0x3ad9(%rip), %r8       # 0x641d
jmp 0x2700
movq 0x78(%rsp), %rdi
movslq 0x80(%rsp), %rsi
leaq 0x3881(%rip), %rdx      # 0x61de
leaq 0x3ad1(%rip), %rcx      # 0x6435
jmp 0x2898
leaq 0x3a76(%rip), %rdi      # 0x63e6
leaq 0x38d4(%rip), %rsi      # 0x624b
leaq 0x3a81(%rip), %rcx      # 0x63ff
movl $0x52c, %edx            # imm = 0x52C
callq 0x10f0