// File: /workspace/github_c_makefile_star2_O1/cktan[P]tomlc99/toml.c
// Function: toml_parse_file
toml_table_t *toml_parse_file(FILE *fp, char *errbuf, int errbufsz) {
  int bufsz = 0;
  char *buf = 0;
  int off = 0;

  /* read from fp into buf */
  while (!feof(fp)) {

    if (off == bufsz) {
      int xsz = bufsz + 1000;
      char *x = expand(buf, bufsz, xsz);
      if (!x) {
        snprintf(errbuf, errbufsz, "out of memory");
        xfree(buf);
        return 0;
      }
      buf = x;
      bufsz = xsz;
    }

    errno = 0;
    int n = fread(buf + off, 1, bufsz - off, fp);
    if (ferror(fp)) {
      snprintf(errbuf, errbufsz, "%s",
               errno ? strerror(errno) : "Error reading file");
      xfree(buf);
      return 0;
    }
    off += n;
  }

  /* tag on a NUL to cap the string */
  if (off == bufsz) {
    int xsz = bufsz + 1;
    char *x = expand(buf, bufsz, xsz);
    if (!x) {
      snprintf(errbuf, errbufsz, "out of memory");
      xfree(buf);
      return 0;
    }
    buf = x;
    bufsz = xsz;
  }
  buf[off] = 0;

  /* parse it, cleanup and finish */
  toml_table_t *ret = toml_parse(buf, errbuf, errbufsz);
  xfree(buf);
  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movslq %edx, %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x20(%rsp), %rdi
callq 0x1180
testl %eax, %eax
jne 0x363f
cmpl %r12d, %r14d
jne 0x35ae
leal 0x3e8(%r12), %ebx
movslq %ebx, %rdi
callq *0x5bd6(%rip)           # 0x9118
testq %rax, %rax
je 0x3568
movq %rax, %r13
testq %r15, %r15
je 0x356b
movslq %r12d, %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1190
movq %r15, %rdi
callq *0x5bba(%rip)           # 0x9120
jmp 0x356b
xorl %r13d, %r13d
movq %r13, %rax
testq %r13, %r13
jne 0x359f
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x2c11(%rip), %rdx      # 0x6195
xorl %eax, %eax
callq 0x10f0
testq %r15, %r15
je 0x3599
movq %r15, %rdi
callq *0x5b87(%rip)           # 0x9120
movq %r15, %rax
movl %r12d, %ebx
movq %rax, %r15
movl %ebx, %r12d
testq %r13, %r13
je 0x3638
callq 0x1050
movq %rax, %rbx
movl $0x0, (%rax)
movslq %r14d, %rdi
addq %r15, %rdi
movl %r12d, %eax
subl %r14d, %eax
movslq %eax, %rdx
movl $0x1, %esi
movq 0x20(%rsp), %r13
movq %r13, %rcx
callq 0x1090
movq %rax, %rbp
movq %r13, %rdi
callq 0x1080
movl %eax, %r13d
testl %eax, %eax
je 0x362c
movl (%rbx), %edi
leaq 0x2bab(%rip), %rcx      # 0x61a3
testl %edi, %edi
je 0x3604
callq 0x11e0
movq %rax, %rcx
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x2c5c(%rip), %rdx      # 0x6271
xorl %eax, %eax
callq 0x10f0
testq %r15, %r15
je 0x362f
movq %r15, %rdi
callq *0x5af6(%rip)           # 0x9120
jmp 0x362f
addl %ebp, %r14d
testl %r13d, %r13d
je 0x351a
xorl %ebx, %ebx
jmp 0x36dd
cmpl %r12d, %r14d
jne 0x36b3
leal 0x1(%r12), %eax
movslq %eax, %rdi
callq *0x5ac6(%rip)           # 0x9118
testq %rax, %rax
je 0x3678
movq %rax, %rbx
testq %r15, %r15
je 0x367a
movslq %r12d, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1190
movq %r15, %rdi
callq *0x5aaa(%rip)           # 0x9120
jmp 0x367a
xorl %ebx, %ebx
movq %rbx, %rax
testq %rbx, %rbx
jne 0x36ab
leaq 0x2b0c(%rip), %rdx      # 0x6195
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x10f0
testq %r15, %r15
je 0x36a8
movq %r15, %rdi
callq *0x5a78(%rip)           # 0x9120
movq %r15, %rax
movq %rax, %r15
testq %rbx, %rbx
je 0x3638
movslq %r14d, %rax
movb $0x0, (%r15,%rax)
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movl 0x1c(%rsp), %edx
callq 0x2160
movq %rax, %rbx
testq %r15, %r15
je 0x36dd
movq %r15, %rdi
callq *0x5a43(%rip)           # 0x9120
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq