// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/encdesc_header_io.c
// Function: encdesc_write_header
int encdesc_write_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_fwrite, err);

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

    if (!had_err && cur_field->is_const) {
      had_err = io_cons_field_header(cur_field, fp, gt_io_error_fwrite, err);
    }
    else if (!had_err) {
      had_err = gt_io_error_fwrite_one(cur_field->is_numeric, fp, err);
      if (!had_err && cur_field->is_numeric) {
        had_err = io_numeric_field_header(cur_field, fp, gt_io_error_fwrite,
                                          err);
      }
      else if (!had_err) {

        had_err = io_field_len_header(cur_field, fp, gt_io_error_fwrite, err);

        if (!had_err)
          had_err = gt_io_error_fwrite(cur_field->data, sizeof (char),
                                       (size_t) cur_field->len, fp, err);

        if (!had_err)
          had_err = write_field_header_bittab(cur_field, fp, err);

        if (!had_err)
          had_err = write_field_char_dists(cur_field, 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 %rsi, %r14
movq %rdi, %r15
leaq 0x1f9aa(%rip), %rdx     # 0xf3eb0
movq %rcx, 0x10(%rsp)
callq 0xd4876
movl %eax, %ecx
xorl %r13d, %r13d
pushq $0x1
popq %rbp
movq %r14, 0x18(%rsp)
testl %ecx, %ecx
jne 0xd4865
cmpq 0x40(%r15), %r13
jae 0xd4865
movq %r15, %rbx
movq 0x18(%r15), %r12
movq %r13, 0x8(%rsp)
imulq $0xc8, %r13, %r13
leaq (%r12,%r13), %rdi
addq $0xb8, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %r14, %r15
movq 0x10(%rsp), %r14
movq %r14, %r8
callq 0xf3eb0
testl %eax, %eax
je 0xd457c
movl %eax, %ecx
movq %r15, %r14
movq %rbx, %r15
movq 0x8(%rsp), %r13
jmp 0xd4625
addq %r13, %r12
leaq 0xbb(%r12), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
movq %r15, %rcx
movq %r14, %r8
callq 0xf3eb0
testl %eax, %eax
je 0xd45ab
movl %eax, %ecx
movq 0x18(%rsp), %r14
movq %rbx, %r15
jmp 0xd461d
cmpb $0x1, (%r13)
movq %rbx, %r15
pushq $0x8
popq %rbp
jne 0xd45d6
movq %r12, %rdi
movq 0x18(%rsp), %r14
movq %r14, %rsi
leaq 0x1f8e6(%rip), %rdx     # 0xf3eb0
movq 0x10(%rsp), %rcx
callq 0xd4947
jmp 0xd461b
leaq 0xbf(%r12), %r13
movq %r13, %rdi
pushq $0x1
popq %rdx
movq %rdx, %rsi
movq 0x18(%rsp), %r14
movq %r14, %rcx
movq 0x10(%rsp), %r8
callq 0xf3eb0
testl %eax, %eax
jne 0xd461b
cmpb $0x1, (%r13)
jne 0xd462d
movq %r12, %rdi
movq %r14, %rsi
leaq 0x1f89f(%rip), %rdx     # 0xf3eb0
movq 0x10(%rsp), %rcx
callq 0xd49c7
movl %eax, %ecx
movq 0x8(%rsp), %r13
pushq $0x1
popq %rbp
incq %r13
jmp 0xd451d
leaq 0xb9(%r12), %rdi
pushq $0x1
popq %rbx
movq %rbx, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq 0x10(%rsp), %r13
movq %r13, %r8
callq 0xf3eb0
testl %eax, %eax
jne 0xd46cd
movq %rbp, %rsi
leaq 0x50(%r12), %rbp
movq %rbp, %rdi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
callq 0xf3eb0
testl %eax, %eax
jne 0xd46cd
movq %rbp, 0x38(%rsp)
leaq 0x68(%r12), %rbp
movq %rbp, %rdi
pushq $0x8
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
callq 0xf3eb0
testl %eax, %eax
jne 0xd46cd
movq %rbp, 0x30(%rsp)
leaq 0x58(%r12), %rdi
pushq $0x8
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
callq 0xf3eb0
testl %eax, %eax
jne 0xd46cd
leaq 0xa8(%r12), %rdi
pushq $0x4
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
callq 0xf3eb0
testl %eax, %eax
je 0xd46dc
movl %eax, %ecx
movq 0x8(%rsp), %r13
movq %rbx, %rbp
jmp 0xd4625
movq 0x40(%r12), %rdi
movq 0x50(%r12), %rdx
movq %rbx, %rsi
movq %r14, %rcx
movq %r13, %r8
callq 0xf3eb0
testl %eax, %eax
jne 0xd461b
movq 0x50(%r12), %r13
movb $0x0, 0x40(%rsp)
xorl %ecx, %ecx
xorl %ebp, %ebp
movq 0x38(%rsp), %rbx
testl %ecx, %ecx
jne 0xd4752
cmpq %r13, %rbp
jae 0xd4752
movq 0x18(%r12), %rdi
movq %rbp, %rsi
callq 0x5e839
testb %al, %al
je 0xd472e
orb $0x1, 0x40(%rsp)
leaq 0x40(%rsp), %rdi
pushq $0x1
popq %rdx
movq %rdx, %rsi
movq %r14, %rcx
movq 0x10(%rsp), %r8
callq 0xf3eb0
movl %eax, %ecx
movb $0x0, 0x40(%rsp)
incq %rbp
jmp 0xd470f
testl %ecx, %ecx
movq 0x8(%rsp), %r13
pushq $0x1
popq %rbp
jne 0xd4625
movq %r14, 0x40(%rsp)
andl $0x0, 0x60(%rsp)
leaq 0x48(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq 0x10(%rsp), %r14
movq %r14, 0x58(%rsp)
xorl %ecx, %ecx
xorl %edx, %edx
testl %ecx, %ecx
movq 0x30(%rsp), %rax
jne 0xd485b
cmpq (%rax), %rdx
jae 0xd485b
cmpq (%rbx), %rdx
movq %rdx, %rbp
jae 0xd47c2
movq 0x18(%r12), %rdi
movq %rbp, %rsi
callq 0x5e839
movq %rbp, %rdx
movq 0x10(%rsp), %r14
xorl %ecx, %ecx
testb %al, %al
jne 0xd4853
movq 0x30(%r12), %rax
movq (%rax,%rdx,8), %rdi
andq $0x0, 0x28(%rsp)
leaq 0x1068(%rip), %rsi      # 0xd5840
leaq 0x28(%rsp), %rdx
xorl %ecx, %ecx
callq 0xd5743
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x20(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq 0x18(%rsp), %rcx
movq %r14, %r8
callq 0xf3eb0
movq %rbp, %rdx
movl %eax, %ecx
testl %eax, %eax
jne 0xd483e
movq 0x30(%r12), %rax
movq (%rax,%rdx,8), %rdi
movq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rcx, %r14
movq 0x10(%rsp), %rcx
callq 0xd5517
movq %rbp, %rdx
movq 0x30(%r12), %rcx
movq %rax, (%rcx,%rbp,8)
movq %r14, %rcx
movq 0x30(%r12), %rax
cmpq $0x0, (%rax,%rdx,8)
pushq $0x1
popq %rax
cmovel %eax, %ecx
movq 0x10(%rsp), %r14
incq %rdx
jmp 0xd4785
movq 0x18(%rsp), %r14
jmp 0xd4622
movl %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq