// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_delete
void gt_encseq_delete(GtEncseq *encseq)
{
  if (encseq == NULL)
    return;
  gt_mutex_lock(encseq->refcount_lock);
  if (encseq->reference_count) {
    encseq->reference_count--;
    gt_mutex_unlock(encseq->refcount_lock);
    return;
  }
  if (encseq->mappedptr != NULL) {
    if (encseq->bitpackarray != NULL) {
      /* store points to some subarea of the region mapped by mappedptr:
         therefore we have to set it to NULL to prevent that it is freed */
      BITPACKARRAYSTOREVAR(encseq->bitpackarray) = NULL;
      bitpackarray_delete(encseq->bitpackarray);
      encseq->bitpackarray = NULL;
    }
    gt_fa_xmunmap(encseq->mappedptr);
  }
  else {
    gt_free(encseq->headerptr.characterdistribution);
    switch (encseq->sat) {
      case  GT_ACCESS_TYPE_DIRECTACCESS:
        if (!encseq->hasplainseqptr)
          gt_free(encseq->plainseq);
        break;
      case GT_ACCESS_TYPE_BYTECOMPRESS:
        bitpackarray_delete(encseq->bitpackarray);
        encseq->bitpackarray = NULL;
        break;
      case GT_ACCESS_TYPE_EQUALLENGTH:
        gt_free(encseq->twobitencoding);
        break;
      case GT_ACCESS_TYPE_BITACCESS:
        gt_free(encseq->twobitencoding);
        gt_free(encseq->specialbits);
        encseq->specialbits = NULL;
        break;
      case GT_ACCESS_TYPE_UCHARTABLES:
        gt_free(encseq->twobitencoding);
        gt_free(encseq->wildcardrangetable.st_uchar.positions);
        gt_free(encseq->wildcardrangetable.st_uchar.endidxinpage);
        gt_free(encseq->wildcardrangetable.st_uchar.rangelengths);
        break;
      case GT_ACCESS_TYPE_USHORTTABLES:
        gt_free(encseq->twobitencoding);
        gt_free(encseq->wildcardrangetable.st_uint16.positions);
        gt_free(encseq->wildcardrangetable.st_uint16.endidxinpage);
        gt_free(encseq->wildcardrangetable.st_uint16.rangelengths);
        break;
      case GT_ACCESS_TYPE_UINT32TABLES:
        gt_free(encseq->twobitencoding);
        gt_free(encseq->wildcardrangetable.st_uint32.positions);
        gt_free(encseq->wildcardrangetable.st_uint32.endidxinpage);
        gt_free(encseq->wildcardrangetable.st_uint32.rangelengths);
        break;
      default: break;
    }
    if (encseq->has_exceptiontable) {
      gt_free(encseq->exceptiontable.st_uint32.positions);
      gt_free(encseq->exceptiontable.st_uint32.endidxinpage);
      gt_free(encseq->exceptiontable.st_uint32.mappositions);
      gt_free(encseq->exceptiontable.st_uint32.rangelengths);
    }
    gt_ssptab_delete(encseq->satsep, &encseq->ssptab);
  }
  if (encseq->ssptabmappedptr != NULL)
    gt_fa_xmunmap(encseq->ssptabmappedptr);
  if (encseq->oistabmappedptr != NULL)
    gt_fa_xmunmap(encseq->oistabmappedptr);
  encseq->headerptr.characterdistribution = NULL;
  encseq->plainseq = NULL;
  encseq->specialbits = NULL;
  encseq->twobitencoding = NULL;
  setencsequtablesNULL(encseq->sat, &encseq->wildcardrangetable);
  setencsequtablesNULL(encseq->satsep, &encseq->ssptab);
  if (encseq->destab != NULL) {
    if (encseq->hasallocateddestab)
      gt_free(encseq->destab);
    else
      gt_fa_xmunmap((void *) encseq->destab);
    encseq->destab = NULL;
  }
  if (encseq->sdstab != NULL) {
    if (encseq->hasallocatedsdstab)
      gt_free(encseq->sdstab);
    else
      gt_fa_xmunmap((void *) encseq->sdstab);
    encseq->sdstab = NULL;
  }
  if (encseq->fsptab != NULL) {
    gt_free(encseq->fsptab);
    encseq->fsptab = NULL;
  }
  if (encseq->exceptions != NULL) {
    if (encseq->oistabmappedptr != NULL)
      BITPACKARRAYSTOREVAR(encseq->exceptions) = NULL;
    bitpackarray_delete(encseq->exceptions);
    encseq->exceptions = NULL;
  }
  gt_alphabet_delete((GtAlphabet*) encseq->alpha);
  gt_str_array_delete(encseq->filenametab);
  encseq->filenametab = NULL;
  if (encseq->alphadef != NULL)
    gt_free(encseq->alphadef);
  if (encseq->mappedptr == NULL)
    gt_free(encseq->headerptr.filelengthtab);
  encseq->headerptr.filelengthtab = NULL;
  if (encseq->md5_tab != NULL)
    gt_md5_tab_delete(encseq->md5_tab);
  if (encseq->indexname != NULL)
    gt_free(encseq->indexname);
  gt_mutex_unlock(encseq->refcount_lock);
  gt_mutex_delete(encseq->refcount_lock);
  gt_free(encseq);
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x118266
jmp 0x118925
movq 0x10(%rsp), %rax
movq 0x398(%rax), %rdi
callq 0x1c340
movq 0x10(%rsp), %rax
cmpq $0x0, 0x390(%rax)
je 0x1182b3
movq 0x10(%rsp), %rax
movq 0x390(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x390(%rax)
movq 0x10(%rsp), %rax
movq 0x398(%rax), %rdi
callq 0x1c3e0
jmp 0x118925
movq 0x10(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x118315
movq 0x10(%rsp), %rax
cmpq $0x0, 0x2a0(%rax)
je 0x118302
movq 0x10(%rsp), %rax
movq 0x2a0(%rax), %rax
movq $0x0, (%rax)
movq 0x10(%rsp), %rax
movq 0x2a0(%rax), %rdi
callq 0x118a70
movq 0x10(%rsp), %rax
movq $0x0, 0x2a0(%rax)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x81a80
jmp 0x118626
movq 0x10(%rsp), %rax
movq 0xf8(%rax), %rdi
leaq 0x6d336(%rip), %rsi     # 0x18565e
movl $0x7a5, %edx            # imm = 0x7A5
callq 0xdab0
movq 0x10(%rsp), %rax
movl (%rax), %eax
movq %rax, 0x8(%rsp)
subq $0x6, %rax
ja 0x118589
movq 0x8(%rsp), %rax
leaq 0x6d0fc(%rip), %rcx     # 0x185450
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%rsp), %rax
testb $0x1, 0x298(%rax)
jne 0x118388
movq 0x10(%rsp), %rax
movq 0x290(%rax), %rdi
leaq 0x6d2e0(%rip), %rsi     # 0x18565e
movl $0x7a9, %edx            # imm = 0x7A9
callq 0xdab0
jmp 0x11858b
movq 0x10(%rsp), %rax
movq 0x2a0(%rax), %rdi
callq 0x118a70
movq 0x10(%rsp), %rax
movq $0x0, 0x2a0(%rax)
jmp 0x11858b
movq 0x10(%rsp), %rax
movq 0x280(%rax), %rdi
leaq 0x6d298(%rip), %rsi     # 0x18565e
movl $0x7b0, %edx            # imm = 0x7B0
callq 0xdab0
jmp 0x11858b
movq 0x10(%rsp), %rax
movq 0x280(%rax), %rdi
leaq 0x6d276(%rip), %rsi     # 0x18565e
movl $0x7b3, %edx            # imm = 0x7B3
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2b0(%rax), %rdi
leaq 0x6d259(%rip), %rsi     # 0x18565e
movl $0x7b4, %edx            # imm = 0x7B4
callq 0xdab0
movq 0x10(%rsp), %rax
movq $0x0, 0x2b0(%rax)
jmp 0x11858b
movq 0x10(%rsp), %rax
movq 0x280(%rax), %rdi
leaq 0x6d227(%rip), %rsi     # 0x18565e
movl $0x7b8, %edx            # imm = 0x7B8
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2b8(%rax), %rdi
leaq 0x6d20a(%rip), %rsi     # 0x18565e
movl $0x7b9, %edx            # imm = 0x7B9
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2c8(%rax), %rdi
leaq 0x6d1ed(%rip), %rsi     # 0x18565e
movl $0x7ba, %edx            # imm = 0x7BA
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2c0(%rax), %rdi
leaq 0x6d1d0(%rip), %rsi     # 0x18565e
movl $0x7bb, %edx            # imm = 0x7BB
callq 0xdab0
jmp 0x11858b
movq 0x10(%rsp), %rax
movq 0x280(%rax), %rdi
leaq 0x6d1ae(%rip), %rsi     # 0x18565e
movl $0x7be, %edx            # imm = 0x7BE
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2b8(%rax), %rdi
leaq 0x6d191(%rip), %rsi     # 0x18565e
movl $0x7bf, %edx            # imm = 0x7BF
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2c8(%rax), %rdi
leaq 0x6d174(%rip), %rsi     # 0x18565e
movl $0x7c0, %edx            # imm = 0x7C0
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2c0(%rax), %rdi
leaq 0x6d157(%rip), %rsi     # 0x18565e
movl $0x7c1, %edx            # imm = 0x7C1
callq 0xdab0
jmp 0x11858b
movq 0x10(%rsp), %rax
movq 0x280(%rax), %rdi
leaq 0x6d138(%rip), %rsi     # 0x18565e
movl $0x7c4, %edx            # imm = 0x7C4
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2b8(%rax), %rdi
leaq 0x6d11b(%rip), %rsi     # 0x18565e
movl $0x7c5, %edx            # imm = 0x7C5
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2c8(%rax), %rdi
leaq 0x6d0fe(%rip), %rsi     # 0x18565e
movl $0x7c6, %edx            # imm = 0x7C6
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x2c0(%rax), %rdi
leaq 0x6d0e1(%rip), %rsi     # 0x18565e
movl $0x7c7, %edx            # imm = 0x7C7
callq 0xdab0
jmp 0x11858b
jmp 0x11858b
movq 0x10(%rsp), %rax
testb $0x1, 0x2f0(%rax)
je 0x11860d
movq 0x10(%rsp), %rax
movq 0x2f8(%rax), %rdi
leaq 0x6d0b2(%rip), %rsi     # 0x18565e
movl $0x7cc, %edx            # imm = 0x7CC
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x308(%rax), %rdi
leaq 0x6d095(%rip), %rsi     # 0x18565e
movl $0x7cd, %edx            # imm = 0x7CD
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x310(%rax), %rdi
leaq 0x6d078(%rip), %rsi     # 0x18565e
movl $0x7ce, %edx            # imm = 0x7CE
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x300(%rax), %rdi
leaq 0x6d05b(%rip), %rsi     # 0x18565e
movl $0x7cf, %edx            # imm = 0x7CF
callq 0xdab0
movq 0x10(%rsp), %rax
movl 0x4(%rax), %edi
movq 0x10(%rsp), %rsi
addq $0x240, %rsi            # imm = 0x240
callq 0x118ab0
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x118640
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x81a80
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x11865a
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x81a80
movq 0x10(%rsp), %rax
movq $0x0, 0xf8(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x290(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x2b0(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x280(%rax)
movq 0x10(%rsp), %rax
movl (%rax), %edi
movq 0x10(%rsp), %rsi
addq $0x2b8, %rsi            # imm = 0x2B8
callq 0x118cc0
movq 0x10(%rsp), %rax
movl 0x4(%rax), %edi
movq 0x10(%rsp), %rsi
addq $0x240, %rsi            # imm = 0x240
callq 0x118cc0
movq 0x10(%rsp), %rax
cmpq $0x0, 0x200(%rax)
je 0x118728
movq 0x10(%rsp), %rax
testb $0x1, 0x208(%rax)
je 0x118707
movq 0x10(%rsp), %rax
movq 0x200(%rax), %rdi
leaq 0x6cf63(%rip), %rsi     # 0x18565e
movl $0x7df, %edx            # imm = 0x7DF
callq 0xdab0
jmp 0x118718
movq 0x10(%rsp), %rax
movq 0x200(%rax), %rdi
callq 0x81a80
movq 0x10(%rsp), %rax
movq $0x0, 0x200(%rax)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x218(%rax)
je 0x118785
movq 0x10(%rsp), %rax
testb $0x1, 0x20a(%rax)
je 0x118764
movq 0x10(%rsp), %rax
movq 0x218(%rax), %rdi
leaq 0x6cf06(%rip), %rsi     # 0x18565e
movl $0x7e6, %edx            # imm = 0x7E6
callq 0xdab0
jmp 0x118775
movq 0x10(%rsp), %rax
movq 0x218(%rax), %rdi
callq 0x81a80
movq 0x10(%rsp), %rax
movq $0x0, 0x218(%rax)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x278(%rax)
je 0x1187c1
movq 0x10(%rsp), %rax
movq 0x278(%rax), %rdi
leaq 0x6ceb7(%rip), %rsi     # 0x18565e
movl $0x7ec, %edx            # imm = 0x7EC
callq 0xdab0
movq 0x10(%rsp), %rax
movq $0x0, 0x278(%rax)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x330(%rax)
je 0x118810
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1187ef
movq 0x10(%rsp), %rax
movq 0x330(%rax), %rax
movq $0x0, (%rax)
movq 0x10(%rsp), %rax
movq 0x330(%rax), %rdi
callq 0x118a70
movq 0x10(%rsp), %rax
movq $0x0, 0x330(%rax)
movq 0x10(%rsp), %rax
movq 0x220(%rax), %rdi
callq 0x1098b0
movq 0x10(%rsp), %rax
movq 0x1f8(%rax), %rdi
callq 0x1b780
movq 0x10(%rsp), %rax
movq $0x0, 0x1f8(%rax)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x228(%rax)
je 0x11886e
movq 0x10(%rsp), %rax
movq 0x228(%rax), %rdi
leaq 0x6cdfa(%rip), %rsi     # 0x18565e
movl $0x7f9, %edx            # imm = 0x7F9
callq 0xdab0
movq 0x10(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x118897
movq 0x10(%rsp), %rax
movq 0xf0(%rax), %rdi
leaq 0x6cdd1(%rip), %rsi     # 0x18565e
movl $0x7fb, %edx            # imm = 0x7FB
callq 0xdab0
movq 0x10(%rsp), %rax
movq $0x0, 0xf0(%rax)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x3a0(%rax)
je 0x1188c7
movq 0x10(%rsp), %rax
movq 0x3a0(%rax), %rdi
callq 0x149660
movq 0x10(%rsp), %rax
cmpq $0x0, 0x68(%rax)
je 0x1188ed
movq 0x10(%rsp), %rax
movq 0x68(%rax), %rdi
leaq 0x6cd7b(%rip), %rsi     # 0x18565e
movl $0x800, %edx            # imm = 0x800
callq 0xdab0
movq 0x10(%rsp), %rax
movq 0x398(%rax), %rdi
callq 0x1c3e0
movq 0x10(%rsp), %rax
movq 0x398(%rax), %rdi
callq 0x1c2c0
movq 0x10(%rsp), %rdi
leaq 0x6cd43(%rip), %rsi     # 0x18565e
movl $0x803, %edx            # imm = 0x803
callq 0xdab0
addq $0x18, %rsp
retq
nopw (%rax,%rax)