// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/esa-merge.c
// Function: gt_emissionmergedesa_init
int gt_emissionmergedesa_init(Emissionmergedesa *emmesa,
                           const GtStrArray *indexnametab,
                           unsigned int demand,
                           GtLogger *logger,
                           GtError *err)
{
  unsigned int numofindexes;
  bool haserr = false;

  numofindexes = (unsigned int) gt_str_array_size(indexnametab);
  emmesa->buf.nextaccessidx = emmesa->buf.nextstoreidx = 0;
  emmesa->numofindexes = numofindexes;
  emmesa->numofentries = numofindexes;
  emmesa->ident = (uint64_t) numofindexes;
  emmesa->trierep.encseqreadinfo = NULL;
  emmesa->suffixarraytable = gt_malloc(sizeof *emmesa->suffixarraytable
                                       * numofindexes);
  emmesa->nextpostable = gt_malloc(sizeof *emmesa->nextpostable * numofindexes);
  if (inputthesequences(&emmesa->numofchars,
                        emmesa->nextpostable,
                        emmesa->suffixarraytable,
                        indexnametab,
                        demand,
                        logger,
                        err) != 0)
  {
    haserr = true;
  }
  if (!haserr && numofindexes > 1U)
  {
    unsigned int idx;

    emmesa->trierep.encseqreadinfo
      = gt_malloc(sizeof *emmesa->trierep.encseqreadinfo * numofindexes);
    for (idx = 0; idx < numofindexes; idx++)
    {
      emmesa->trierep.encseqreadinfo[idx].encseqptr
        = emmesa->suffixarraytable[idx].encseq;
      emmesa->trierep.encseqreadinfo[idx].readmode
        = emmesa->suffixarraytable[idx].readmode;
    }
    gt_mergertrie_initnodetable(&emmesa->trierep,(GtUword) numofindexes,
                             numofindexes);
    if (insertfirstsuffixes(&emmesa->trierep,
                           emmesa->nextpostable,
                           emmesa->suffixarraytable,
                           numofindexes,
                           err) != 0)
    {
      gt_free(emmesa->trierep.encseqreadinfo);
      emmesa->trierep.encseqreadinfo = NULL;
      haserr = true;
    }
  }
  if (haserr)
  {
    gt_free(emmesa->suffixarraytable);
    gt_free(emmesa->nextpostable);
  }
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, %r13
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x121e78
xorl %ecx, %ecx
movq %rcx, 0x18(%r14)
movl %eax, 0xc(%r14)
movl %eax, 0x8(%r14)
movq %rax, 0x28(%rsp)
movl %eax, %r15d
movq %r15, (%r14)
movq %rcx, 0x30028(%r14)
movq %r15, %rdi
shlq $0x8, %rdi
leaq 0xcf942(%rip), %rbx     # 0x3eb5ff
movq %rbx, %rsi
movl $0xf9, %edx
callq 0x1092b2
movq %rax, 0x30058(%r14)
movq %r15, 0x20(%rsp)
leaq (,%r15,8), %rdi
movq %rbx, %rsi
movq 0x8(%rsp), %rbx
movl $0xfa, %edx
callq 0x1092b2
movq %rax, %r15
movq %rax, 0x10(%r14)
movq %r14, (%rsp)
movq 0x30058(%r14), %r14
testq %rbx, %rbx
je 0x31bd17
movq %rbx, %rdi
callq 0x101a9a
testb %al, %al
jne 0x31bf35
movq %r12, %rdi
callq 0x121e78
testq %rax, %rax
je 0x31bd88
xorl %ebx, %ebx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x121cfa
movq %r14, %rdi
movl %ebp, %esi
movq %rax, %rdx
movq %r13, %rcx
movq 0x8(%rsp), %r8
callq 0x1a9f52
testl %eax, %eax
jne 0x31bd8c
testq %rbx, %rbx
jne 0x31bd69
movq (%r14), %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3713
movq (%rsp), %rcx
movl %eax, 0x30060(%rcx)
movq $0x0, (%r15,%rbx,8)
incq %rbx
movq %r12, %rdi
callq 0x121e78
addq $0x100, %r14            # imm = 0x100
cmpq %rax, %rbx
jb 0x31bd26
xorl %ebp, %ebp
jmp 0x31bd8f
movb $0x1, %bpl
movq 0x28(%rsp), %r15
cmpl $0x2, %r15d
setb %al
orb %bpl, %al
jne 0x31beeb
movq (%rsp), %rbx
leaq 0x30028(%rbx), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
shlq $0x4, %rdi
leaq 0xcf83b(%rip), %rsi     # 0x3eb5ff
movl $0x10a, %edx            # imm = 0x10A
callq 0x1092b2
movq %rax, 0x30028(%rbx)
movq 0x30058(%rbx), %rcx
movl %r15d, %edx
shlq $0x4, %rdx
xorl %esi, %esi
movq (%rcx), %rdi
movq %rdi, (%rax,%rsi)
movl 0x48(%rcx), %edi
movl %edi, 0x8(%rax,%rsi)
addq $0x100, %rcx            # imm = 0x100
addq $0x10, %rsi
cmpq %rsi, %rdx
jne 0x31bde5
movl %ebp, 0x1c(%rsp)
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl %r15d, %edx
callq 0x32a255
movq (%rsp), %rax
movq 0x10(%rax), %r12
movq 0x30058(%rax), %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x31be3f
callq 0x101a9a
testb %al, %al
jne 0x31bf3a
testl %r15d, %r15d
je 0x31bea4
movl %r15d, %ebp
addq $0xa0, %r14
xorl %r13d, %r13d
leaq 0x30(%rsp), %rbx
leaq 0x38(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31bbf6
testl %eax, %eax
je 0x31beaa
incq (%r12,%r13,8)
movq 0x30(%rsp), %rax
movq (%rsp), %rcx
movq 0x30038(%rcx), %rsi
movl %r13d, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq 0x10(%rsp), %rdi
movq %r15, %rdx
callq 0x329cc8
incq %r13
addq $0x100, %r14            # imm = 0x100
cmpq %r13, %rbp
jne 0x31be5b
movl 0x1c(%rsp), %ebp
jmp 0x31beeb
leaq 0xcf7a1(%rip), %rsi     # 0x3eb652
leaq 0xcf747(%rip), %rbx     # 0x3eb5ff
movq 0x8(%rsp), %rdi
movq %rbx, %rdx
movl $0x64, %ecx
xorl %eax, %eax
callq 0x1019cf
movq 0x10(%rsp), %r14
movq (%r14), %rdi
movq %rbx, %rsi
movl $0x11a, %edx            # imm = 0x11A
callq 0x109670
movq $0x0, (%r14)
movb $0x1, %bpl
testb %bpl, %bpl
je 0x31bf20
movq (%rsp), %r14
movq 0x30058(%r14), %rdi
leaq 0xcf6fd(%rip), %rbx     # 0x3eb5ff
movq %rbx, %rsi
movl $0x121, %edx            # imm = 0x121
callq 0x109670
movq 0x10(%r14), %rdi
movq %rbx, %rsi
movl $0x122, %edx            # imm = 0x122
callq 0x109670
movzbl %bpl, %eax
negl %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x92cc2
callq 0x92cf9