// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/editscript.c
// Function: gt_editscript_get_sub_sequence_u
GtUword gt_editscript_get_sub_sequence_u(const GtEditscript *editscript,
                                         const GtEncseq *encseq,
                                         GtUword start,
                                         GtReadmode dir,
                                         GtUword ufrompos,
                                         GtUword utopos,
                                         GtUchar **buffer,
                                         GtUword *bufsize)
{
  GtEditscriptPos pos;
  GtBitsequence elem = 0;
  GtUword uidx,
          bufidx = 0;
  uint32_t j,
           elems_served = 0,
           matchcount;

  gt_assert(encseq != NULL && editscript != NULL);

  editscript_pos_reset(&pos);

  uidx = start;

  /* overflow check */
  gt_assert(ufrompos < utopos &&
            utopos - ufrompos < GT_MULT2(utopos - ufrompos));
  /* as v can be longer than the range from u (due to insertions), we use a
     larger buffer */
  if (*buffer == NULL) {
    *bufsize = GT_MULT2(utopos - ufrompos);
    *buffer = gt_malloc(sizeof (**buffer) * *bufsize);
  }

  if (editscript->num_elems != 0) {
    bool mismatch_or_deletion;
    elem = editscript_space_get_next(editscript, &pos);
    elems_served++;
    while (elems_served < editscript->num_elems && uidx <= start + utopos) {
      gt_assert(elem <= GT_EDITSCRIPT_INS_SYM(editscript));
      matchcount = (uint32_t) editscript_space_get_length(editscript, &pos,
                                                          &elems_served);
      for (j = 0;
           uidx <= start + utopos &&
           j < matchcount;
           ++j) {
        if (uidx >= start + ufrompos) {
          (*buffer)[bufidx++] =
            gt_encseq_get_encoded_char(encseq, uidx, dir);
          if (bufidx == *bufsize) {
            *bufsize += GT_MULT2(start + utopos - uidx);
            *buffer = gt_realloc(*buffer, sizeof (**buffer) * *bufsize);
          }
        }
        uidx++;
      }
      mismatch_or_deletion = elem == GT_EDITSCRIPT_MISDEL_SYM(editscript);
      while (elems_served < editscript->num_elems && uidx <= start + utopos) {
        elem = editscript_space_get_next(editscript, &pos);
        elems_served++;
        if (elem > (GtBitsequence) editscript->del) {
          break;
        }
        if (elem < (GtBitsequence) editscript->del) {
          if (uidx > start + ufrompos ||
              (mismatch_or_deletion && uidx == ufrompos)) {
            (*buffer)[bufidx++] =
              (elem == (GtBitsequence) editscript->del - 1) ?
              (GtUchar) GT_WILDCARD :
              (GtUchar) elem;
            if (bufidx == *bufsize) {
              *bufsize += GT_MULT2(start + utopos - uidx);
              *buffer = gt_realloc(*buffer, sizeof (**buffer) * *bufsize);
            }
          }
        }
        if (mismatch_or_deletion) uidx++;
      }
    }
  }
  for (j = 0;
       uidx <= start + utopos &&
         j < (uint32_t) editscript->trailing_matches;
       ++j) {
    (*buffer)[bufidx++] = gt_encseq_get_encoded_char(encseq, uidx, dir);
    uidx++;
  }
  gt_assert(uidx == start + utopos + 1);
  return(bufidx);
}

// Assembly:
subq $0x68, %rsp
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rax
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movl %ecx, 0x4c(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
cmpq $0x0, 0x58(%rsp)
je 0x15b815
cmpq $0x0, 0x60(%rsp)
jne 0x15b84d
movq 0x4e0784(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3ba7ed(%rip), %rsi    # 0x516013
leaq 0x3f2408(%rip), %rdx    # 0x54dc35
leaq 0x3f2426(%rip), %rcx    # 0x54dc5a
leaq 0x3f21dd(%rip), %r8     # 0x54da18
movl $0x219, %r9d            # imm = 0x219
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x15b84f
leaq 0x30(%rsp), %rdi
callq 0x15ad60
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x15b88b
movq 0x38(%rsp), %rax
subq 0x40(%rsp), %rax
movq 0x38(%rsp), %rcx
subq 0x40(%rsp), %rcx
shlq %rcx
cmpq %rcx, %rax
jb 0x15b8c3
movq 0x4e070e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3ba777(%rip), %rsi    # 0x516013
leaq 0x3f23d8(%rip), %rdx    # 0x54dc7b
leaq 0x3f23b0(%rip), %rcx    # 0x54dc5a
leaq 0x3f2167(%rip), %r8     # 0x54da18
movl $0x221, %r9d            # imm = 0x221
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x15b8c5
movq 0x70(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x15b90d
movq 0x38(%rsp), %rcx
subq 0x40(%rsp), %rcx
shlq %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
movq 0x78(%rsp), %rax
movq (%rax), %rdi
shlq $0x0, %rdi
leaq 0x3f2120(%rip), %rsi    # 0x54da18
movl $0x226, %edx            # imm = 0x226
callq 0xe80f0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
movq 0x60(%rsp), %rax
cmpl $0x0, 0xc(%rax)
je 0x15bc89
movq 0x60(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x15ad80
movq %rax, 0x28(%rsp)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %ecx
movq 0x60(%rsp), %rdx
xorl %eax, %eax
cmpl 0xc(%rdx), %ecx
movb %al, 0xa(%rsp)
jae 0x15b968
movq 0x20(%rsp), %rax
movq 0x50(%rsp), %rcx
addq 0x38(%rsp), %rcx
cmpq %rcx, %rax
setbe %al
movb %al, 0xa(%rsp)
movb 0xa(%rsp), %al
testb $0x1, %al
jne 0x15b975
jmp 0x15bc87
jmp 0x15b977
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movzbl 0x14(%rcx), %ecx
addq $0x2, %rcx
cmpq %rcx, %rax
jbe 0x15b9c6
movq 0x4e060b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3ba674(%rip), %rsi    # 0x516013
leaq 0x3f231a(%rip), %rdx    # 0x54dcc0
leaq 0x3f22ad(%rip), %rcx    # 0x54dc5a
leaq 0x3f2064(%rip), %r8     # 0x54da18
movl $0x22e, %r9d            # imm = 0x22E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x15b9c8
movq 0x60(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x15ae90
movl %eax, 0xc(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x20(%rsp), %rcx
movq 0x50(%rsp), %rdx
addq 0x38(%rsp), %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0x9(%rsp)
ja 0x15ba11
movl 0x14(%rsp), %eax
cmpl 0xc(%rsp), %eax
setb %al
movb %al, 0x9(%rsp)
movb 0x9(%rsp), %al
testb $0x1, %al
jne 0x15ba1e
jmp 0x15bae3
movq 0x20(%rsp), %rax
movq 0x50(%rsp), %rcx
addq 0x40(%rsp), %rcx
cmpq %rcx, %rax
jb 0x15bac5
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x4c(%rsp), %edx
callq 0xa9da0
movb %al, %dl
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x18(%rsp)
movb %dl, (%rax,%rcx)
movq 0x18(%rsp), %rax
movq 0x78(%rsp), %rcx
cmpq (%rcx), %rax
jne 0x15bac3
movq 0x50(%rsp), %rcx
addq 0x38(%rsp), %rcx
subq 0x20(%rsp), %rcx
shlq %rcx
movq 0x78(%rsp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x70(%rsp), %rax
movq (%rax), %rdi
movq 0x78(%rsp), %rax
movq (%rax), %rsi
shlq $0x0, %rsi
leaq 0x3f1f6a(%rip), %rdx    # 0x54da18
movl $0x23a, %ecx            # imm = 0x23A
callq 0xe8540
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
jmp 0x15bac5
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x15b9e8
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movzbl 0x14(%rcx), %ecx
addq $0x1, %rcx
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movb %al, 0xb(%rsp)
movl 0x10(%rsp), %ecx
movq 0x60(%rsp), %rdx
xorl %eax, %eax
cmpl 0xc(%rdx), %ecx
movb %al, 0x8(%rsp)
jae 0x15bb2e
movq 0x20(%rsp), %rax
movq 0x50(%rsp), %rcx
addq 0x38(%rsp), %rcx
cmpq %rcx, %rax
setbe %al
movb %al, 0x8(%rsp)
movb 0x8(%rsp), %al
testb $0x1, %al
jne 0x15bb3b
jmp 0x15bc82
movq 0x60(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x15ad80
movq %rax, 0x28(%rsp)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movzbl 0x14(%rcx), %ecx
cmpq %rcx, %rax
jbe 0x15bb72
jmp 0x15bc82
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movzbl 0x14(%rcx), %ecx
cmpq %rcx, %rax
jae 0x15bc68
movq 0x20(%rsp), %rax
movq 0x50(%rsp), %rcx
addq 0x40(%rsp), %rcx
cmpq %rcx, %rax
ja 0x15bbb8
testb $0x1, 0xb(%rsp)
je 0x15bc66
movq 0x20(%rsp), %rax
cmpq 0x40(%rsp), %rax
jne 0x15bc66
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movzbl 0x14(%rcx), %ecx
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x15bbda
movl $0xfe, %eax
movl %eax, 0x4(%rsp)
jmp 0x15bbe6
movq 0x28(%rsp), %rax
movzbl %al, %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movb %al, %dl
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x18(%rsp)
movb %dl, (%rax,%rcx)
movq 0x18(%rsp), %rax
movq 0x78(%rsp), %rcx
cmpq (%rcx), %rax
jne 0x15bc64
movq 0x50(%rsp), %rcx
addq 0x38(%rsp), %rcx
subq 0x20(%rsp), %rcx
shlq %rcx
movq 0x78(%rsp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x70(%rsp), %rax
movq (%rax), %rdi
movq 0x78(%rsp), %rax
movq (%rax), %rsi
shlq $0x0, %rsi
leaq 0x3f1dc9(%rip), %rdx    # 0x54da18
movl $0x24f, %ecx            # imm = 0x24F
callq 0xe8540
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
jmp 0x15bc66
jmp 0x15bc68
testb $0x1, 0xb(%rsp)
je 0x15bc7d
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x15bb01
jmp 0x15b93b
jmp 0x15bc89
movl $0x0, 0x14(%rsp)
movq 0x20(%rsp), %rcx
movq 0x50(%rsp), %rdx
addq 0x38(%rsp), %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0x3(%rsp)
ja 0x15bcbe
movl 0x14(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x10(%rcx), %eax
setb %al
movb %al, 0x3(%rsp)
movb 0x3(%rsp), %al
testb $0x1, %al
jne 0x15bcc8
jmp 0x15bd17
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x4c(%rsp), %edx
callq 0xa9da0
movb %al, %dl
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x18(%rsp)
movb %dl, (%rax,%rcx)
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x15bc91
jmp 0x15bd19
movq 0x20(%rsp), %rax
movq 0x50(%rsp), %rcx
addq 0x38(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x15bd69
movq 0x4e0268(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3ba2d1(%rip), %rsi    # 0x516013
leaq 0x3f1fa1(%rip), %rdx    # 0x54dcea
leaq 0x3f1f0a(%rip), %rcx    # 0x54dc5a
leaq 0x3f1cc1(%rip), %r8     # 0x54da18
movl $0x25e, %r9d            # imm = 0x25E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x15bd6b
movq 0x18(%rsp), %rax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)