// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/querymatch-align.c
// Function: gt_querymatchoutoptions_extract_seq
void gt_querymatchoutoptions_extract_seq(GtQuerymatchoutoptions
                                           *querymatchoutoptions,
                                         const GtSeqorEncseq *dbes,
                                         GtUword dbstart_relative,
                                         GtUword dbstart,
                                         GtUword dblen,
                                         GtReadmode query_readmode,
                                         const GtSeqorEncseq *queryes,
                                         GtUword querystart,
                                         GtUword abs_querystart_fwdstrand,
                                         GtUword querylen,
                                         bool withcorrection)
{
  gt_assert(querymatchoutoptions != NULL);
  if (querymatchoutoptions->characters == NULL)
  {
    if (dbes->encseq != NULL)
    {
      querymatchoutoptions->characters
        = gt_encseq_alphabetcharacters(dbes->encseq);
      querymatchoutoptions->wildcardshow
        = gt_alphabet_wildcard_show(gt_encseq_alphabet(dbes->encseq));
    } else
    {
      querymatchoutoptions->characters = dbes->characters;
      querymatchoutoptions->wildcardshow = dbes->wildcardshow;
    }
  }
  if (dbes->encseq != NULL)
  {
    if (querymatchoutoptions->db_esr_for_align_show == NULL)
    {
      querymatchoutoptions->db_esr_for_align_show
        = gt_encseq_create_reader_with_readmode(dbes->encseq,
                                                GT_READMODE_FORWARD,
                                                0);
    }
    if (dblen > querymatchoutoptions->useqbuffer_size)
    {
      querymatchoutoptions->useqbuffer
        = gt_realloc(querymatchoutoptions->useqbuffer,
                     sizeof *querymatchoutoptions->useqbuffer * dblen);
      querymatchoutoptions->useqbuffer_size = dblen;
    }
    gt_encseq_extract_encoded_with_reader(
                            querymatchoutoptions->db_esr_for_align_show,
                            dbes->encseq,
                            querymatchoutoptions->useqbuffer,
                            dbstart,
                            dbstart + dblen - 1);
  } else
  {
    querymatchoutoptions->useqbuffer = (GtUchar *) (dbes->seq + dbstart);
  }
  if ((queryes->encseq != NULL || query_readmode != GT_READMODE_FORWARD) &&
      querylen > querymatchoutoptions->vseqbuffer_size)
  {
    querymatchoutoptions->vseqbuffer
      = gt_realloc(querymatchoutoptions->vseqbuffer,
                   sizeof *querymatchoutoptions->vseqbuffer * querylen);
    querymatchoutoptions->vseqbuffer_size = querylen;
  }
  if (queryes->encseq != NULL)
  {
    if (querymatchoutoptions->query_esr_for_align_show == NULL)
    {
      querymatchoutoptions->query_esr_for_align_show
        = gt_encseq_create_reader_with_readmode(queryes->encseq,
                                                GT_READMODE_FORWARD,
                                                0);
    }
    gt_encseq_extract_encoded_with_reader(
                            querymatchoutoptions->query_esr_for_align_show,
                            queryes->encseq,
                            querymatchoutoptions->vseqbuffer,
                            abs_querystart_fwdstrand,
                            abs_querystart_fwdstrand + querylen - 1);
  } else
  {
    if (query_readmode != GT_READMODE_FORWARD)
    {
      memcpy(querymatchoutoptions->vseqbuffer,
             queryes->seq + abs_querystart_fwdstrand,
             querylen * sizeof *querymatchoutoptions->vseqbuffer);
    } else
    {
      querymatchoutoptions->vseqbuffer
        = (GtUchar *) (queryes->seq + abs_querystart_fwdstrand);
    }
  }
  if (query_readmode == GT_READMODE_REVERSE)
  {
    gt_inplace_reverse(querymatchoutoptions->vseqbuffer,querylen);
  } else
  {
    if (query_readmode == GT_READMODE_REVCOMPL)
    {
      gt_inplace_reverse_complement(querymatchoutoptions->vseqbuffer,querylen);
    } else
    {
      gt_assert(query_readmode == GT_READMODE_FORWARD);
    }
  }
  gt_querymatchoutoptions_set_sequences(querymatchoutoptions,
                                        dbstart_relative,
                                        dblen,
                                        querystart,
                                        querylen,
                                        withcorrection);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x1c2899
movl %r9d, %ebp
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
cmpq $0x0, 0x50(%rdi)
movq %r8, 0x10(%rsp)
jne 0x1c26fb
movq 0x8(%r13), %rdi
testq %rdi, %rdi
je 0x1c26eb
callq 0xf02e2
movq %rax, 0x50(%r14)
movq 0x8(%r13), %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3746
movq 0x10(%rsp), %r8
jmp 0x1c26f7
movq 0x28(%r13), %rax
movq %rax, 0x50(%r14)
movb 0x30(%r13), %al
movb %al, 0x70(%r14)
movq 0x8(%r13), %rdi
testq %rdi, %rdi
je 0x1c2762
cmpq $0x0, 0x58(%r14)
jne 0x1c271d
xorl %esi, %esi
xorl %edx, %edx
callq 0xed76d
movq 0x10(%rsp), %r8
movq %rax, 0x58(%r14)
cmpq %r8, (%r14)
jae 0x1c2746
movq 0x18(%r14), %rdi
leaq 0x1f0c32(%rip), %rdx    # 0x3b335f
movq %r8, %rsi
movl $0x214, %ecx            # imm = 0x214
callq 0x1094e6
movq 0x10(%rsp), %r8
movq %rax, 0x18(%r14)
movq %r8, (%r14)
movq 0x18(%r14), %rdx
movq 0x58(%r14), %rdi
movq 0x8(%r13), %rsi
addq %r12, %r8
decq %r8
movq %r12, %rcx
callq 0xed432
jmp 0x1c276a
addq (%r13), %r12
movq %r12, 0x18(%r14)
movq 0x50(%rsp), %rbx
movq 0x68(%rsp), %r12
testl %ebp, %ebp
jne 0x1c277f
cmpq $0x0, 0x8(%rbx)
je 0x1c27a5
cmpq %r12, 0x8(%r14)
jae 0x1c27a5
movq 0x20(%r14), %rdi
leaq 0x1f0bcf(%rip), %rdx    # 0x3b335f
movq %r12, %rsi
movl $0x226, %ecx            # imm = 0x226
callq 0x1094e6
movq %rax, 0x20(%r14)
movq %r12, 0x8(%r14)
movq 0x60(%rsp), %r13
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x1c27e4
cmpq $0x0, 0x60(%r14)
jne 0x1c27c7
xorl %esi, %esi
xorl %edx, %edx
callq 0xed76d
movq %rax, 0x60(%r14)
movq 0x20(%r14), %rdx
movq 0x60(%r14), %rdi
movq 0x8(%rbx), %rsi
leaq (%r12,%r13), %r8
decq %r8
movq %r13, %rcx
callq 0xed432
jmp 0x1c2803
testl %ebp, %ebp
je 0x1c27fc
movq 0x20(%r14), %rdi
addq (%rbx), %r13
movq %r13, %rsi
movq %r12, %rdx
callq 0x17660
jmp 0x1c2803
addq (%rbx), %r13
movq %r13, 0x20(%r14)
testl %ebp, %ebp
je 0x1c282f
cmpl $0x3, %ebp
je 0x1c2823
cmpl $0x1, %ebp
jne 0x1c289e
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x1e91e0
jmp 0x1c282f
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x1e9170
movq 0x58(%rsp), %r9
movq 0x18(%r14), %rsi
movq 0x28(%r14), %rdi
cmpb $0x0, 0x70(%rsp)
je 0x1c2875
movq 0x78(%r14), %rax
movq 0x80(%r14), %rdx
addq %rax, %rsi
addq %rax, %r15
movq 0x88(%r14), %rcx
movq 0x20(%r14), %r8
addq %rdx, %r8
addq %rdx, %r9
movq 0x90(%r14), %rax
movq %rax, (%rsp)
movq %r15, %rdx
jmp 0x1c2885
movq 0x20(%r14), %r8
movq %r12, (%rsp)
movq %r15, %rdx
movq 0x10(%rsp), %rcx
callq 0x32308f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x68e8b
callq 0x68e52