// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1160
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3593
jmp 0x36af
movl -0x2c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x35fa
movl -0x20(%rbp), %eax
addl $0x3e8, %eax            # imm = 0x3E8
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movl -0x20(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0x3750
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x35ec
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
leaq 0x4cce(%rip), %rdx      # 0x829d
movb $0x0, %al
callq 0x10e0
movq -0x28(%rbp), %rdi
callq 0x3500
movq $0x0, -0x8(%rbp)
jmp 0x3742
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x20(%rbp)
callq 0x1050
movl $0x0, (%rax)
movq -0x28(%rbp), %rdi
movslq -0x2c(%rbp), %rax
addq %rax, %rdi
movl -0x20(%rbp), %eax
subl -0x2c(%rbp), %eax
movslq %eax, %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x1080
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1070
cmpl $0x0, %eax
je 0x36a1
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0x1050
cmpl $0x0, (%rax)
je 0x3664
callq 0x1050
movl (%rax), %edi
callq 0x11b0
movq %rax, -0x68(%rbp)
jmp 0x3671
leaq 0x4c40(%rip), %rax      # 0x82ab
movq %rax, -0x68(%rbp)
jmp 0x3671
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rcx
leaq 0x4cf5(%rip), %rdx      # 0x8379
movb $0x0, %al
callq 0x10e0
movq -0x28(%rbp), %rdi
callq 0x3500
movq $0x0, -0x8(%rbp)
jmp 0x3742
movl -0x3c(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x3579
movl -0x2c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x3711
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3750
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x3703
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
leaq 0x4bb4(%rip), %rdx      # 0x829d
movb $0x0, %al
callq 0x10e0
movq -0x28(%rbp), %rdi
callq 0x3500
movq $0x0, -0x8(%rbp)
jmp 0x3742
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x25a0
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3500
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)