// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/rcr.c
// Function: rcr_write_data
static int rcr_write_data(const char *name, GtRcrEncoder *rcr_enc, GtError *err)
{
  bool is_not_at_pageborder;
  int had_err = 0;
  GtWord fpos;
  GtUword pagesize = gt_pagesize();
  GtStr *unmapped_reads_filename;
  gt_error_check(err);

  rcr_enc->output = gt_fa_fopen_with_suffix(name, RCRFILESUFFIX, "wb", err);
  if (rcr_enc->output == NULL)
    return -1;
  if (rcr_write_header_to_file(rcr_enc) != 0)
    return -1;
  fpos = ftell(rcr_enc->output);

  /* jump to beginning of next page */
  is_not_at_pageborder = (fpos % pagesize) != 0;
  if (is_not_at_pageborder)
    had_err = fseek(rcr_enc->output,
                    (fpos / pagesize + 1) * pagesize,
                    SEEK_SET);
  if (had_err)
    gt_error_set(err, "error calling fseek: %s", strerror(errno));
  else {
    if (rcr_enc->store_unmmaped_reads) {
      unmapped_reads_filename = gt_str_new_cstr(name);
      gt_str_append_cstr(unmapped_reads_filename, "_unmapped");
      rcr_enc->unmapped_reads_ptr =
        gt_fa_fopen_with_suffix(gt_str_get(unmapped_reads_filename),
                                ".fastq",
                                "w",
                                err);
      if (rcr_enc->unmapped_reads_ptr == NULL)
        had_err = -1;
      gt_str_delete(unmapped_reads_filename);
    }
    else
      rcr_enc->unmapped_reads_ptr = NULL;

    if (!had_err)
      had_err = rcr_write_encoding_to_file(rcr_enc, err);
    gt_fa_xfclose(rcr_enc->output);
    gt_fa_xfclose(rcr_enc->unmapped_reads_ptr);
  }
  return had_err;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movl $0x0, 0x20(%rsp)
callq 0xa2640
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x1bd155
movq 0x28(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1bd11d
jmp 0x1bd155
movq 0x47ee7c(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x358ee5(%rip), %rsi    # 0x516013
leaq 0x35908a(%rip), %rdx    # 0x5161bf
leaq 0x3a4661(%rip), %rcx    # 0x56179d
leaq 0x3a439c(%rip), %r8     # 0x5614df
movl $0x531, %r9d            # imm = 0x531
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1bd157
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %r9
leaq 0x3a4644(%rip), %rsi    # 0x5617ac
leaq 0x369a2e(%rip), %rdx    # 0x526b9d
leaq 0x3a4369(%rip), %rcx    # 0x5614df
movl $0x533, %r8d            # imm = 0x533
callq 0xd92c0
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x1bd1a4
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
jmp 0x1bd32e
movq 0x30(%rsp), %rdi
callq 0x1c0140
cmpl $0x0, %eax
je 0x1bd1c0
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
jmp 0x1bd32e
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x19030
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x10(%rsp)
cmpq $0x0, %rdx
setne %al
andb $0x1, %al
movb %al, 0x27(%rsp)
testb $0x1, 0x27(%rsp)
je 0x1bd222
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x18(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x10(%rsp)
movq %rax, %rsi
addq $0x1, %rsi
imulq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x197e0
movl %eax, 0x20(%rsp)
cmpl $0x0, 0x20(%rsp)
je 0x1bd258
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
callq 0x19060
movl (%rax), %edi
callq 0x19200
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x3a4565(%rip), %rsi    # 0x5617b1
movb $0x0, %al
callq 0xd88c0
jmp 0x1bd326
movq 0x30(%rsp), %rax
testb $0x1, 0x1bd(%rax)
je 0x1bd2e4
movq 0x38(%rsp), %rdi
callq 0x11d510
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x3a6dd8(%rip), %rsi    # 0x564059
callq 0x11d550
movq 0x8(%rsp), %rdi
callq 0x11dee0
movq %rax, %rdi
movq 0x28(%rsp), %r9
leaq 0x397bac(%rip), %rsi    # 0x554e4b
leaq 0x3a8c1f(%rip), %rdx    # 0x565ec5
leaq 0x3a4232(%rip), %rcx    # 0x5614df
movl $0x54a, %r8d            # imm = 0x54A
callq 0xd92c0
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x30(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1bd2d8
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdi
callq 0x11f560
jmp 0x1bd2f1
movq 0x30(%rsp), %rax
movq $0x0, 0x8(%rax)
cmpl $0x0, 0x20(%rsp)
jne 0x1bd30b
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x1c0450
movl %eax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0xd9570
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xd9570
movl 0x20(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw (%rax,%rax)