// File: /workspace/github_c_makefile_star2_O3/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 0x1b9c1d
movl %r9d, %ebp
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
cmpq $0x0, 0x50(%rdi)
jne 0x1b9a48
movq 0x8(%r13), %rdi
testq %rdi, %rdi
je 0x1b9a38
callq 0xebce1
movq %rax, 0x50(%r14)
movq 0x8(%r13), %rdi
callq 0xebcd9
movq %rax, %rdi
callq 0xd11f1
jmp 0x1b9a44
movq 0x28(%r13), %rax
movq %rax, 0x50(%r14)
movb 0x30(%r13), %al
movb %al, 0x70(%r14)
movq 0x50(%rsp), %rdx
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x1b9abd
movq 0x58(%r14), %rdi
testq %rdi, %rdi
jne 0x1b9a72
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, %rdi
movq %rax, 0x58(%r14)
movq 0x18(%r14), %rdx
cmpq %r15, (%r14)
jae 0x1b9aa3
leaq 0x1f02cd(%rip), %rax    # 0x3a9d4f
movq %rdx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movl $0x214, %ecx            # imm = 0x214
callq 0x104461
movq %rax, %rdx
movq %rax, 0x18(%r14)
movq %r15, (%r14)
movq 0x58(%r14), %rdi
movq 0x8(%r13), %rsi
leaq (%r12,%r15), %r8
decq %r8
movq %r12, %rcx
callq 0xe8e93
movq 0x50(%rsp), %rdx
jmp 0x1b9ac5
addq (%r13), %r12
movq %r12, 0x18(%r14)
movq 0x68(%rsp), %r12
movq 0x60(%rsp), %r13
movq 0x8(%rdx), %rsi
testq %rsi, %rsi
sete %al
testl %ebp, %ebp
sete %cl
testb %al, %cl
jne 0x1b9ba0
cmpq %r12, 0x8(%r14)
jae 0x1b9b23
movq 0x20(%r14), %rdi
movq %rbx, %r12
movq %rdx, %rbx
leaq 0x1f0252(%rip), %rdx    # 0x3a9d4f
movq 0x68(%rsp), %rsi
movl $0x226, %ecx            # imm = 0x226
callq 0x104461
movq %rbx, %rdx
movq %r12, %rbx
movq 0x68(%rsp), %r12
movq %rax, 0x20(%r14)
movq %r12, 0x8(%r14)
movq 0x8(%rdx), %rsi
testq %rsi, %rsi
je 0x1b9b6a
movq 0x60(%r14), %rdi
testq %rdi, %rdi
jne 0x1b9b55
movq %rsi, %rdi
xorl %esi, %esi
movq %rbx, 0x10(%rsp)
movq %rdx, %rbx
xorl %edx, %edx
callq 0xe91b2
movq %rax, %rdi
movq %rax, 0x60(%r14)
movq 0x8(%rbx), %rsi
movq 0x10(%rsp), %rbx
movq 0x20(%r14), %rdx
leaq (%r12,%r13), %r8
decq %r8
movq %r13, %rcx
callq 0xe8e93
jmp 0x1b9b80
testl %ebp, %ebp
je 0x1b9ba0
movq 0x20(%r14), %rdi
addq (%rdx), %r13
movq %r13, %rsi
movq %r12, %rdx
callq 0x17660
testl %ebp, %ebp
je 0x1b9bb5
cmpl $0x3, %ebp
je 0x1b9ba9
cmpl $0x1, %ebp
jne 0x1b9c22
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x1df988
jmp 0x1b9bb5
addq (%rdx), %r13
movq %r13, 0x20(%r14)
jmp 0x1b9bb5
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x1df918
movq 0x58(%rsp), %r9
movq 0x18(%r14), %rsi
movq 0x28(%r14), %rdi
cmpb $0x0, 0x70(%rsp)
je 0x1b9bfb
movq 0x78(%r14), %rax
movq 0x80(%r14), %rdx
addq %rax, %rsi
addq %rax, %rbx
movq 0x88(%r14), %rcx
movq 0x20(%r14), %r8
addq %rdx, %r8
addq %rdx, %r9
movq 0x90(%r14), %rax
movq %rax, (%rsp)
movq %rbx, %rdx
jmp 0x1b9c09
movq 0x20(%r14), %r8
movq %r12, (%rsp)
movq %rbx, %rdx
movq %r15, %rcx
callq 0x318d89
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x67623
callq 0x675ea