// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/editscript.c
// Function: gt_editscript_new_with_sequences
GtEditscript *gt_editscript_new_with_sequences(const GtEncseq *encseq,
                                               GtMultieoplist *multieops,
                                               GtUword start,
                                               GtReadmode dir)
{
  GtUword vlen, idx, meopidx, meoplen;
  GtEditscript *es;
  GtEditscriptBuilder es_b;
  GtMultieop meop;
  GtUchar cchar;

  gt_assert(encseq != NULL && multieops != NULL);
  es = gt_editscript_new(gt_encseq_alphabet(encseq));
  gt_editscript_builder_reset(&es_b, es);

  vlen = 0;

  meoplen = gt_multieoplist_get_num_entries(multieops);

  for (idx = meoplen; idx != 0; idx--) {
    meop = gt_multieoplist_get_entry(multieops, idx - 1);
    for (meopidx = 0; meopidx < meop.steps; meopidx++) {
      switch (meop.type) {
        case Match:
          vlen++;
          gt_editscript_builder_add_match(&es_b);
          break;
        case Replacement:
        case Mismatch:
          cchar = gt_encseq_get_encoded_char(encseq, start + vlen, dir);
          vlen++;
          gt_editscript_builder_add_mismatch(&es_b, cchar);
          break;
        case Insertion:
          cchar = gt_encseq_get_encoded_char(encseq, start + vlen, dir);
          vlen++;
          gt_editscript_builder_add_insertion(&es_b, cchar);
          break;
        case Deletion:
          gt_editscript_builder_add_deletion(&es_b);
          break;
        default:
          break;
      }
    }
  }
  if (es->num_elems != 0) {
    es->space = gt_realloc(es->space,
                           sizeof (*(es->space)) * (es_b.fillpos.cur_word + 1));
    es->size = es_b.fillpos.cur_word + 1;
  }
  else {
    es->size = 0;
    gt_free(es->space);
    es->space = NULL;
  }
  return(es);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, 0x4(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
testq %rdi, %rdi
je 0x137964
movq %rsi, %r15
testq %rsi, %rsi
je 0x137964
movq 0x8(%rsp), %rdi
callq 0xebcd9
movq %rax, %rdi
callq 0x13771c
leaq 0x30(%rsp), %rdi
movq %rax, 0x18(%rsp)
movq %rax, %rsi
callq 0x137969
movq %r15, %rdi
callq 0x162109
testq %rax, %rax
je 0x1378fe
movq %rax, %rsi
xorl %ebp, %ebp
leaq 0x243bc9(%rip), %r14    # 0x37b410
leaq 0x30(%rsp), %rbx
movq %r15, 0x20(%rsp)
decq %rsi
movq %r15, %rdi
movq %rsi, 0x28(%rsp)
callq 0x16210e
testq %rdx, %rdx
je 0x1378eb
movl %eax, %r15d
movq %rdx, %r13
movl %eax, %r12d
cmpl $0x4, %r15d
ja 0x1378e6
movslq (%r14,%r12,4), %rax
addq %r14, %rax
jmpq *%rax
movq 0x10(%rsp), %rax
leaq (%rax,%rbp), %rsi
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %edx
callq 0xe7bbc
incq %rbp
movzbl %al, %esi
jmp 0x1378de
movq 0x10(%rsp), %rax
leaq (%rax,%rbp), %rsi
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %edx
callq 0xe7bbc
incq %rbp
movzbl %al, %esi
movq %rbx, %rdi
callq 0x137b34
jmp 0x1378e6
incq %rbp
movq %rbx, %rdi
callq 0x1379ab
jmp 0x1378e6
movq 0x30(%rsp), %rax
movzbl 0x14(%rax), %esi
movq %rbx, %rdi
callq 0x1379c9
decq %r13
jne 0x137873
movq 0x28(%rsp), %rsi
testq %rsi, %rsi
movq 0x20(%rsp), %r15
jne 0x137851
movq 0x18(%rsp), %rbx
cmpl $0x0, 0xc(%rbx)
je 0x137932
movq (%rbx), %rdi
movl 0x38(%rsp), %esi
incl %esi
shlq $0x3, %rsi
leaq 0x243bfb(%rip), %rdx    # 0x37b518
movl $0x140, %ecx            # imm = 0x140
callq 0x104461
movl 0x38(%rsp), %ecx
incl %ecx
movl %ecx, 0x8(%rbx)
jmp 0x13794f
movl $0x0, 0x8(%rbx)
movq (%rbx), %rdi
leaq 0x243bd5(%rip), %rsi    # 0x37b518
movl $0x145, %edx            # imm = 0x145
callq 0x1045eb
xorl %eax, %eax
movq %rax, (%rbx)
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3fb27