// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/tools/gt_seqorder.c
// Function: gt_seqorder_handle_cases
static void gt_seqorder_handle_cases(const GtEncseq *encseq,
                                     const GtSeqorderArguments *arguments)
{
  GtUword i, nofseqs = gt_encseq_num_of_sequences(encseq);
  GtSuffixsortspace *suffixsortspace = NULL;

  if (arguments->invert)
  {
    for (i = nofseqs; i > 0; i--)
    {
      gt_seqorder_output(i - 1, encseq);
    }
    return;
  }
  if (arguments->shuffle || arguments->sorthdr || arguments->sorthdrnum ||
      arguments->sort_length)
  {
    const GtUword numofsequences = gt_encseq_num_of_sequences(encseq);
    GtUword *seqnums = gt_malloc(sizeof (GtUword) * nofseqs);
    if (arguments->shuffle)
    {
      gt_seqorder_get_shuffled_seqnums(nofseqs, seqnums);
    } else
    {
      GtCompareWithData seqordercmpfunc;
      void *data;

      for (i = 0UL; i < numofsequences; i++)
      {
        seqnums[i] = i;
      }
      if (arguments->sort_length)
      {
        seqordercmpfunc = seqorder_length_compare;
        data = (void *) gt_all_sequence_lengths_get(encseq);
      } else
      {
        data = (void *) encseq;
        if (arguments->sorthdr)
        {
          seqordercmpfunc = seqorder_str_compare_lex;
        } else
        {
          if (arguments->sorthdrnum)
          {
            seqordercmpfunc = seqorder_str_compare_num;
          } else
          {
            gt_assert(false);
            seqordercmpfunc = NULL;
          }
        }
      }
      if (data != NULL)
      {
        gt_assert(seqordercmpfunc != NULL);
        (void) gt_qsort_r(seqnums, numofsequences,sizeof *seqnums,
                          data,seqordercmpfunc);
      }
      if (arguments->sort_length && data != NULL)
      {
        gt_free(data);
      }
    }
    for (i = 0; i < nofseqs; i++)
    {
      gt_seqorder_output(seqnums[i], encseq);
    }
    gt_free(seqnums);
    return;
  }
  gt_assert(arguments->sort || arguments->revsort);
  suffixsortspace
    = gt_suffixsortspace_new(nofseqs,
                             /* Use iterator over sequence separators:
                                saves a lot of binary searches */
                             gt_encseq_seqstartpos(encseq, nofseqs-1),
                             false,NULL);
  gt_seqorder_sort(suffixsortspace, encseq);
  if (arguments->sort)
  {
    for (i = 0; i < nofseqs; i++)
    {
      GtUword pos = gt_suffixsortspace_getdirect(suffixsortspace,i);
      gt_seqorder_output(gt_encseq_seqnum(encseq,pos),encseq);
    }
  } else
  {
    for (i = nofseqs; i > 0; i--)
    {
      GtUword pos = gt_suffixsortspace_getdirect(suffixsortspace,i - 1);
      gt_seqorder_output(gt_encseq_seqnum(encseq,pos),encseq);
    }
  }
  gt_suffixsortspace_delete(suffixsortspace, false);
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x60(%rsp), %rdi
callq 0xa9d50
movq %rax, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x58(%rsp), %rax
testb $0x1, (%rax)
je 0x65cba
movq 0x48(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jbe 0x65cb5
movq 0x50(%rsp), %rdi
subq $0x1, %rdi
movq 0x60(%rsp), %rsi
callq 0x66060
movq 0x50(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x65c8a
jmp 0x6605a
movq 0x58(%rsp), %rax
testb $0x1, 0x3(%rax)
jne 0x65cea
movq 0x58(%rsp), %rax
testb $0x1, 0x4(%rax)
jne 0x65cea
movq 0x58(%rsp), %rax
testb $0x1, 0x5(%rax)
jne 0x65cea
movq 0x58(%rsp), %rax
testb $0x1, 0x6(%rax)
je 0x65efe
movq 0x60(%rsp), %rdi
callq 0xa9d50
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rdi
shlq $0x3, %rdi
leaq 0x4c3e0a(%rip), %rsi    # 0x529b13
movl $0x129, %edx            # imm = 0x129
callq 0xe80f0
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
testb $0x1, 0x3(%rax)
je 0x65d37
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x661a0
jmp 0x65ea6
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x65d6f
movq 0x50(%rsp), %rdx
movq 0x30(%rsp), %rax
movq 0x50(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x65d40
movq 0x58(%rsp), %rax
testb $0x1, 0x6(%rax)
je 0x65d97
leaq 0x4ef(%rip), %rax       # 0x66270
movq %rax, 0x28(%rsp)
movq 0x60(%rsp), %rdi
callq 0xaf1a0
movq %rax, 0x20(%rsp)
jmp 0x65e11
movq 0x60(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0x65dba
leaq 0x54d(%rip), %rax       # 0x66300
movq %rax, 0x28(%rsp)
jmp 0x65e0f
movq 0x58(%rsp), %rax
testb $0x1, 0x5(%rax)
je 0x65dd3
leaq 0x634(%rip), %rax       # 0x66400
movq %rax, 0x28(%rsp)
jmp 0x65e0d
jmp 0x65dd5
movq 0x5d61c4(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4b022d(%rip), %rsi    # 0x516013
leaq 0x4f2f76(%rip), %rdx    # 0x558d63
leaq 0x4c3fa2(%rip), %rcx    # 0x529d96
leaq 0x4c3d18(%rip), %r8     # 0x529b13
movl $0x147, %r9d            # imm = 0x147
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x65e0f
jmp 0x65e11
cmpq $0x0, 0x20(%rsp)
je 0x65e7b
jmp 0x65e1b
cmpq $0x0, 0x28(%rsp)
jne 0x65e5b
movq 0x5d6176(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4b01df(%rip), %rsi    # 0x516013
leaq 0x4c3f74(%rip), %rdx    # 0x529daf
leaq 0x4c3f54(%rip), %rcx    # 0x529d96
leaq 0x4c3cca(%rip), %r8     # 0x529b13
movl $0x14e, %r9d            # imm = 0x14E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x65e5d
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
movl $0x8, %edx
callq 0xfb9e0
movq 0x58(%rsp), %rax
testb $0x1, 0x6(%rax)
je 0x65ea4
cmpq $0x0, 0x20(%rsp)
je 0x65ea4
movq 0x20(%rsp), %rdi
leaq 0x4c3c79(%rip), %rsi    # 0x529b13
movl $0x154, %edx            # imm = 0x154
callq 0xe88c0
jmp 0x65ea6
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rax
jae 0x65ee3
movq 0x30(%rsp), %rax
movq 0x50(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x60(%rsp), %rsi
callq 0x66060
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x65eaf
movq 0x30(%rsp), %rdi
leaq 0x4c3c24(%rip), %rsi    # 0x529b13
movl $0x15b, %edx            # imm = 0x15B
callq 0xe88c0
jmp 0x6605a
jmp 0x65f00
movq 0x58(%rsp), %rax
testb $0x1, 0x1(%rax)
jne 0x65f4e
movq 0x58(%rsp), %rax
testb $0x1, 0x2(%rax)
jne 0x65f4e
movq 0x5d6083(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4b00ec(%rip), %rsi    # 0x516013
leaq 0x4c3e99(%rip), %rdx    # 0x529dc7
leaq 0x4c3e61(%rip), %rcx    # 0x529d96
leaq 0x4c3bd7(%rip), %r8     # 0x529b13
movl $0x15e, %r9d            # imm = 0x15E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x65f50
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x60(%rsp), %rdi
movq 0x48(%rsp), %rsi
subq $0x1, %rsi
callq 0xb0530
movq 0x8(%rsp), %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2e94c0
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x66620
movq 0x58(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x65ff6
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rax
jae 0x65ff4
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x2e9a60
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xb03a0
movq %rax, %rdi
movq 0x60(%rsp), %rsi
callq 0x66060
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x65fa8
jmp 0x6604e
movq 0x48(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jbe 0x6604c
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
subq $0x1, %rsi
callq 0x2e9a60
movq %rax, 0x10(%rsp)
movq 0x60(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb03a0
movq %rax, %rdi
movq 0x60(%rsp), %rsi
callq 0x66060
movq 0x50(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x66000
jmp 0x6604e
movq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x2e9940
addq $0x68, %rsp
retq
nop