// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/fa.c
// Function: gt_fa_heap_read_func
void *gt_fa_heap_read_func(const char *path, size_t *len,
                           const char *src_file, int src_line, GtError *err)
{
  int fd;
  struct stat buf;
  bool haserr = false;

  gt_assert(path != NULL);
  fd = open(path,O_RDONLY); /* open file for read, get filedes */
  if (fd == -1) /* check for error code */
  {
    gt_error_set(err,"%s, line %d: cannot open \"%s\"",src_file,src_line,path);
    haserr = true;
  }
  if (!haserr && fstat(fd,&buf) == -1)  /* get status information of file */
  {
    gt_error_set(err,"%s, line %d: cannot access status of file \"%s\"",
                 src_file,src_line,path);
    close(fd);
    haserr = true;
  }
  if (!haserr)
  {
    void *ptr;

    *len = buf.st_size;
    ptr = gt_malloc(*len);
    gt_assert(fd > 0);
    if (read(fd,ptr,*len) == -1)
    {
      gt_error_set(err,"%s, line %d: read(%s) failed",src_file,src_line,path);
      haserr = true;
    }
    if (haserr)
    {
      gt_free(ptr);
      return NULL;
    }
    close(fd);
    return ptr;
  }
  return NULL;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xc8(%rsp)
movq %rsi, 0xc0(%rsp)
movq %rdx, 0xb8(%rsp)
movl %ecx, 0xb4(%rsp)
movq %r8, 0xa8(%rsp)
movb $0x0, 0xf(%rsp)
cmpq $0x0, 0xc8(%rsp)
jne 0x81606
movq 0x132a03(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xdca87(%rip), %rsi     # 0x15e066
leaq 0xec88e(%rip), %rdx     # 0x16de74
leaq 0xec894(%rip), %rcx     # 0x16de81
leaq 0xec678(%rip), %r8      # 0x16dc6c
movl $0x24f, %r9d            # imm = 0x24F
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x81608
movq 0xc8(%rsp), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0xbaa0
movl %eax, 0xa4(%rsp)
cmpl $-0x1, 0xa4(%rsp)
jne 0x8165c
movq 0xa8(%rsp), %rdi
movq 0xb8(%rsp), %rdx
movl 0xb4(%rsp), %ecx
movq 0xc8(%rsp), %r8
leaq 0xec846(%rip), %rsi     # 0x16de96
movb $0x0, %al
callq 0xc0d0
movb $0x1, 0xf(%rsp)
testb $0x1, 0xf(%rsp)
jne 0x816b7
movl 0xa4(%rsp), %edi
leaq 0x10(%rsp), %rsi
callq 0xbb50
cmpl $-0x1, %eax
jne 0x816b7
movq 0xa8(%rsp), %rdi
movq 0xb8(%rsp), %rdx
movl 0xb4(%rsp), %ecx
movq 0xc8(%rsp), %r8
leaq 0xec815(%rip), %rsi     # 0x16deb4
movb $0x0, %al
callq 0xc0d0
movl 0xa4(%rsp), %edi
callq 0xbc90
movb $0x1, 0xf(%rsp)
testb $0x1, 0xf(%rsp)
jne 0x817cd
movq 0x40(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, (%rax)
movq 0xc0(%rsp), %rax
movq (%rax), %rdi
leaq 0xec588(%rip), %rsi     # 0x16dc6c
movl $0x262, %edx            # imm = 0x262
callq 0xd2e0
movq %rax, (%rsp)
cmpl $0x0, 0xa4(%rsp)
jg 0x81734
movq 0x1328d5(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xdc959(%rip), %rsi     # 0x15e066
leaq 0xec7cf(%rip), %rdx     # 0x16dee3
leaq 0xec766(%rip), %rcx     # 0x16de81
leaq 0xec54a(%rip), %r8      # 0x16dc6c
movl $0x263, %r9d            # imm = 0x263
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x81736
movl 0xa4(%rsp), %edi
movq (%rsp), %rsi
movq 0xc0(%rsp), %rax
movq (%rax), %rdx
callq 0xb8a0
cmpq $-0x1, %rax
jne 0x81789
movq 0xa8(%rsp), %rdi
movq 0xb8(%rsp), %rdx
movl 0xb4(%rsp), %ecx
movq 0xc8(%rsp), %r8
leaq 0xec76d(%rip), %rsi     # 0x16deea
movb $0x0, %al
callq 0xc0d0
movb $0x1, 0xf(%rsp)
testb $0x1, 0xf(%rsp)
je 0x817b3
movq (%rsp), %rdi
leaq 0xec4d1(%rip), %rsi     # 0x16dc6c
movl $0x26b, %edx            # imm = 0x26B
callq 0xdab0
movq $0x0, 0xd0(%rsp)
jmp 0x817d9
movl 0xa4(%rsp), %edi
callq 0xbc90
movq (%rsp), %rax
movq %rax, 0xd0(%rsp)
jmp 0x817d9
movq $0x0, 0xd0(%rsp)
movq 0xd0(%rsp), %rax
addq $0xd8, %rsp
retq
nopl (%rax)