// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %r8, %rbx
movq %rcx, %r13
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x11c131
xorl %ecx, %ecx
movq %rcx, 0x18(%r14)
movl %eax, 0xc(%r14)
movl %eax, 0x8(%r14)
movq %rax, 0x18(%rsp)
movl %eax, %r15d
movq %r15, (%r14)
movq %rcx, 0x30028(%r14)
movq %r15, %rdi
shlq $0x8, %rdi
leaq 0xd0534(%rip), %rsi     # 0x3e1edc
movl $0xf9, %edx
callq 0x104226
movq %rax, 0x30058(%r14)
movq %r15, 0x8(%rsp)
leaq (,%r15,8), %rdi
leaq 0xd050f(%rip), %rsi     # 0x3e1edc
movl $0xfa, %edx
callq 0x104226
movq %rax, %r15
movq %rax, 0x10(%r14)
movq %r14, (%rsp)
movq 0x30058(%r14), %r14
testq %rbx, %rbx
je 0x3119fe
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
jne 0x311bf3
movq %rbx, 0x10(%rsp)
movq %r12, %rdi
callq 0x11c131
testq %rax, %rax
je 0x311a78
xorl %ebx, %ebx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x11bfb3
movq %r14, %rdi
movl %ebp, %esi
movq %rax, %rdx
movq %r13, %rcx
movq 0x10(%rsp), %r8
callq 0x1a1676
testl %eax, %eax
jne 0x311baf
testq %rbx, %rbx
jne 0x311a59
movq (%r14), %rdi
callq 0xebcd9
movq %rax, %rdi
callq 0xd11be
movq (%rsp), %rcx
movl %eax, 0x30060(%rcx)
movq $0x0, (%r15,%rbx,8)
incq %rbx
movq %r12, %rdi
callq 0x11c131
addq $0x100, %r14            # imm = 0x100
cmpq %rax, %rbx
jb 0x311a12
xorl %eax, %eax
movq 0x18(%rsp), %r15
cmpl $0x2, %r15d
jb 0x311be4
movq (%rsp), %r14
leaq 0x30028(%r14), %r13
movq 0x8(%rsp), %rbx
shlq $0x4, %rbx
leaq 0xd0438(%rip), %rsi     # 0x3e1edc
movq %rbx, %rdi
movl $0x10a, %edx            # imm = 0x10A
callq 0x104226
movq %rax, 0x30028(%r14)
movq 0x30058(%r14), %rcx
xorl %edx, %edx
movq (%rcx), %rsi
movq %rsi, (%rax,%rdx)
movl 0x48(%rcx), %esi
movl %esi, 0x8(%rax,%rdx)
addq $0x100, %rcx            # imm = 0x100
addq $0x10, %rdx
cmpq %rdx, %rbx
jne 0x311ac1
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movl %r15d, %edx
callq 0x31ff15
movq (%rsp), %rax
movq 0x10(%rax), %r12
movq 0x30058(%rax), %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x311b15
callq 0xfcc32
testb %al, %al
jne 0x311bf8
addq $0xa0, %rbx
xorl %ebp, %ebp
leaq 0x20(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3118e7
testl %eax, %eax
je 0x311b74
incq (%r12,%rbp,8)
movq 0x20(%rsp), %rax
movq (%rsp), %rcx
movq 0x30038(%rcx), %rsi
movl %ebp, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movq %r13, %rdi
movq %r15, %rdx
callq 0x31fa2c
incq %rbp
addq $0x100, %rbx            # imm = 0x100
cmpq %rbp, 0x8(%rsp)
jne 0x311b28
xorl %eax, %eax
jmp 0x311be4
leaq 0xd03b4(%rip), %rsi     # 0x3e1f2f
leaq 0xd035a(%rip), %rbx     # 0x3e1edc
movq 0x10(%rsp), %rdi
movq %rbx, %rdx
movl $0x64, %ecx
xorl %eax, %eax
callq 0xfcb67
movq (%r13), %rdi
movq %rbx, %rsi
movl $0x11a, %edx            # imm = 0x11A
callq 0x1045eb
movq $0x0, (%r13)
movq (%rsp), %r14
movq 0x30058(%r14), %rdi
leaq 0xd031b(%rip), %rbx     # 0x3e1edc
movq %rbx, %rsi
movl $0x121, %edx            # imm = 0x121
callq 0x1045eb
movq 0x10(%r14), %rdi
movq %rbx, %rsi
movl $0x122, %edx            # imm = 0x122
callq 0x1045eb
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x90e21
callq 0x90e58