// File: /workspace/github_c_makefile_star2_O3/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 0x7fb67
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x7f572
cmpl $-0x1, %eax
je 0x7feb1
testl %eax, %eax
jne 0x7fcaa
cmpb $0x1, 0x3b8(%rbx)
jne 0x7fb4b
movabsq $-0x1111111111111111, %rax # imm = 0xEEEEEEEEEEEEEEEF
imulq 0x368(%rbx), %rax
rorq $0x2, %rax
movabsq $0x444444444444445, %rcx # imm = 0x444444444444445
cmpq %rcx, %rax
jb 0x7fb4b
movl $0xa, %edi
callq 0xb870
movq $0x0, 0x3b0(%rbx)
pxor %xmm0, %xmm0
movdqu %xmm0, 0x360(%rbx)
jmp 0x7fca3
cmpb $0x0, 0x8(%rbx)
jne 0x7fb9e
cmpq $0x0, 0x28(%rbx)
je 0x7fb9a
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x7fec5
cmpl $-0x1, %eax
je 0x7feb1
testl %eax, %eax
je 0x7fb9a
incq %rbp
cmpq 0x28(%rbx), %rbp
jb 0x7fb76
movb $0x1, 0x8(%rbx)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x7fc91
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 0x7fc1d
movq 0x380(%rbx), %rdi
movq 0x10(%rax,%rcx), %rsi
cmpq %rsi, %rdi
cmovaq %rdi, %rsi
movq %rsi, 0x380(%rbx)
testq %rdx, %rdx
je 0x7fc0e
cmpq %rsi, %rdx
cmovbeq %rsi, %rdx
movq %rdx, 0x378(%rbx)
testq %rsi, %rsi
je 0x7fc1d
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 0x7fcfe
cmpb $-0x1, (%r13)
je 0x7fc71
leal -0x41(%rcx), %eax
cmpb $0x19, %al
ja 0x7fc5c
orb $0x20, %cl
movb %cl, (%r12)
movb $-0x2, (%r13)
movq 0x378(%rbx), %rax
testq %rax, %rax
je 0x7fcfe
cmpb $0x0, 0x388(%rbx)
je 0x7fd0a
movq 0x360(%rbx), %rcx
movq 0x3a8(%rbx), %rdx
jmp 0x7fe5e
movb $0x1, 0x389(%rbx)
movq $0x0, 0x360(%rbx)
xorl %eax, %eax
jmp 0x7feb1
movq 0x3b0(%rbx), %rax
cmpq 0x3a0(%rbx), %rax
jae 0x7fd34
movq 0x360(%rbx), %rcx
movq 0x390(%rbx), %rdx
movq %rax, %rsi
shlq $0x4, %rsi
cmpq (%rdx,%rsi), %rcx
jb 0x7fd34
addq %rsi, %rdx
cmpq 0x8(%rdx), %rcx
ja 0x7fd2a
cmpb $-0x1, (%r13)
je 0x7fd2a
movb (%r12), %al
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0x7fcf7
orb $0x20, %al
movb %al, (%r12)
movb $-0x2, (%r13)
jmp 0x7fd34
movb $0x0, 0x388(%rbx)
jmp 0x7fe73
movq 0x398(%rbx), %rsi
cmpq %rsi, 0x3a0(%rbx)
jae 0x7fdf4
movq 0x390(%rbx), %rax
jmp 0x7fe22
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 0x7fea5
cmpb $-0x1, (%r13)
je 0x7fda2
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 0x7fea5
movl $0xa, %edi
callq 0xb870
jmp 0x7fea5
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 0x7fde4
movl $0xa, %edi
callq 0xb870
movq $0x0, 0x368(%rbx)
jmp 0x7fea5
addq $0x64, %rsi
movq %rsi, 0x398(%rbx)
movq 0x390(%rbx), %rdi
shlq $0x4, %rsi
leaq 0x73279(%rip), %rdx     # 0xf308a
movl $0x1b7, %ecx            # imm = 0x1B7
callq 0x35a9d
movq %rax, 0x390(%rbx)
testq %rax, %rax
je 0x7fec0
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 0x7fe8b
movq %rax, 0x10(%rbx)
incq 0x360(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x7fec5
cmpl $-0x1, %eax
je 0x7feac
movl $0x1, %eax
jmp 0x7feb1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1dd78