// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %edx, 0x34(%rsp)
movq %rcx, 0x28(%rsp)
movq %r8, 0x20(%rsp)
movb $0x0, 0x1b(%rsp)
movq 0x38(%rsp), %rdi
callq 0x11fcc0
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rax
movl $0x0, 0x1c(%rax)
movq 0x40(%rsp), %rax
movl $0x0, 0x18(%rax)
movl 0x1c(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0x1c(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x8(%rax)
movl 0x1c(%rsp), %eax
movl %eax, %ecx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rax
movq $0x0, 0x30028(%rax)
movl 0x1c(%rsp), %eax
movl %eax, %edi
shlq $0x8, %rdi
leaq 0x10094f(%rip), %rsi    # 0x5b752d
movl $0xf9, %edx
callq 0xe80f0
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x30058(%rax)
movl 0x1c(%rsp), %eax
movl %eax, %edi
shlq $0x3, %rdi
leaq 0x100925(%rip), %rsi    # 0x5b752d
movl $0xfa, %edx
callq 0xe80f0
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x40(%rsp), %rdi
addq $0x30060, %rdi          # imm = 0x30060
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x40(%rsp), %rax
movq 0x30058(%rax), %rdx
movq 0x38(%rsp), %rcx
movl 0x34(%rsp), %r8d
movq 0x28(%rsp), %r9
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
callq 0x4b6e10
cmpl $0x0, %eax
je 0x4b6c66
movb $0x1, 0x1b(%rsp)
testb $0x1, 0x1b(%rsp)
jne 0x4b6db0
cmpl $0x1, 0x1c(%rsp)
jbe 0x4b6db0
movl 0x1c(%rsp), %eax
movl %eax, %edi
shlq $0x4, %rdi
leaq 0x1008a0(%rip), %rsi    # 0x5b752d
movl $0x10a, %edx            # imm = 0x10A
callq 0xe80f0
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x30028(%rax)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jae 0x4b6d2d
movq 0x40(%rsp), %rax
movq 0x30058(%rax), %rax
movl 0x14(%rsp), %ecx
shlq $0x8, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq 0x40(%rsp), %rax
movq 0x30028(%rax), %rax
movl 0x14(%rsp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rax
movq 0x30058(%rax), %rax
movl 0x14(%rsp), %ecx
shlq $0x8, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
movq 0x40(%rsp), %rax
movq 0x30028(%rax), %rax
movl 0x14(%rsp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x4b6cae
movq 0x40(%rsp), %rdi
addq $0x30028, %rdi          # imm = 0x30028
movl 0x1c(%rsp), %eax
movl %eax, %esi
movl 0x1c(%rsp), %edx
callq 0x4d2d30
movq 0x40(%rsp), %rdi
addq $0x30028, %rdi          # imm = 0x30028
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x40(%rsp), %rax
movq 0x30058(%rax), %rdx
movl 0x1c(%rsp), %ecx
movq 0x20(%rsp), %r8
callq 0x4b6f70
cmpl $0x0, %eax
je 0x4b6dae
movq 0x40(%rsp), %rax
movq 0x30028(%rax), %rdi
leaq 0x10079e(%rip), %rsi    # 0x5b752d
movl $0x11a, %edx            # imm = 0x11A
callq 0xe88c0
movq 0x40(%rsp), %rax
movq $0x0, 0x30028(%rax)
movb $0x1, 0x1b(%rsp)
jmp 0x4b6db0
testb $0x1, 0x1b(%rsp)
je 0x4b6dee
movq 0x40(%rsp), %rax
movq 0x30058(%rax), %rdi
leaq 0x100763(%rip), %rsi    # 0x5b752d
movl $0x121, %edx            # imm = 0x121
callq 0xe88c0
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x100749(%rip), %rsi    # 0x5b752d
movl $0x122, %edx            # imm = 0x122
callq 0xe88c0
movb 0x1b(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)