// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/hcr.c
// Function: hcr_write_seq_qual_data
static int hcr_write_seq_qual_data(const char *name, GtHcrEncoder *hcr_enc,
                                   GtTimer *timer, GtError *err)
{
  int had_err = 0;
  FILE *fp;
  GtUword dummy = 0;
  GtWord pos;

  gt_error_check(err);

  fp = gt_fa_fopen_with_suffix(name, HCRFILESUFFIX, "wb", err);
  if (fp == NULL)
    had_err = -1;

  if (!had_err) {
    if (timer != NULL)
      gt_timer_show_progress(timer, "write sequences and qualities encoding",
                             stdout);
    hcr_write_file_info(fp, hcr_enc);

    had_err = hcr_write_seqdistrtab(fp, hcr_enc);

    if (!had_err) {
      bool is_not_at_pageborder;

      pos = ftell(fp);
      gt_xfwrite_one(&dummy, fp);

      is_not_at_pageborder = (ftell(fp) % hcr_enc->pagesize) != 0;

      if (is_not_at_pageborder)
        hcr_enc->seq_encoder->start_of_encoding =
          (ftell(fp) / hcr_enc->pagesize + 1) * hcr_enc->pagesize;
      else
        hcr_enc->seq_encoder->start_of_encoding = ftell(fp);

      if (hcr_enc->page_sampling)
        hcr_enc->seq_encoder->sampling =
          gt_sampling_new_page(hcr_enc->sampling_rate,
                               (off_t) hcr_enc->seq_encoder->start_of_encoding);
      else if (hcr_enc->regular_sampling)
        hcr_enc->seq_encoder->sampling =
          gt_sampling_new_regular(hcr_enc->sampling_rate,
                               (off_t) hcr_enc->seq_encoder->start_of_encoding);

      had_err = hcr_write_seqs(fp, hcr_enc, err);
    }
    if (!had_err) {
      gt_assert(fp);
      gt_xfseek(fp, pos, SEEK_SET);
      gt_xfwrite_one(&hcr_enc->seq_encoder->startofsamplingtab, fp);
    }
    gt_fa_xfclose(fp);
  }
  return 0;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x1884e9
movq 0x28(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1884b1
jmp 0x1884e9
movq 0x4b3ae8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38db51(%rip), %rsi    # 0x516013
leaq 0x38dcf6(%rip), %rdx    # 0x5161bf
leaq 0x3cce9b(%rip), %rcx    # 0x55536b
leaq 0x3cc814(%rip), %r8     # 0x554ceb
movl $0x215, %r9d            # imm = 0x215
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1884eb
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %r9
leaq 0x3ccb75(%rip), %rsi    # 0x555071
leaq 0x39e69a(%rip), %rdx    # 0x526b9d
leaq 0x3cc7e1(%rip), %rcx    # 0x554ceb
movl $0x217, %r8d            # imm = 0x217
callq 0xd92c0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x18852a
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x24(%rsp)
jne 0x188734
cmpq $0x0, 0x30(%rsp)
je 0x188558
movq 0x30(%rsp), %rdi
movq 0x4b39ef(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x3cce30(%rip), %rsi    # 0x555383
callq 0x121930
movq 0x18(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x1896c0
movq 0x18(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x189780
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jne 0x1886ad
movq 0x18(%rsp), %rdi
callq 0x19030
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x18(%rsp), %rdi
callq 0x19030
movq 0x38(%rsp), %rcx
xorl %edx, %edx
divq 0x30(%rcx)
cmpq $0x0, %rdx
setne %al
andb $0x1, %al
movb %al, 0x7(%rsp)
testb $0x1, 0x7(%rsp)
je 0x18860b
movq 0x18(%rsp), %rdi
callq 0x19030
movq 0x38(%rsp), %rcx
xorl %edx, %edx
divq 0x30(%rcx)
movq %rax, %rcx
addq $0x1, %rcx
movq 0x38(%rsp), %rax
imulq 0x30(%rax), %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x40(%rax)
jmp 0x188625
movq 0x18(%rsp), %rdi
callq 0x19030
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x40(%rax)
movq 0x38(%rsp), %rax
testb $0x1, 0x38(%rax)
je 0x18865d
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x40(%rax), %rsi
callq 0x1cff10
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x20(%rax)
jmp 0x188695
movq 0x38(%rsp), %rax
testb $0x1, 0x39(%rax)
je 0x188693
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x40(%rax), %rsi
callq 0x1cfce0
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x20(%rax)
jmp 0x188695
movq 0x18(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x189860
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jne 0x18872a
jmp 0x1886b6
cmpq $0x0, 0x18(%rsp)
jne 0x1886f6
movq 0x4b38db(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38d944(%rip), %rsi    # 0x516013
leaq 0x3cd075(%rip), %rdx    # 0x55574b
leaq 0x3ccc8e(%rip), %rcx    # 0x55536b
leaq 0x3cc607(%rip), %r8     # 0x554ceb
movl $0x23d, %r9d            # imm = 0x23D
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1886f8
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x126ca0
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x38, %rdi
movq 0x18(%rsp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
movq 0x18(%rsp), %rdi
callq 0xd9570
xorl %eax, %eax
addq $0x48, %rsp
retq
nopl (%rax,%rax)