// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_check_external_twobitencoding_to_file
int gt_encseq_check_external_twobitencoding_to_file(const char *indexname,
                                                    GtError *err)
{
  GtEncseqLoader *el;
  GtEncseq *encseq;
  bool haserr = false;

  el = gt_encseq_loader_new();
  encseq = gt_encseq_loader_load(el, indexname, err);
  if (encseq == NULL)
    haserr = true;
  else {
    char *indexnamecopy;
    size_t indexname_len = strlen(indexname);
    GtUword numofdbsequences = gt_encseq_num_of_sequences(encseq);

    indexnamecopy = gt_malloc(sizeof(char) * (indexname_len+1+1));
    strcpy(indexnamecopy, indexname);
    indexnamecopy[indexname_len] = '2';
    indexnamecopy[indexname_len+1] = '\0';
    if (encseq->sat == GT_ACCESS_TYPE_EQUALLENGTH) {
      gt_assert(encseq->equallength.defined);
      if (gt_encseq_equallength_write_twobitencoding_to_file(indexnamecopy,
                                        gt_encseq_total_length(encseq),
                                        encseq->equallength.valueunsignedlong,
                                        encseq->twobitencoding,
                                        numofdbsequences,
                                        gt_encseq_num_of_files(encseq),
                                        encseq->headerptr.filelengthtab,
                                        encseq->filenametab,
                                        encseq->headerptr.characterdistribution,
                                        err) != 0) {
        haserr = true;
      }
    }
    else {
      gt_assert(gt_encseq_wildcards(encseq) == 0);
      if (gt_encseq_generic_write_twobitencoding_to_file(indexnamecopy,
                                   gt_encseq_total_length(encseq),
                                   encseq->sat,
                                   0,
                                   gt_encseq_min_seq_length(encseq),
                                   gt_encseq_max_seq_length(encseq),
                                   gt_encseq_lengthofspecialprefix(encseq),
                                   gt_encseq_lengthofspecialsuffix(encseq),
                                   gt_encseq_lengthoflongestnonspecial(encseq),
                                   encseq->twobitencoding,
                                   numofdbsequences,
                                   gt_encseq_num_of_files(encseq),
                                   encseq->headerptr.filelengthtab,
                                   encseq->filenametab,
                                   encseq->headerptr.characterdistribution,
                                   err) != 0) {
        haserr = true;
      }
      if (!haserr && numofdbsequences > 1UL) {
        GtUword seqnum, *seppostab;

        seppostab = gt_malloc(sizeof (*seppostab) * (numofdbsequences-1));
        for (seqnum = 0; seqnum < numofdbsequences - 1; seqnum++) {
          if (seqnum == 0)
            seppostab[seqnum] = gt_encseq_seqlength(encseq, seqnum);
          else {
            seppostab[seqnum] = seppostab[seqnum-1] +
                                gt_encseq_seqlength(encseq, seqnum) + 1;
          }
        }
        if (gt_encseq_seppos2ssptab(indexnamecopy,
                                    gt_encseq_total_length(encseq),
                                    numofdbsequences,
                                    seppostab,
                                    err) != 0) {
          haserr = true;
        }
        gt_free(seppostab);
      }
    }
    gt_free(indexnamecopy);
  }
  gt_encseq_delete(encseq);
  gt_encseq_loader_delete(el);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movb $0x0, 0xf7(%rsp)
callq 0x121c20
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rdi
movq 0x110(%rsp), %rsi
movq 0x108(%rsp), %rdx
callq 0x121c80
movq %rax, 0xf8(%rsp)
cmpq $0x0, 0xf8(%rsp)
jne 0x1216a3
movb $0x1, 0xf7(%rsp)
jmp 0x121bd7
movq 0x110(%rsp), %rdi
callq 0xb240
movq %rax, 0xe0(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x113f30
movq %rax, 0xd8(%rsp)
movq 0xe0(%rsp), %rdi
addq $0x1, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
leaq 0x63f76(%rip), %rsi     # 0x18565e
movl $0x1f5d, %edx           # imm = 0x1F5D
callq 0xd2e0
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rdi
movq 0x110(%rsp), %rsi
callq 0xb5e0
movq 0xe8(%rsp), %rax
movq 0xe0(%rsp), %rcx
movb $0x32, (%rax,%rcx)
movq 0xe8(%rsp), %rax
movq 0xe0(%rsp), %rcx
movb $0x0, 0x1(%rax,%rcx)
movq 0xf8(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x121890
jmp 0x12174b
movq 0xf8(%rsp), %rax
testb $0x1, 0x1e8(%rax)
jne 0x121794
movq 0x92875(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x3c8f9(%rip), %rsi     # 0x15e066
leaq 0x6561c(%rip), %rdx     # 0x186d90
leaq 0x65631(%rip), %rcx     # 0x186dac
leaq 0x63edc(%rip), %r8      # 0x18565e
movl $0x1f62, %r9d           # imm = 0x1F62
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x121796
movq 0xe8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x113ee0
movq %rax, 0xa8(%rsp)
movq 0xf8(%rsp), %rax
movq 0x1f0(%rax), %rax
movq %rax, 0xb0(%rsp)
movq 0xf8(%rsp), %rax
movq 0x280(%rax), %rax
movq %rax, 0xb8(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x121fd0
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq 0xb8(%rsp), %rcx
movq 0xc0(%rsp), %r8
movq %rax, %r9
movq 0xf8(%rsp), %rax
movq 0xf0(%rax), %rbx
movq 0xf8(%rsp), %rax
movq 0x1f8(%rax), %r11
movq 0xf8(%rsp), %rax
movq 0xf8(%rax), %r10
movq 0x108(%rsp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x118930
cmpl $0x0, %eax
je 0x12188b
movb $0x1, 0xf7(%rsp)
jmp 0x121bbe
jmp 0x121892
movq 0xf8(%rsp), %rdi
callq 0x11ca60
cmpq $0x0, %rax
je 0x1218dd
movq 0x9272c(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x3c7b0(%rip), %rsi     # 0x15e066
leaq 0x6551f(%rip), %rdx     # 0x186ddc
leaq 0x654e8(%rip), %rcx     # 0x186dac
leaq 0x63d93(%rip), %r8      # 0x18565e
movl $0x1f71, %r9d           # imm = 0x1F71
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1218df
movq 0xe8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x113ee0
movq %rax, 0x70(%rsp)
movq 0xf8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x7c(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x11b230
movq %rax, 0x80(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x11b290
movq %rax, 0x88(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x11ca20
movq %rax, 0x90(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x11ca40
movq %rax, %rbp
movq 0xf8(%rsp), %rdi
callq 0x11cb60
movq %rax, %r13
movq 0xf8(%rsp), %rax
movq 0x280(%rax), %r12
movq 0xd8(%rsp), %r15
movq 0xf8(%rsp), %rdi
callq 0x121fd0
movq 0x68(%rsp), %rdi
movq 0x70(%rsp), %rsi
movl 0x7c(%rsp), %edx
movq 0x80(%rsp), %r8
movq 0x88(%rsp), %r9
movq %rax, %r14
movq 0x90(%rsp), %rax
movq 0xf8(%rsp), %rcx
movq 0xf0(%rcx), %rbx
movq 0xf8(%rsp), %rcx
movq 0x1f8(%rcx), %r11
movq 0xf8(%rsp), %rcx
movq 0xf8(%rcx), %r10
movq 0x108(%rsp), %rcx
movq %rcx, 0x98(%rsp)
xorl %ecx, %ecx
movq %rax, (%rsp)
movq 0x98(%rsp), %rax
movq %rbp, 0x8(%rsp)
movq %r13, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %r11, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movq %rax, 0x48(%rsp)
callq 0x1169f0
cmpl $0x0, %eax
je 0x121a42
movb $0x1, 0xf7(%rsp)
testb $0x1, 0xf7(%rsp)
jne 0x121bbc
cmpq $0x1, 0xd8(%rsp)
jbe 0x121bbc
movq 0xd8(%rsp), %rdi
subq $0x1, %rdi
shlq $0x3, %rdi
leaq 0x63be8(%rip), %rsi     # 0x18565e
movl $0x1f87, %edx           # imm = 0x1F87
callq 0xd2e0
movq %rax, 0xc8(%rsp)
movq $0x0, 0xd0(%rsp)
movq 0xd0(%rsp), %rax
movq 0xd8(%rsp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x121b57
cmpq $0x0, 0xd0(%rsp)
jne 0x121aea
movq 0xf8(%rsp), %rdi
movq 0xd0(%rsp), %rsi
callq 0x11abd0
movq %rax, %rdx
movq 0xc8(%rsp), %rax
movq 0xd0(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x121b3c
movq 0xc8(%rsp), %rax
movq 0xd0(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x60(%rsp)
movq 0xf8(%rsp), %rdi
movq 0xd0(%rsp), %rsi
callq 0x11abd0
movq 0x60(%rsp), %rdx
addq %rax, %rdx
addq $0x1, %rdx
movq 0xc8(%rsp), %rax
movq 0xd0(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x121b3e
movq 0xd0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xd0(%rsp)
jmp 0x121a94
movq 0xe8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x113ee0
movq 0x58(%rsp), %rdi
movq %rax, %rsi
movq 0xd8(%rsp), %rdx
movq 0xc8(%rsp), %rcx
movq 0x108(%rsp), %r8
callq 0x11b2f0
cmpl $0x0, %eax
je 0x121ba3
movb $0x1, 0xf7(%rsp)
movq 0xc8(%rsp), %rdi
leaq 0x63aac(%rip), %rsi     # 0x18565e
movl $0x1f97, %edx           # imm = 0x1F97
callq 0xdab0
jmp 0x121bbe
movq 0xe8(%rsp), %rdi
leaq 0x63a91(%rip), %rsi     # 0x18565e
movl $0x1f9a, %edx           # imm = 0x1F9A
callq 0xdab0
movq 0xf8(%rsp), %rdi
callq 0x118250
movq 0x100(%rsp), %rdi
callq 0x122030
movb 0xf7(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)