// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/sequence_buffer_dust.c
// Function: gt_dust_masker_next_with_original
int gt_dust_masker_next_with_original(GtDustMasker *dust_masker,
                                      GtSequenceBuffer* sb,
                                      GtUchar *val, char *orig, GtError* err)
{
  int retval;

  if (dust_masker->masking_done) {
    retval = gt_sequence_buffer_next_with_original_raw(sb, val, orig, err);
    if (retval == -1) {
      return -1;
    }
    if (retval == 0) {
      if (dust_masker->echo) {
        if (dust_masker->current_pos_local % 60 != 0) {
          printf("\n");
        }
      }

      dust_masker->current_region_index = 0;
      dust_masker->current_pos_total = 0;
      dust_masker->current_pos_local = 0;
      return 0;
    }
    if (dust_masker->current_region_index <
        dust_masker->masked_regions.nextfreeGtDustRange) {
      GtDustRange range;
      range = dust_masker->masked_regions.spaceGtDustRange[
                         dust_masker->current_region_index];
      if (dust_masker->current_pos_total >= range.begin) {
        if (dust_masker->current_pos_total <= range.end &&
            *val != GT_SEPARATOR) {
          if (*orig >= 'A' && *orig <= 'Z') {
            *orig += 32;
          }
          *val = GT_WILDCARD;
        } else {
          dust_masker->current_region_index++;
        }
      }
    }
    dust_masker->current_pos_total++;
    dust_masker->current_pos_local++;
    if (dust_masker->echo) {
      if (*val == GT_SEPARATOR) {
        if (dust_masker->current_pos_local % 60 != 1) {
          printf("\n");
        }
        dust_masker->current_pos_local = 0;
      } else {
        printf("%c",*orig);
        if (dust_masker->current_pos_local % 60 == 0) {
          printf("\n");
        }
      }
    }
  } else {
    if (!dust_masker->buf_initialized) {
      GtUword idx;
      for (idx = 0; idx < dust_masker->buf_size; idx++) {
        retval = gt_dust_masker_shift_window(dust_masker, sb, err);
        if (retval == -1) {
          return -1;
        } else {
          if (retval == 0) {
            break;
          }
        }
      }
      dust_masker->buf_initialized = true;
    }
    if (dust_masker->buf_remaining > 0) {
      dust_masker->buf_remaining--;
      dust_masker->mask_length
        = GT_MAX(dust_masker->mask_length,
                 dust_masker->buf[dust_masker->buf_readpos].mask_length);

      if (dust_masker->linker > 1) {
        dust_masker->next_mask
          = GT_MAX(dust_masker->next_mask,
                   dust_masker->buf[dust_masker->buf_readpos].next_mask);
        if (dust_masker->mask_length > 0) {
          dust_masker->mask_length = GT_MAX(dust_masker->mask_length,
                                            dust_masker->next_mask);
        }
        if (dust_masker->next_mask > 0) {
          dust_masker->next_mask--;
        }
      }

      *val = dust_masker->buf[dust_masker->buf_readpos].val;
      *orig = dust_masker->buf[dust_masker->buf_readpos].orig;
      if (dust_masker->mask_length > 0 && *val != GT_SEPARATOR) {
        if (*orig >= 'A' && *orig <= 'Z') {
          *orig += 32;
        }
        *val = GT_WILDCARD;
      }

      /* Insert into masked_regions */
      if (dust_masker->mask_length > 0) {
        if (dust_masker->current_is_masked == false) {
          GT_GETNEXTFREEINARRAY(dust_masker->current_region,
                                &dust_masker->masked_regions,
                                GtDustRange, GT_ARRAYEXTENDSIZE);
          dust_masker->current_region->begin = dust_masker->current_pos_total;
        }
        dust_masker->current_region->end = dust_masker->current_pos_total;
        dust_masker->current_is_masked = true;
        dust_masker->mask_length--;
      } else {
        dust_masker->current_is_masked = false;
      }
      dust_masker->buf_readpos++;
      wrap_value_once(&dust_masker->buf_readpos, dust_masker->buf_size);
    } else {
      dust_masker->masking_done = true;
      dust_masker->current_pos_total = 0;
      return 0;
    }
    dust_masker->current_pos_total++;
    retval = gt_dust_masker_shift_window(dust_masker, sb, err);
    if (retval == -1) {
      return -1;
    }
  }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
cmpb $0x1, 0x389(%rdi)
jne 0x5f251
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x5ec17
cmpl $-0x1, %eax
je 0x5f559
testl %eax, %eax
jne 0x5f376
cmpb $0x1, 0x3b8(%rbx)
jne 0x5f238
movq 0x368(%rbx), %rax
pushq $0x3c
popq %rcx
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
je 0x5f238
pushq $0xa
popq %rdi
callq 0xb860
andq $0x0, 0x3b0(%rbx)
pxor %xmm0, %xmm0
movdqu %xmm0, 0x360(%rbx)
jmp 0x5f3dd
cmpb $0x0, 0x8(%rbx)
jne 0x5f283
xorl %ebp, %ebp
cmpq 0x28(%rbx), %rbp
jae 0x5f27f
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5f5a0
cmpl $-0x1, %eax
je 0x5f559
testl %eax, %eax
je 0x5f27f
incq %rbp
jmp 0x5f259
movb $0x1, 0x8(%rbx)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x5f3ce
decq %rax
movq %rax, 0x20(%rbx)
movq 0x378(%rbx), %rsi
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movq 0x8(%rax,%rcx), %rdx
cmpq %rdx, %rsi
cmovaq %rsi, %rdx
movq %rdx, 0x378(%rbx)
cmpq $0x2, 0x3c8(%rbx)
jb 0x5f302
movq 0x380(%rbx), %rdi
movq 0x10(%rax,%rcx), %rsi
cmpq %rsi, %rdi
cmovaq %rdi, %rsi
movq %rsi, 0x380(%rbx)
testq %rdx, %rdx
je 0x5f2f3
cmpq %rsi, %rdx
cmovbeq %rsi, %rdx
movq %rdx, 0x378(%rbx)
testq %rsi, %rsi
je 0x5f302
decq %rsi
movq %rsi, 0x380(%rbx)
movb (%rax,%rcx), %al
movb %al, (%r13)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
shlq $0x5, %rcx
movb 0x1(%rax,%rcx), %cl
movb %cl, (%r12)
movq 0x378(%rbx), %rax
testq %rax, %rax
je 0x5f3e4
cmpb $-0x1, (%r13)
je 0x5f356
leal -0x41(%rcx), %eax
cmpb $0x19, %al
ja 0x5f341
orb $0x20, %cl
movb %cl, (%r12)
movb $-0x2, (%r13)
movq 0x378(%rbx), %rax
testq %rax, %rax
je 0x5f3e4
cmpb $0x0, 0x388(%rbx)
je 0x5f3f0
movq 0x360(%rbx), %rcx
movq 0x3a8(%rbx), %rdx
jmp 0x5f50b
movq 0x3b0(%rbx), %rax
cmpq 0x3a0(%rbx), %rax
jae 0x5f41a
movq 0x360(%rbx), %rcx
movq 0x390(%rbx), %rdx
movq %rax, %rsi
shlq $0x4, %rsi
cmpq (%rdx,%rsi), %rcx
jb 0x5f41a
addq %rsi, %rdx
cmpq 0x8(%rdx), %rcx
ja 0x5f410
cmpb $-0x1, (%r13)
je 0x5f410
movb (%r12), %al
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0x5f3c7
orb $0x20, %al
movb %al, (%r12)
movb $-0x2, (%r13)
jmp 0x5f41a
movb $0x1, 0x389(%rbx)
andq $0x0, 0x360(%rbx)
xorl %eax, %eax
jmp 0x5f559
movb $0x0, 0x388(%rbx)
jmp 0x5f520
movq 0x398(%rbx), %rsi
cmpq %rsi, 0x3a0(%rbx)
jae 0x5f4a1
movq 0x390(%rbx), %rax
jmp 0x5f4cf
incq %rax
movq %rax, 0x3b0(%rbx)
movdqu 0x360(%rbx), %xmm0
pcmpeqd %xmm1, %xmm1
psubq %xmm1, %xmm0
movdqu %xmm0, 0x360(%rbx)
cmpb $0x1, 0x3b8(%rbx)
jne 0x5f552
cmpb $-0x1, (%r13)
je 0x5f475
movsbl (%r12), %edi
callq 0xb860
movq 0x368(%rbx), %rax
pushq $0x3c
popq %rcx
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x5f552
pushq $0xa
popq %rdi
callq 0xb860
jmp 0x5f552
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, %rax
pushq $0x3c
popq %rcx
xorl %edx, %edx
divq %rcx
cmpl $0x1, %edx
je 0x5f494
pushq $0xa
popq %rdi
callq 0xb860
andq $0x0, 0x368(%rbx)
jmp 0x5f552
addq $0x64, %rsi
movq %rsi, 0x398(%rbx)
movq 0x390(%rbx), %rdi
shlq $0x4, %rsi
leaq 0x7cf2c(%rip), %rdx     # 0xdc3ea
movl $0x1b7, %ecx            # imm = 0x1B7
callq 0xcfc2
movq %rax, 0x390(%rbx)
testq %rax, %rax
je 0x5f568
movq 0x360(%rbx), %rcx
movq 0x3a0(%rbx), %rsi
leaq 0x1(%rsi), %rdx
movq %rdx, 0x3a0(%rbx)
shlq $0x4, %rsi
leaq (%rax,%rsi), %rdx
movq %rdx, 0x3a8(%rbx)
movq %rcx, (%rax,%rsi)
movq 0x378(%rbx), %rax
movq %rcx, 0x8(%rdx)
movb $0x1, 0x388(%rbx)
decq %rax
movq %rax, 0x378(%rbx)
movq 0x10(%rbx), %rax
movq 0x28(%rbx), %rcx
incq %rax
movq %rax, 0x10(%rbx)
subq %rcx, %rax
jb 0x5f538
movq %rax, 0x10(%rbx)
incq 0x360(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5f5a0
cmpl $-0x1, %eax
je 0x5f556
pushq $0x1
jmp 0x5f558
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xcea49(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x6aaed(%rip), %rsi     # 0xca066
leaq 0x7ceac(%rip), %rdx     # 0xdc42c
leaq 0x7ce83(%rip), %rcx     # 0xdc40a
leaq 0x7ce5c(%rip), %r8      # 0xdc3ea
movl $0x1b7, %r9d            # imm = 0x1B7
xorl %eax, %eax
callq 0xb8c0
callq 0xb300