// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/sfx-sain.c
// Function: gt_sainseq_new_from_array
static GtSainseq *gt_sainseq_new_from_array(GtUsainindextype *arr,
                                            GtUword len,
                                            GtUword numofchars,
                                            GtUsainindextype *suftab,
                                            GtUsainindextype firstusable,
                                            GtUword suftabentries)
{
  GtUword charidx;
  GtUsainindextype *cptr;
  GtSainseq *sainseq = (GtSainseq *) gt_malloc(sizeof *sainseq);

  sainseq->seqtype = GT_SAIN_INTSEQ;
  sainseq->seq.array = arr;
  sainseq->totallength = len;
  sainseq->bare_encseq = NULL;
  sainseq->readmode = GT_READMODE_FORWARD;
  sainseq->numofchars = numofchars;
  gt_assert((GtUword) firstusable < suftabentries);
  if (suftabentries - firstusable >= numofchars)
  {
    /*printf("bucketsize: reclaim suftab["GT_WU","GT_WU"]\n",
            suftabentries - numofchars,suftabentries-1);*/
    sainseq->bucketsize = suftab + suftabentries - numofchars;
    sainseq->bucketsizepoints2suftab = true;
  } else
  {
    /*printf("bucketsize requires "GT_WU" entries and only "GT_WU" are left\n",
              numofchars,suftabentries - firstusable);*/
    sainseq->bucketsizepoints2suftab = false;
    sainseq->bucketsize
      = (GtUsainindextype *)
        gt_malloc(sizeof (*sainseq->bucketsize) * numofchars);
  }
  if (suftabentries - firstusable >= GT_MULT2(numofchars))
  {
    /*printf("bucketfillptr: reclaim suftab["GT_WU","GT_WU"]\n",
            suftabentries - GT_MULT2(numofchars),
            suftabentries - numofchars -1);*/
    sainseq->bucketfillptr = suftab + suftabentries - GT_MULT2(numofchars);
    sainseq->bucketfillptrpoints2suftab = true;
  } else
  {
    /*
    printf("bucketfillptr requires "GT_WU" entries and only "
           GT_WU" are left\n", numofchars,suftabentries - firstusable);*/
    sainseq->bucketfillptrpoints2suftab = false;
    sainseq->bucketfillptr
      = (GtUsainindextype *)
        gt_malloc(sizeof (*sainseq->bucketfillptr) * numofchars);
  }
  if (gt_sain_decideforfastmethod(len+1,len,numofchars))
  {
    if (suftabentries - firstusable >= GT_MULT4(numofchars))
    {
      /*printf("roundtable: reclaim suftab["GT_WU","GT_WU"]\n",
              suftabentries - GT_MULT4(numofchars),
              suftabentries - GT_MULT2(numofchars) - 1);*/
      sainseq->roundtable = suftab + suftabentries - GT_MULT4(numofchars);
      sainseq->roundtablepoints2suftab = true;
    } else
    {
      sainseq->roundtablepoints2suftab = false;
      sainseq->roundtable
        = (GtUsainindextype *)
          gt_malloc(sizeof (*sainseq->roundtable) * GT_MULT2(numofchars));
    }
  } else
  {
    sainseq->roundtablepoints2suftab = false;
    sainseq->roundtable = NULL;
  }
  sainseq->sstarfirstcharcount = NULL;
  for (charidx = 0; charidx < sainseq->numofchars; charidx++)
  {
    sainseq->bucketsize[charidx] = 0;
  }
  for (cptr = arr; cptr < arr + sainseq->totallength; cptr++)
  {
    gt_assert((GtUword) *cptr < numofchars);
    sainseq->bucketsize[*cptr]++;
  }
  return sainseq;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movl %r8d, 0x24(%rsp)
movq %r9, 0x18(%rsp)
movl $0x58, %edi
leaq 0x2b8d8a(%rip), %rsi    # 0x58c068
movl $0xcc, %edx
callq 0xe80f0
movq %rax, (%rsp)
movq (%rsp), %rax
movl $0x1, 0x50(%rax)
movq 0x40(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x38(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, (%rax)
movq (%rsp), %rax
movq $0x0, 0x48(%rax)
movq (%rsp), %rax
movl $0x0, 0x40(%rax)
movq 0x30(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x8(%rax)
movl 0x24(%rsp), %eax
cmpq 0x18(%rsp), %rax
jb 0x2d3377
movq 0x368c5a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x242cc3(%rip), %rsi    # 0x516013
leaq 0x2b980a(%rip), %rdx    # 0x58cb61
leaq 0x2b9829(%rip), %rcx    # 0x58cb87
leaq 0x2b8d03(%rip), %r8     # 0x58c068
movl $0xd4, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2d3379
movq 0x18(%rsp), %rax
movl 0x24(%rsp), %ecx
subq %rcx, %rax
cmpq 0x30(%rsp), %rax
jb 0x2d33bd
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rcx
xorl %eax, %eax
subq 0x30(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x18(%rax)
movq (%rsp), %rax
movb $0x1, 0x55(%rax)
jmp 0x2d33ea
movq (%rsp), %rax
movb $0x0, 0x55(%rax)
movq 0x30(%rsp), %rdi
shlq $0x2, %rdi
leaq 0x2b8c93(%rip), %rsi    # 0x58c068
movl $0xe2, %edx
callq 0xe80f0
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movl 0x24(%rsp), %ecx
subq %rcx, %rax
movq 0x30(%rsp), %rcx
shlq %rcx
cmpq %rcx, %rax
jb 0x2d343a
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movq 0x30(%rsp), %rdx
shlq %rdx
xorl %eax, %eax
subq %rdx, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x20(%rax)
movq (%rsp), %rax
movb $0x1, 0x54(%rax)
jmp 0x2d3467
movq (%rsp), %rax
movb $0x0, 0x54(%rax)
movq 0x30(%rsp), %rdi
shlq $0x2, %rdi
leaq 0x2b8c16(%rip), %rsi    # 0x58c068
movl $0xf3, %edx
callq 0xe80f0
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x38(%rsp), %rdi
addq $0x1, %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x2d20c0
testb $0x1, %al
jne 0x2d3488
jmp 0x2d350c
movq 0x18(%rsp), %rax
movl 0x24(%rsp), %ecx
subq %rcx, %rax
movq 0x30(%rsp), %rcx
shlq $0x2, %rcx
cmpq %rcx, %rax
jb 0x2d34da
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movq 0x30(%rsp), %rdx
shlq $0x2, %rdx
xorl %eax, %eax
subq %rdx, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x30(%rax)
movq (%rsp), %rax
movb $0x1, 0x56(%rax)
jmp 0x2d350a
movq (%rsp), %rax
movb $0x0, 0x56(%rax)
movq 0x30(%rsp), %rdi
shlq %rdi
shlq $0x2, %rdi
leaq 0x2b8b73(%rip), %rsi    # 0x58c068
movl $0x103, %edx            # imm = 0x103
callq 0xe80f0
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x2d3520
movq (%rsp), %rax
movb $0x0, 0x56(%rax)
movq (%rsp), %rax
movq $0x0, 0x30(%rax)
movq (%rsp), %rax
movq $0x0, 0x28(%rax)
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq (%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2d3568
movq (%rsp), %rax
movq 0x18(%rax), %rax
movq 0x10(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x2d3535
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rcx
movq (%rsp), %rdx
movq (%rdx), %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x2d3604
jmp 0x2d3591
movq 0x8(%rsp), %rax
movl (%rax), %eax
cmpq 0x30(%rsp), %rax
jb 0x2d35d7
movq 0x3689fa(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x242a63(%rip), %rsi    # 0x516013
leaq 0x2b95ea(%rip), %rdx    # 0x58cba1
leaq 0x2b95c9(%rip), %rcx    # 0x58cb87
leaq 0x2b8aa3(%rip), %r8     # 0x58c068
movl $0x111, %r9d            # imm = 0x111
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2d35d9
movq (%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rsp), %rcx
movl (%rcx), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x8(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x8(%rsp)
jmp 0x2d3572
movq (%rsp), %rax
addq $0x48, %rsp
retq
nopl (%rax)