// File: /workspace/github_c_makefile_star2_O2/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 $0x1e8, %rsp            # imm = 0x1E8
movq %rsi, %r14
movq %rdi, %rbx
xorl %ebp, %ebp
testl %edx, %edx
cmovgl %edx, %ebp
jle 0x1e18
movb $0x0, (%r14)
leaq 0x70(%rsp), %r15
xorl %r12d, %r12d
movl $0x178, %edx            # imm = 0x178
movq %r15, %rdi
xorl %esi, %esi
callq 0x1100
movq %rbx, -0x18(%r15)
movq %rbx, %rdi
callq 0x10b0
addq %rbx, %rax
movq %rax, -0x10(%r15)
movq %r14, -0x8(%r15)
movl %ebp, (%r15)
movabsq $0x100000006, %rax      # imm = 0x100000006
movq %rax, 0x8(%r15)
movq %rbx, 0x10(%r15)
pushq $0x38
popq %rdi
callq *0x62ac(%rip)           # 0x8110
testq %rax, %rax
je 0x23c2
leaq 0x78(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
andq $0x0, 0x30(%rax)
movq %rax, 0x18(%r14)
movq %rax, 0x20(%r14)
pushq $0x6
popq %rbp
pushq $0x1
popq %rbx
leaq 0x3629(%rip), %r15      # 0x54c3
movl %ebx, %esi
movl %ebp, %eax
testl %r12d, %r12d
jne 0x2442
cmpl $0x9, %eax
je 0x1ee9
cmpl $0x7, %eax
leaq 0x58(%rsp), %r12
je 0x1ecb
cmpl $0x6, %eax
jne 0x2473
movq %r12, %rdi
movl %ebx, %esi
callq 0x2583
jmp 0x1f24
movq 0x80(%rsp), %rax
incq %rax
cmpq 0x60(%rsp), %rax
jae 0x1f41
cmpb $0x5b, (%rax)
sete %al
movl %eax, 0x1c(%rsp)
jmp 0x1f49
movq 0x98(%rsp), %rsi
leaq 0x58(%rsp), %r12
movq %r12, %rdi
callq 0x2adb
testl %eax, %eax
jne 0x23fa
cmpl $0x6, 0x78(%rsp)
jne 0x2484
movq %r12, %rdi
movl %ebp, %esi
movl %ebx, %edx
leaq 0x328d(%rip), %rcx      # 0x51ac
callq 0x2e1f
testl %eax, %eax
jne 0x23fa
movl 0x78(%rsp), %eax
movl 0x7c(%rsp), %esi
movl 0x8c(%rsp), %r12d
jmp 0x1e9e
movl $0x0, 0x1c(%rsp)
movq %r12, %rdi
pushq $0x7
popq %rsi
movl %ebx, %edx
leaq 0x34e8(%rip), %rcx      # 0x5440
callq 0x2e1f
testl %eax, %eax
jne 0x23fa
cmpb $0x0, 0x1c(%rsp)
je 0x1f93
cmpl $0x7, 0x78(%rsp)
jne 0x2548
movq %r12, %rdi
pushq $0x7
popq %rsi
movl %ebx, %edx
leaq 0x34c6(%rip), %rcx      # 0x544c
callq 0x2e1f
testl %eax, %eax
jne 0x23fa
movl 0x7c(%rsp), %r13d
xorl %ebx, %ebx
movslq 0xa0(%rsp), %rax
cmpq %rax, %rbx
jge 0x1fc8
movq 0xa8(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x1fba
callq *0x615e(%rip)           # 0x8118
andq $0x0, 0xa8(%rsp,%rbx,8)
incq %rbx
jmp 0x1f9a
andl $0x0, 0xa0(%rsp)
xorl %eax, %eax
pushq $0x1
popq %rbx
cmpl $0x9, %eax
jg 0x23ea
cmpl $0x9, 0x78(%rsp)
jne 0x23da
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
callq 0x41f4
testq %rax, %rax
je 0x23fa
movslq 0xa0(%rsp), %rcx
imulq $0x18, %rcx, %rcx
movq 0x10(%r14), %rdx
movq %rdx, 0x90(%r14,%rcx)
movups (%r14), %xmm0
movups %xmm0, 0x80(%r14,%rcx)
movslq 0xa0(%rsp), %rcx
movq %rax, 0xa8(%rsp,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0xa0(%rsp)
movq %r12, %rdi
movl %ebx, %esi
callq 0x2583
testl %eax, %eax
jne 0x23fa
movl 0x78(%rsp), %eax
cmpl $0x1, %eax
jne 0x2083
movq %r12, %rdi
movl %ebx, %esi
callq 0x2583
testl %eax, %eax
jne 0x23fa
movl 0xa0(%rsp), %eax
jmp 0x1fd5
cmpl $0x8, %eax
jne 0x23e3
movl 0xa0(%rsp), %ebx
testl %ebx, %ebx
jle 0x24fb
decl %ebx
imulq $0x18, %rbx, %rax
movq 0x90(%r14,%rax), %rcx
movq %rcx, 0x30(%rsp)
movups 0x80(%r14,%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0xa8(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x20d8
callq *0x6049(%rip)           # 0x8118
movl 0xa0(%rsp), %ebx
decl %ebx
movl %ebx, 0xa0(%rsp)
movq 0x90(%rsp), %r13
leaq 0xfc(%rsp), %rcx
xorl %r15d, %r15d
movslq %ebx, %rax
cmpq %rax, %r15
jge 0x221c
movq %rcx, 0x38(%rsp)
andq $0x0, 0x50(%rsp)
andq $0x0, 0x48(%rsp)
movq 0xa8(%rsp,%r15,8), %r12
andq $0x0, 0x40(%rsp)
movq %r13, %rdi
movq %r12, %rsi
leaq 0x50(%rsp), %rdx
leaq 0x48(%rsp), %rcx
leaq 0x40(%rsp), %r8
callq 0x4972
cmpl $0x61, %eax
je 0x21e2
cmpl $0x74, %eax
je 0x21db
cmpl $0x76, %eax
je 0x2498
movl 0x28(%r13), %ebx
movq 0x30(%r13), %rdi
movl %ebx, %esi
callq 0x4aa0
testq %rax, %rax
je 0x24ae
movq %rax, %rbp
movslq %ebx, %rbx
movq %rax, 0x30(%r13)
pushq $0x38
popq %rdi
callq *0x5f93(%rip)           # 0x8110
testq %rax, %rax
je 0x24c0
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
andq $0x0, 0x30(%rax)
movq %rax, (%rbp,%rbx,8)
movq %r12, %rdi
callq 0x4bf0
movq (%rbp,%rbx,8), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x24e5
movq 0x30(%r13), %rax
movslq 0x28(%r13), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x28(%r13)
movq (%rax,%rcx,8), %r13
movb $0x1, 0x8(%r13)
movl 0xa0(%rsp), %ebx
pushq $0x6
popq %rbp
jmp 0x220b
movq 0x40(%rsp), %r13
jmp 0x220b
movq 0x48(%rsp), %rax
cmpl $0x74, 0x8(%rax)
jne 0x24b7
movslq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x24cf
movq 0x18(%rax), %rax
shlq $0x5, %rcx
movq -0x8(%rax,%rcx), %r13
incq %r15
movq 0x38(%rsp), %rcx
addq $0x18, %rcx
jmp 0x20f2
movq %r13, 0x98(%rsp)
cmpb $0x0, 0x1c(%rsp)
je 0x2346
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %rdi
callq 0x41f4
testq %rax, %rax
leaq 0x326d(%rip), %r15      # 0x54c3
pushq $0x1
popq %rbx
je 0x23fa
movq %rax, %r13
movq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x31fd
movq %rax, %r12
movq %r13, %rdi
callq *0x5e9a(%rip)           # 0x8118
testq %r12, %r12
jne 0x22b7
movq 0x98(%rsp), %rsi
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %rdi
pushq $0x74
popq %rdx
callq 0x4495
testq %rax, %rax
je 0x23fa
movq %rax, %r12
cmpl $0x74, 0x8(%r12)
jne 0x252f
leaq 0x58(%rsp), %rdi
movq %r12, %rsi
callq 0x4b2e
testq %rax, %rax
je 0x23fa
movq %rax, %r12
leaq 0x3184(%rip), %rdi      # 0x5467
callq 0x4bf0
movq %rax, (%r12)
testq %rax, %rax
je 0x253f
movq %r12, 0x98(%rsp)
cmpl $0x8, 0x78(%rsp)
jne 0x2507
movq 0x80(%rsp), %rax
incq %rax
cmpq 0x60(%rsp), %rax
jae 0x251b
cmpb $0x5d, (%rax)
jne 0x251b
leaq 0x58(%rsp), %rdi
pushq $0x8
popq %rsi
movl %ebx, %edx
leaq 0x3159(%rip), %rcx      # 0x5491
callq 0x2e1f
testl %eax, %eax
je 0x238c
jmp 0x23fa
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0x4327
testq %rax, %rax
leaq 0x3153(%rip), %r15      # 0x54c3
pushq $0x1
popq %rbx
je 0x23fa
movq %rax, 0x98(%rsp)
cmpl $0x8, 0x78(%rsp)
jne 0x2507
leaq 0x58(%rsp), %rdi
pushq $0x8
popq %rsi
movl %ebx, %edx
leaq 0x3100(%rip), %rcx      # 0x549d
callq 0x2e1f
testl %eax, %eax
jne 0x23fa
cmpl $0x6, 0x78(%rsp)
je 0x1f2c
leaq 0x58(%rsp), %rdi
movl 0x24(%rdi), %esi
leaq 0x30e9(%rip), %rdx      # 0x54a9
jmp 0x23f5
leaq 0x58(%rsp), %rdi
andq $0x0, 0x38(%rdi)
leaq 0x2db5(%rip), %rsi      # 0x5188
callq 0x2567
jmp 0x242e
leaq 0x310d(%rip), %r15      # 0x54ee
jmp 0x23ea
leaq 0x311b(%rip), %r15      # 0x5505
leaq 0x58(%rsp), %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0x2e01
xorl %ebx, %ebx
movslq 0xa0(%rsp), %rax
cmpq %rax, %rbx
jge 0x2421
movq 0xa8(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x241c
callq *0x5cfc(%rip)           # 0x8118
incq %rbx
jmp 0x23fc
movq 0x90(%rsp), %rdi
callq 0x2ff2
xorl %eax, %eax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
movslq 0xa0(%rsp), %rax
cmpq %rax, %rbx
jge 0x2469
movq 0xa8(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2464
callq *0x5cb4(%rip)           # 0x8118
incq %rbx
jmp 0x2444
movq 0x90(%rsp), %rax
jmp 0x2430
leaq 0x2d3e(%rip), %rdx      # 0x51b8
leaq 0x58(%rsp), %rdi
jmp 0x23f5
leaq 0x58(%rsp), %rdi
movl 0x24(%rdi), %esi
leaq 0x2d01(%rip), %rdx      # 0x5194
jmp 0x23f5
movq 0x38(%rsp), %rax
movl (%rax), %esi
leaq 0x58(%rsp), %rdi
callq 0x4a85
jmp 0x23fa
leaq 0x3089(%rip), %rsi      # 0x553e
jmp 0x24ec
leaq 0x3068(%rip), %rsi      # 0x5526
jmp 0x24d6
andq $0x0, (%rbp,%rbx,8)
leaq 0x307d(%rip), %rsi      # 0x554a
jmp 0x24ec
leaq 0x305c(%rip), %rsi      # 0x5532
leaq 0x58(%rsp), %rdi
callq 0x4bd4
jmp 0x23fa
leaq 0x306a(%rip), %rsi      # 0x5556
leaq 0x58(%rsp), %rdi
callq 0x2567
jmp 0x23fa
leaq 0x300f(%rip), %r15      # 0x5511
jmp 0x23ea
leaq 0x58(%rsp), %rdi
movl 0x24(%rdi), %esi
leaq 0x2f66(%rip), %rdx      # 0x547c
jmp 0x23f5
leaq 0x58(%rsp), %rdi
movl 0x24(%rdi), %esi
leaq 0x2f5c(%rip), %rdx      # 0x5486
jmp 0x23f5
movl 0x24(%rsp), %esi
leaq 0x2f1e(%rip), %rdx      # 0x5458
jmp 0x247a
leaq 0x2f2a(%rip), %rsi      # 0x5470
jmp 0x24ec
leaq 0x2eba(%rip), %rdi      # 0x5409
leaq 0x2d01(%rip), %rsi      # 0x5257
leaq 0x2ec5(%rip), %rcx      # 0x5422
movl $0x52c, %edx            # imm = 0x52C
callq 0x10f0