// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/tools/gt_seqcorrect.c
// Function: gt_seqcorrect_apply_corrections
static int gt_seqcorrect_apply_corrections(GtEncseq *encseq,
    const char *indexname, const unsigned int threads,
    GtError *err)
{
  bool haserr = false;
  GtTwobitencEditor *editor;
  unsigned int threadcount;
  editor = gt_twobitenc_editor_new(encseq, indexname, err);
  if (editor == NULL)
    haserr = true;
  gt_log_log("number of correction lists: %u", threads);
  for (threadcount = 0; !haserr && threadcount < threads; threadcount++)
  {
    FILE *corrections;
    GtStr *filename;
    filename = gt_str_new_cstr(indexname);
    gt_str_append_char(filename, '.');
    gt_str_append_uint(filename, threadcount);
    gt_str_append_cstr(filename, GT_SEQCORRECT_CORRECTIONSLIST_FILESUFFIX);
    corrections = gt_fa_fopen(gt_str_get(filename), "r", err);
    gt_log_log("apply corrections list %s.%u%s", indexname, threadcount,
        GT_SEQCORRECT_CORRECTIONSLIST_FILESUFFIX);
    if (corrections == NULL)
      haserr = true;
    else
    {
      GtUword pos;
      GtUchar newchar;
      size_t retval;
      while ((retval = fread(&pos, sizeof (pos), (size_t)1, corrections))
          == (size_t)1)
      {
        newchar = (GtUchar)(pos & 3UL);
        pos >>= 2;
        gt_twobitenc_editor_edit(editor, pos, newchar);
      }
      if (ferror(corrections) != 0)
      {
        gt_error_set(err, "error by reading file %s", gt_str_get(filename));
        haserr = true;
      }
      gt_fa_fclose(corrections);
      gt_xunlink(gt_str_get(filename));
    }
    gt_str_delete(filename);
  }
  gt_twobitenc_editor_delete(editor);
  return haserr ? -1 : 0;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movl %edx, 0x64(%rsp)
movq %rcx, 0x58(%rsp)
movb $0x0, 0x57(%rsp)
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x2a01e0
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x64142
movb $0x1, 0x57(%rsp)
movl 0x64(%rsp), %esi
leaq 0x4c54bc(%rip), %rdi    # 0x529609
movb $0x0, %al
callq 0xe7740
movl $0x0, 0x44(%rsp)
xorl %eax, %eax
testb $0x1, 0x57(%rsp)
movb %al, 0x17(%rsp)
jne 0x64178
movl 0x44(%rsp), %eax
cmpl 0x64(%rsp), %eax
setb %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x64185
jmp 0x642ec
movq 0x68(%rsp), %rdi
callq 0x11d510
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movl $0x2e, %esi
callq 0x11da70
movq 0x30(%rsp), %rdi
movl 0x44(%rsp), %esi
callq 0x11de00
movq 0x30(%rsp), %rdi
leaq 0x4c52b6(%rip), %rsi    # 0x529473
callq 0x11d550
movq 0x30(%rsp), %rdi
callq 0x11dee0
movq %rax, %rdi
movq 0x58(%rsp), %r8
leaq 0x4c7dff(%rip), %rsi    # 0x52bfda
leaq 0x4c4d11(%rip), %rdx    # 0x528ef3
movl $0x161, %ecx            # imm = 0x161
callq 0xd8df0
movq %rax, 0x38(%rsp)
movq 0x68(%rsp), %rsi
movl 0x44(%rsp), %edx
leaq 0x4c5427(%rip), %rdi    # 0x529628
leaq 0x4c526b(%rip), %rcx    # 0x529473
movb $0x0, %al
callq 0xe7740
cmpq $0x0, 0x38(%rsp)
jne 0x64221
movb $0x1, 0x57(%rsp)
jmp 0x642d2
jmp 0x64223
movq 0x38(%rsp), %rcx
leaq 0x28(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x19a70
movq %rax, 0x18(%rsp)
cmpq $0x1, %rax
jne 0x64278
movq 0x28(%rsp), %rax
andq $0x3, %rax
movb %al, 0x27(%rsp)
movq 0x28(%rsp), %rax
shrq $0x2, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
movzbl 0x27(%rsp), %edx
callq 0x2a0380
jmp 0x64223
movq 0x38(%rsp), %rdi
callq 0x19e10
cmpl $0x0, %eax
je 0x642b6
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
callq 0x11dee0
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x4c539d(%rip), %rsi    # 0x529647
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0x57(%rsp)
movq 0x38(%rsp), %rdi
callq 0xd9390
movq 0x30(%rsp), %rdi
callq 0x11dee0
movq %rax, %rdi
callq 0x127980
movq 0x30(%rsp), %rdi
callq 0x11f560
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x6415c
movq 0x48(%rsp), %rdi
callq 0x2a04c0
movb 0x57(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x78, %rsp
retq
nopl (%rax)