// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/encdesc.c
// Function: gt_encdesc_load
GtEncdesc* gt_encdesc_load(const char *name,
                           GtError *err)
{
  int had_err = 0;
  GtEncdesc *encdesc = NULL;
  FILE *fp;
  GtStr *filename;
  int fd;
  GtUword const pages_to_map = 5UL;

  gt_assert(name);
  encdesc = encdesc_new();

  filename = gt_str_new_cstr(name);
  gt_str_append_cstr(filename, GT_ENCDESC_FILESUFFIX);
  fp = gt_fa_fopen_with_suffix(name, GT_ENCDESC_FILESUFFIX, "rb", err);
  if (fp == NULL) {
    gt_assert(gt_error_is_set(err));
    had_err = 1;
  }

  if (!had_err) {
    fd = open(gt_str_get(filename), O_RDONLY);
    if (fd == -1) {
      gt_error_set(err, "open(): cannot read file %s, error: %s",
                   gt_str_get(filename), strerror(errno));
      had_err = 1;
    }
  }
  if (!had_err)
    had_err = encdesc_read_header(encdesc, fp, err);

  if (!had_err) {
    encdesc_init_huffman(encdesc);

    encdesc_read_samplingtab(encdesc, fp);
    gt_fa_fclose(fp);

    encdesc->bitinstream =
      gt_bitinstream_new(gt_str_get(filename),
                         (size_t) encdesc->start_of_encoding, pages_to_map);
    gt_str_delete(filename);

  }
  else {
    gt_encdesc_delete(encdesc);
    encdesc = NULL;
  }
  return encdesc;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0xd2c47
movq %rsi, %r15
movq %rdi, %r12
callq 0xd1257
movq %rax, %rbx
movq %r12, %rdi
callq 0xacbd1
movq %rax, %r14
leaq 0x249746(%rip), %r13    # 0x31c24e
movq %rax, %rdi
movq %r13, %rsi
callq 0xacbfb
leaq 0x272f83(%rip), %rdx    # 0x345a9d
leaq 0x2495a7(%rip), %rcx    # 0x31c0c8
movq %r12, %rdi
movq %r13, %rsi
movl $0x46c, %r8d            # imm = 0x46C
movq %r15, %r9
callq 0x8a449
testq %rax, %rax
je 0xd2bc8
movq %rax, %r12
movq %r14, %rdi
callq 0xad1fa
movq %rax, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x17ce0
cmpl $-0x1, %eax
je 0xd2c02
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd50bf
testl %eax, %eax
jne 0xd2c30
movq %rbx, %rdi
callq 0xd28d2
movq 0x58(%rbx), %rsi
testq %rsi, %rsi
je 0xd2b9b
movq %r12, %rdi
xorl %edx, %edx
callq 0xb2fec
movq %r12, %rdi
callq 0x11420c
movq %rax, 0x28(%rbx)
movq %r12, %rdi
callq 0x8a4fd
movq %r14, %rdi
callq 0xad1fa
movq 0x60(%rbx), %rsi
pushq $0x5
popq %rdx
movq %rax, %rdi
callq 0x296e70
movq %rax, 0x20(%rbx)
movq %r14, %rdi
callq 0xae103
jmp 0xd2c3a
movq %r15, %rdi
callq 0x89eb7
testb %al, %al
jne 0xd2c30
movq 0x36538d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x21242e(%rip), %rsi    # 0x2e5013
leaq 0x235e89(%rip), %rdx    # 0x308a75
leaq 0x2497ce(%rip), %rcx    # 0x31c3c1
leaq 0x2494ce(%rip), %r8     # 0x31c0c8
movl $0x46e, %r9d            # imm = 0x46E
jmp 0xd2c73
movq %r14, %rdi
callq 0xad1fa
movq %rax, %r14
callq 0x17060
movl (%rax), %edi
callq 0x17220
leaq 0x2497b1(%rip), %rsi    # 0x31c3d1
movq %r15, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x89dbb
movq %rbx, %rdi
callq 0xd2c7f
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x36531a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2123bb(%rip), %rsi    # 0x2e5013
leaq 0x24ff0c(%rip), %rdx    # 0x322b6b
leaq 0x24975b(%rip), %rcx    # 0x31c3c1
leaq 0x24945b(%rip), %r8     # 0x31c0c8
movl $0x467, %r9d            # imm = 0x467
xorl %eax, %eax
callq 0x17a50
callq 0x17390