// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/rcr.c
// Function: rcr_write_header_to_file
static int rcr_write_header_to_file(GtRcrEncoder *rcr_enc)
{
  GtUword numofleaves,
                m;
  FILE *fp = rcr_enc->output;

  gt_xfwrite_one(&rcr_enc->numofreads, fp);
  gt_xfwrite_one(&rcr_enc->cons_readlength, fp);

  if (!rcr_enc->cons_readlength) {
    numofleaves = gt_huffman_numofsymbols(rcr_enc->readlenghts_huff);
    gt_xfwrite_one(&numofleaves, fp);
    gt_xfwrite_one(&rcr_enc->max_read_length, fp);
    if (rcr_write_distr_to_file(fp, rcr_enc->readlenghts_huff) != 0)
      return -1;
  }
  else {
    gt_xfwrite_one(&rcr_enc->readlength, fp);
  }

  gt_xfwrite_one(&rcr_enc->store_all_qual, fp);
  gt_xfwrite_one(&rcr_enc->store_var_qual, fp);

  if (rcr_enc->store_all_qual || rcr_enc->store_var_qual) {
    numofleaves = gt_huffman_numofsymbols(rcr_enc->qual_huff);

    gt_xfwrite_one(&numofleaves, fp);
    if (rcr_write_distr_to_file(fp, rcr_enc->qual_huff) != 0)
      return -1;
  }
  gt_xfwrite_one(&rcr_enc->store_mapping_qual, fp);

  if (rcr_enc->store_mapping_qual) {
    numofleaves = gt_huffman_numofsymbols(rcr_enc->qual_mapping_huff);
    gt_xfwrite_one(&numofleaves, fp);
    if (rcr_write_distr_to_file(fp, rcr_enc->qual_mapping_huff) != 0)
      return -1;
  }

  m = gt_golomb_get_m(rcr_enc->readpos_golomb);
  gt_xfwrite_one(&m, fp);

  if (rcr_enc->varpos_golomb != NULL)
    m = gt_golomb_get_m(rcr_enc->varpos_golomb);
  else
    m = GT_UNDEF_UWORD;

  gt_xfwrite_one(&m, fp);

  gt_xfwrite(rcr_enc->present_cigar_ops, sizeof (*rcr_enc->present_cigar_ops),
             (size_t) (ENDOFRECORD + 1), fp);

  gt_xfwrite(rcr_enc->ins_bases, sizeof (GtUint64),
             (size_t) gt_alphabet_size(gt_encseq_alphabet(rcr_enc->encseq)) + 1,
             fp);

  return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
addq $0x198, %rdi            # imm = 0x198
movq 0x10(%rsp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x28(%rsp), %rdi
addq $0x1b8, %rdi            # imm = 0x1B8
movq 0x10(%rsp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x126d30
movq 0x28(%rsp), %rax
testb $0x1, 0x1b8(%rax)
jne 0x1c0215
movq 0x28(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x192530
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x28(%rsp), %rdi
addq $0x190, %rdi            # imm = 0x190
movq 0x10(%rsp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x60(%rax), %rsi
callq 0x1c0d80
cmpl $0x0, %eax
je 0x1c0213
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c043c
jmp 0x1c0235
movq 0x28(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq 0x10(%rsp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x28(%rsp), %rdi
addq $0x1bb, %rdi            # imm = 0x1BB
movq 0x10(%rsp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x126d30
movq 0x28(%rsp), %rdi
addq $0x1be, %rdi            # imm = 0x1BE
movq 0x10(%rsp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x126d30
movq 0x28(%rsp), %rax
testb $0x1, 0x1bb(%rax)
jne 0x1c028d
movq 0x28(%rsp), %rax
testb $0x1, 0x1be(%rax)
je 0x1c02e0
movq 0x28(%rsp), %rax
movq 0x68(%rax), %rdi
callq 0x192530
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x68(%rax), %rsi
callq 0x1c0d80
cmpl $0x0, %eax
je 0x1c02de
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c043c
jmp 0x1c02e0
movq 0x28(%rsp), %rdi
addq $0x1bc, %rdi            # imm = 0x1BC
movq 0x10(%rsp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x126d30
movq 0x28(%rsp), %rax
testb $0x1, 0x1bc(%rax)
je 0x1c035f
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x192530
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rsi
callq 0x1c0d80
cmpl $0x0, %eax
je 0x1c035d
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c043c
jmp 0x1c035f
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rdi
callq 0x181370
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rcx
leaq 0x18(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x28(%rsp), %rax
cmpq $0x0, 0x58(%rax)
je 0x1c03ac
movq 0x28(%rsp), %rax
movq 0x58(%rax), %rdi
callq 0x181370
movq %rax, 0x18(%rsp)
jmp 0x1c03b5
movq $-0x1, 0x18(%rsp)
movq 0x10(%rsp), %rcx
leaq 0x18(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x28(%rsp), %rdi
addq $0xf0, %rdi
movq 0x10(%rsp), %rcx
movl $0x8, %esi
movl $0xa, %edx
callq 0x126d30
movq 0x28(%rsp), %rax
movq 0xa8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rax
movq 0x98(%rax), %rdi
callq 0xb0f00
movq %rax, %rdi
callq 0x7e920
movq 0x8(%rsp), %rdi
movl %eax, %eax
movl %eax, %edx
addq $0x1, %rdx
movq 0x10(%rsp), %rcx
movl $0x8, %esi
callq 0x126d30
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)