// File: /workspace/github_c_makefile_star2_O2/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 0x168d40
movl %r9d, %ebp
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
cmpq $0x0, 0x50(%rdi)
jne 0x168b6b
movq 0x8(%r13), %rdi
testq %rdi, %rdi
je 0x168b5b
callq 0x754e5
movq %rax, 0x50(%r14)
movq 0x8(%r13), %rdi
callq 0x754dd
movq %rax, %rdi
callq 0x56d5a
jmp 0x168b67
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 0x168be0
movq 0x58(%r14), %rdi
testq %rdi, %rdi
jne 0x168b95
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x72260
movq %rax, %rdi
movq %rax, 0x58(%r14)
movq 0x18(%r14), %rdx
cmpq %r15, (%r14)
jae 0x168bc6
leaq 0x1e1557(%rip), %rax    # 0x34a0fc
movq %rdx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movl $0x214, %ecx            # imm = 0x214
callq 0x93472
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 0x71ea9
movq 0x50(%rsp), %rdx
jmp 0x168be8
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 0x168cc3
cmpq %r12, 0x8(%r14)
jae 0x168c46
movq 0x20(%r14), %rdi
movq %rbx, %r12
movq %rdx, %rbx
leaq 0x1e14dc(%rip), %rdx    # 0x34a0fc
movq 0x68(%rsp), %rsi
movl $0x226, %ecx            # imm = 0x226
callq 0x93472
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 0x168c8d
movq 0x60(%r14), %rdi
testq %rdi, %rdi
jne 0x168c78
movq %rsi, %rdi
xorl %esi, %esi
movq %rbx, 0x10(%rsp)
movq %rdx, %rbx
xorl %edx, %edx
callq 0x72260
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 0x71ea9
jmp 0x168ca3
testl %ebp, %ebp
je 0x168cc3
movq 0x20(%r14), %rdi
addq (%rdx), %r13
movq %r13, %rsi
movq %r12, %rdx
callq 0x17630
testl %ebp, %ebp
je 0x168cd8
cmpl $0x3, %ebp
je 0x168ccc
cmpl $0x1, %ebp
jne 0x168d78
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x18dd11
jmp 0x168cd8
addq (%rdx), %r13
movq %r13, 0x20(%r14)
jmp 0x168cd8
movq 0x20(%r14), %rdi
movq %r12, %rsi
callq 0x18dc7c
movq 0x58(%rsp), %r9
movq 0x18(%r14), %rsi
movq 0x28(%r14), %rdi
cmpb $0x0, 0x70(%rsp)
je 0x168d1e
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 0x168d2c
movq 0x20(%r14), %r8
movq %r12, (%rsp)
movq %rbx, %rdx
movq %r15, %rcx
callq 0x2b8d6d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2cf221(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17c2c2(%rip), %rsi    # 0x2e5013
leaq 0x1e2dc5(%rip), %rdx    # 0x34bb1d
leaq 0x1e1560(%rip), %rcx    # 0x34a2bf
leaq 0x1e1396(%rip), %r8     # 0x34a0fc
movl $0x1f8, %r9d            # imm = 0x1F8
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2cf1e9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17c28a(%rip), %rsi    # 0x2e5013
leaq 0x1e1553(%rip), %rdx    # 0x34a2e3
leaq 0x1e1528(%rip), %rcx    # 0x34a2bf
leaq 0x1e135e(%rip), %r8     # 0x34a0fc
movl $0x24f, %r9d            # imm = 0x24F
jmp 0x168d6c