// File: /workspace/github_c_makefile_star2_O1/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 0x7faf3
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x7f4f4
cmpl $-0x1, %eax
je 0x7fe15
testl %eax, %eax
jne 0x7fcb3
cmpb $0x1, 0x3b8(%rbx)
jne 0x7fad7
movabsq $-0x1111111111111111, %rax # imm = 0xEEEEEEEEEEEEEEEF
imulq 0x368(%rbx), %rax
rorq $0x2, %rax
movabsq $0x444444444444445, %rcx # imm = 0x444444444444445
cmpq %rcx, %rax
jb 0x7fad7
movl $0xa, %edi
callq 0xb870
movq $0x0, 0x3b0(%rbx)
pxor %xmm0, %xmm0
movdqu %xmm0, 0x360(%rbx)
jmp 0x7fcac
cmpb $0x0, 0x8(%rbx)
jne 0x7fb2a
cmpq $0x0, 0x28(%rbx)
je 0x7fb26
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x7fe29
cmpl $-0x1, %eax
je 0x7fe15
testl %eax, %eax
je 0x7fb26
incq %rbp
cmpq 0x28(%rbx), %rbp
jb 0x7fb02
movb $0x1, 0x8(%rbx)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x7fc9a
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 0x7fba9
movq 0x380(%rbx), %rdi
movq 0x10(%rax,%rcx), %rsi
cmpq %rsi, %rdi
cmovaq %rdi, %rsi
movq %rsi, 0x380(%rbx)
testq %rdx, %rdx
je 0x7fb9a
cmpq %rsi, %rdx
cmovbeq %rsi, %rdx
movq %rdx, 0x378(%rbx)
testq %rsi, %rsi
je 0x7fba9
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), %al
movb %al, (%r12)
cmpq $0x0, 0x378(%rbx)
je 0x7fbe7
cmpb $-0x1, (%r13)
je 0x7fbe7
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0x7fbe2
orb $0x20, %al
movb %al, (%r12)
movb $-0x2, (%r13)
cmpq $0x0, 0x378(%rbx)
je 0x7fd0b
cmpb $0x0, 0x388(%rbx)
jne 0x7fc78
movq 0x398(%rbx), %rsi
cmpq %rsi, 0x3a0(%rbx)
jb 0x7fc3c
addq $0x64, %rsi
movq %rsi, 0x398(%rbx)
movq 0x390(%rbx), %rdi
shlq $0x4, %rsi
leaq 0x734af(%rip), %rdx     # 0xf30da
movl $0x1b7, %ecx            # imm = 0x1B7
callq 0x36116
movq %rax, 0x390(%rbx)
movq 0x390(%rbx), %rax
testq %rax, %rax
je 0x7fe24
movq 0x360(%rbx), %rcx
movq 0x3a0(%rbx), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x3a0(%rbx)
shlq $0x4, %rdx
leaq (%rax,%rdx), %rsi
movq %rsi, 0x3a8(%rbx)
movq %rcx, (%rax,%rdx)
movq 0x360(%rbx), %rax
movq 0x3a8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movb $0x1, 0x388(%rbx)
decq 0x378(%rbx)
jmp 0x7fd12
movb $0x1, 0x389(%rbx)
movq $0x0, 0x360(%rbx)
xorl %eax, %eax
jmp 0x7fe15
movq 0x3b0(%rbx), %rax
cmpq 0x3a0(%rbx), %rax
jae 0x7fd5c
movq 0x360(%rbx), %rcx
movq 0x390(%rbx), %rdx
movq %rax, %rsi
shlq $0x4, %rsi
cmpq (%rdx,%rsi), %rcx
jb 0x7fd5c
addq %rsi, %rdx
cmpq 0x8(%rdx), %rcx
ja 0x7fd52
cmpb $-0x1, (%r13)
je 0x7fd52
movb (%r12), %al
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0x7fd04
orb $0x20, %al
movb %al, (%r12)
movb $-0x2, (%r13)
jmp 0x7fd5c
movb $0x0, 0x388(%rbx)
movq 0x10(%rbx), %rax
movq 0x28(%rbx), %rcx
incq %rax
movq %rax, 0x10(%rbx)
subq %rcx, %rax
jb 0x7fd2a
movq %rax, 0x10(%rbx)
incq 0x360(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x7fe29
cmpl $-0x1, %eax
jne 0x7fe10
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x7fe15
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 0x7fe10
cmpb $-0x1, (%r13)
je 0x7fdc3
movsbl (%r12), %edi
callq 0xb870
movabsq $-0x1111111111111111, %rax # imm = 0xEEEEEEEEEEEEEEEF
imulq 0x368(%rbx), %rax
rorq $0x2, %rax
movabsq $0x444444444444444, %rcx # imm = 0x444444444444444
cmpq %rcx, %rax
ja 0x7fe10
movl $0xa, %edi
callq 0xb870
jmp 0x7fe10
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, %rax
movabsq $-0x1111111111111111, %rcx # imm = 0xEEEEEEEEEEEEEEEF
imulq %rax, %rcx
movabsq $0x1111111111111111, %rax # imm = 0x1111111111111111
addq %rcx, %rax
rorq $0x2, %rax
movabsq $0x444444444444445, %rcx # imm = 0x444444444444445
cmpq %rcx, %rax
jb 0x7fe05
movl $0xa, %edi
callq 0xb870
movq $0x0, 0x368(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1dda7