// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/encdesc_header_io.c
// Function: encdesc_read_header
int encdesc_read_header(GtEncdesc *encdesc, FILE *fp, GtError *err)
{
  int had_err = 0;
  GtUword cur_field_num;
  DescField *cur_field;

  had_err = encdesc_header_io_basics(encdesc, fp, gt_io_error_fread, err);

  if (!had_err)
    encdesc->fields = gt_calloc((size_t) encdesc->num_of_fields,
                                sizeof (DescField));

  for (cur_field_num = 0;
       !had_err && cur_field_num < encdesc->num_of_fields;
       cur_field_num++) {
    cur_field = &encdesc->fields[cur_field_num];
    /* cur_field->bits_per_num = 0; */
    /* cur_field->prev_value = 0; */
    had_err = io_field_sep_and_is_const(cur_field, fp, gt_io_error_fread, err);

    if (!had_err && cur_field->is_const) {
      gt_log_log("field " GT_WU " is const", cur_field_num);
      had_err = io_cons_field_header(cur_field, fp, gt_io_error_fread, err);
    }
    else if (!had_err) {
      had_err = gt_io_error_fread_one(cur_field->is_numeric, fp, err);
      if (!had_err && cur_field->is_numeric) {
        gt_log_log("field " GT_WU " is numeric", cur_field_num);
        had_err = io_numeric_field_header(cur_field, fp, gt_io_error_fread,
                                          err);
      }
      else if (!had_err) {
        had_err = io_field_len_header(cur_field, fp, gt_io_error_fread, err);

        if (!had_err) {
          cur_field->bittab = gt_bittab_new(cur_field->len);

          cur_field->data = gt_calloc((size_t) (cur_field->len + 1),
                                      sizeof (char));
          had_err = gt_io_error_fread(cur_field->data, sizeof (char),
                                      (size_t) cur_field->len, fp, err);

        }
        if (!had_err)
          had_err = read_field_header_bittab(cur_field, fp, err);

        if (!had_err) {
          cur_field->chars = gt_calloc((size_t) (cur_field->max_len + 1),
                                       sizeof (cur_field->chars));

          had_err = read_field_char_dists(cur_field, fp, err);
        }
      }
    }
  }
  if (!had_err)
    had_err = gt_io_error_fread_one(encdesc->start_of_samplingtab, fp, err);
  if (!had_err)
    had_err = gt_io_error_fread_one(encdesc->start_of_encoding, fp, err);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %rcx
movq %rdi, %rbx
leaq 0x1ee13(%rip), %rdx     # 0xf3eed
movq %rsi, 0x20(%rsp)
movq %rcx, 0x8(%rsp)
callq 0xd4876
movl %eax, %ecx
testl %eax, %eax
jne 0xd5113
movq 0x40(%rbx), %rdi
leaq 0x247b3a(%rip), %rdx    # 0x31cc34
movl $0xc8, %esi
movq %rcx, %r14
movl $0x260, %ecx            # imm = 0x260
callq 0x9334a
movq %r14, %rcx
movq %rax, 0x18(%rbx)
pushq $0x1
popq %r15
xorl %ebp, %ebp
movq 0x8(%rsp), %r14
movq %rbx, 0x10(%rsp)
testl %ecx, %ecx
jne 0xd5506
cmpq 0x40(%rbx), %rbp
jae 0xd54c9
movq 0x18(%rbx), %r12
movq %rbp, %r13
imulq $0xc8, %rbp, %rbx
leaq (%r12,%rbx), %rdi
addq $0xb8, %rdi
movq %r15, %rsi
movq %r15, %rdx
movq 0x20(%rsp), %rbp
movq %rbp, %rcx
movq %r14, %r8
callq 0xf3eed
testl %eax, %eax
je 0xd5171
movl %eax, %ecx
movq 0x10(%rsp), %rbx
jmp 0xd51a4
addq %rbx, %r12
leaq 0xbb(%r12), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq %r14, %r8
callq 0xf3eed
testl %eax, %eax
je 0xd51af
movl %eax, %ecx
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %rbx
pushq $0x1
popq %r15
movq %r13, %rbp
incq %rbp
jmp 0xd5123
movq %r12, 0x18(%rsp)
cmpb $0x1, (%rbx)
movq %r13, %rbp
jne 0xd51f8
leaq 0x247a92(%rip), %rdi    # 0x31cc55
movq %rbp, %rsi
xorl %eax, %eax
callq 0x92a82
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
leaq 0x1ed0f(%rip), %rdx     # 0xf3eed
movq 0x8(%rsp), %r14
movq %r14, %rcx
callq 0xd4947
movl %eax, %ecx
movq 0x10(%rsp), %rbx
pushq $0x1
popq %r15
jmp 0xd51a7
movq 0x18(%rsp), %rax
leaq 0xbf(%rax), %rbx
movq %rbx, %rdi
pushq $0x1
popq %r15
movq %r15, %rsi
movq %r15, %rdx
movq 0x20(%rsp), %r14
movq %r14, %rcx
movq 0x8(%rsp), %r8
callq 0xf3eed
testl %eax, %eax
je 0xd5233
movl %eax, %ecx
movq 0x8(%rsp), %r14
jmp 0xd530d
cmpb $0x1, (%rbx)
pushq $0x8
popq %r12
jne 0xd5270
leaq 0x247a25(%rip), %rdi    # 0x31cc68
movq %rbp, %rsi
xorl %eax, %eax
callq 0x92a82
movq 0x18(%rsp), %rdi
movq %r14, %rsi
leaq 0x1ec91(%rip), %rdx     # 0xf3eed
movq 0x8(%rsp), %r14
movq %r14, %rcx
callq 0xd49c7
movl %eax, %ecx
jmp 0xd530d
movq 0x18(%rsp), %r13
leaq 0xb9(%r13), %rdi
movq %r15, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq 0x8(%rsp), %rbx
movq %rbx, %r8
callq 0xf3eed
testl %eax, %eax
jne 0xd5308
movq %r12, %rsi
leaq 0x50(%r13), %r12
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0xf3eed
testl %eax, %eax
jne 0xd5308
movq %r12, 0x28(%rsp)
leaq 0x68(%r13), %r12
movq %r12, %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0xf3eed
testl %eax, %eax
jne 0xd5308
leaq 0x58(%r13), %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0xf3eed
testl %eax, %eax
jne 0xd5308
leaq 0xa8(%r13), %rdi
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0xf3eed
testl %eax, %eax
je 0xd5317
movl %eax, %ecx
movq %rbx, %r14
movq 0x10(%rsp), %rbx
jmp 0xd51a7
movq 0x50(%r13), %rdi
callq 0x5e0b0
movq %rax, 0x18(%r13)
movq 0x50(%r13), %rdi
incq %rdi
movq %r15, %rsi
leaq 0x2478ff(%rip), %rdx    # 0x31cc34
movl $0x27c, %ecx            # imm = 0x27C
callq 0x9334a
movq %rax, 0x40(%r13)
movq 0x50(%r13), %rdx
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0xf3eed
testl %eax, %eax
jne 0xd5227
movq 0x28(%rsp), %rax
movq (%rax), %rbx
xorl %ecx, %ecx
xorl %r13d, %r13d
movq 0x8(%rsp), %r14
cmpq %r13, %rbx
je 0xd53b8
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movq %r15, %rdx
movq 0x20(%rsp), %rcx
movq %r14, %r8
callq 0xf3eed
movl %eax, %ecx
testl %eax, %eax
jne 0xd53b3
testb $0x1, 0x40(%rsp)
je 0xd53b3
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movq %r13, %rsi
movq %rcx, %r14
callq 0x5e143
movq %r14, %rcx
incq %r13
jmp 0xd536d
testl %ecx, %ecx
movq 0x10(%rsp), %rbx
jne 0xd51a7
movq %r12, 0x30(%rsp)
movq 0x18(%rsp), %r12
movq 0x68(%r12), %rdi
incq %rdi
pushq $0x8
popq %rsi
leaq 0x247853(%rip), %rdx    # 0x31cc34
movl $0x286, %ecx            # imm = 0x286
callq 0x9334a
movq 0x8(%rsp), %r14
movq %rax, 0x30(%r12)
movq 0x30(%rsp), %r12
movq %r14, 0x58(%rsp)
andl $0x0, 0x60(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x28(%rsp), %r13
testl %ecx, %ecx
jne 0xd51a7
cmpq (%r12), %rdx
jae 0xd51a7
cmpq (%r13), %rdx
jae 0xd5451
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movq %rdx, %r14
movq %rdx, %rsi
callq 0x5e839
movq %r14, %rdx
movq 0x8(%rsp), %r14
xorl %ecx, %ecx
testb %al, %al
jne 0xd54c1
leaq 0x38(%rsp), %rdi
movq %rdx, %r14
pushq $0x8
popq %rsi
movq %r15, %rdx
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %r8
callq 0xf3eed
movl %eax, %r13d
movq 0x18(%rsp), %r12
movq 0x30(%r12), %rax
movq (%rax,%r14,8), %rdi
movq 0x38(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq 0x8(%rsp), %rcx
callq 0xd5517
movq %r14, %rdx
movq 0x8(%rsp), %r14
movq 0x30(%r12), %rcx
movq %rax, (%rcx,%rdx,8)
movq %r13, %rcx
movq 0x28(%rsp), %r13
movq 0x30(%r12), %rax
movq 0x30(%rsp), %r12
cmpq $0x0, (%rax,%rdx,8)
pushq $0x1
popq %rax
cmovel %eax, %ecx
incq %rdx
jmp 0xd5417
leaq 0x58(%rbx), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %r8
callq 0xf3eed
movq 0x8(%rsp), %r8
movl %eax, %ecx
testl %eax, %eax
jne 0xd5506
addq $0x60, %rbx
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq 0x20(%rsp), %rcx
callq 0xf3eed
movl %eax, %ecx
movl %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq