// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_generic_write_twobitencoding_to_file
int gt_encseq_generic_write_twobitencoding_to_file(const char *indexname,
                                     GtUword totallength,
                                     GtEncseqAccessType sat,
                                     GtUword lengthofsinglesequence,
                                     GtUword minseqlen,
                                     GtUword maxseqlen,
                                     GtUword lengthofspecialprefix,
                                     GtUword lengthofspecialsuffix,
                                     GtUword lengthoflongestnonspecial,
                                     GtTwobitencoding *twobitencoding,
                                     GtUword numofsequences,
                                     GtUword numoffiles,
                                     const GtFilelengthvalues *filelengthtab,
                                     const GtStrArray *filenametab,
                                     const GtUword *characterdistribution,
                                     GtError *err)
{
  FILE *fp;
  bool haserr = false;
  GtEncseq *encseq = NULL;

  gt_error_check(err);
  fp = gt_fa_fopen_with_suffix(indexname, GT_ENCSEQFILESUFFIX, "wb", err);
  if (fp == NULL)
    haserr = true;
  if (!haserr) {
    GtUword idx;
    Definedunsignedlong equallength;
    GtAlphabet *alphabet = gt_alphabet_new_dna();

    if (lengthofsinglesequence > 0) {
      equallength.defined = true;
      equallength.valueunsignedlong = lengthofsinglesequence;
      gt_assert(sat == GT_ACCESS_TYPE_EQUALLENGTH);
    }
    else {
      equallength.defined = false;
      equallength.valueunsignedlong = 0;
      gt_assert(sat == GT_ACCESS_TYPE_UCHARTABLES ||
                sat == GT_ACCESS_TYPE_USHORTTABLES ||
                sat == GT_ACCESS_TYPE_UINT32TABLES);
    }
    encseq = determineencseqkeyvalues(sat,
                                      totallength,
                                      numofsequences,
                                      numoffiles,
                                      determinelengthofdbfilenames(filenametab),
                                      0, /* wildcardranges */
                                      0, /* exceptionranges */
                                      minseqlen,
                                      maxseqlen,
                                      false, /* oistab */
                                      false,
                                      lengthofsinglesequence > 0
                                        ? &equallength
                                        : NULL,
                                      alphabet,
                                      false,
                                      NULL);
    encseq->twobitencoding = twobitencoding;
    encseq->unitsoftwobitencoding = gt_unitsoftwobitencoding(totallength);
    encseq->numofchars = 4U;
    encseq->maxsubalphasize = 1U;
    gt_assert(numofsequences > 0);
    encseq->filenametab = gt_str_array_new();
    for (idx = 0; idx < gt_str_array_size(filenametab); idx++) {
      gt_str_array_add(encseq->filenametab,
                       gt_str_array_get_str(filenametab, idx));
    }
    encseq->headerptr.filelengthtab
      = gt_malloc((size_t) numoffiles *
                  sizeof (*encseq->headerptr.filelengthtab));
    for (idx = 0; idx < numoffiles; idx++) {
      encseq->headerptr.filelengthtab[idx] = filelengthtab[idx];
    }
    encseq->headerptr.characterdistribution
      = gt_malloc(encseq->numofchars *
                  sizeof (*encseq->headerptr.characterdistribution));
    encseq->numofallchars = 0;
    for (idx = 0; idx < (GtUword) encseq->numofchars; idx++) {
      encseq->headerptr.characterdistribution[idx] = characterdistribution[idx];
      if (encseq->headerptr.characterdistribution[idx] > 0)
        encseq->numofallchars++;
    }
    encseq->specialcharinfo.specialcharacters = numofsequences - 1;
    encseq->specialcharinfo.specialranges = numofsequences - 1;
    encseq->specialcharinfo.realspecialranges = numofsequences - 1;
    encseq->specialcharinfo.lengthofspecialprefix = lengthofspecialprefix;
    encseq->specialcharinfo.lengthofspecialsuffix = lengthofspecialsuffix;
    encseq->specialcharinfo.wildcards = 0UL;
    encseq->specialcharinfo.wildcardranges = 0UL;
    encseq->specialcharinfo.realwildcardranges = 0UL;
    encseq->specialcharinfo.lengthofwildcardprefix = 0UL;
    encseq->specialcharinfo.lengthofwildcardsuffix = 0UL;
    encseq->specialcharinfo.lengthoflongestnonspecial
      = lengthoflongestnonspecial;
    encseq->specialcharinfo.exceptioncharacters = 0UL;
    encseq->specialcharinfo.exceptionranges = 0UL;
    encseq->specialcharinfo.realexceptionranges = 0UL;
    encseq->minseqlen = minseqlen;
    encseq->maxseqlen = maxseqlen;
    alphabet_to_key_values(alphabet, &encseq->alphatype,
                           &encseq->lengthofalphadef,
                           &encseq->alphadef, false);
    encseq->lengthofdbfilenames
      = determinelengthofdbfilenames(encseq->filenametab);
    if (gt_mapspec_write(gt_encseq_assign_mapspec, fp, encseq,
                         encseq->sizeofrep, err) != 0) {
      haserr = true;
    }
    encseq->twobitencoding = NULL;
  }
  if (encseq != NULL)
    gt_encseq_headerptr_delete(&encseq->headerptr);
  gt_encseq_delete(encseq);
  gt_fa_xfclose(fp);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq 0x168(%rsp), %rax
movq 0x160(%rsp), %rax
movq 0x158(%rsp), %rax
movq 0x150(%rsp), %rax
movq 0x148(%rsp), %rax
movq 0x140(%rsp), %rax
movq 0x138(%rsp), %rax
movq 0x130(%rsp), %rax
movq 0x128(%rsp), %rax
movq 0x120(%rsp), %rax
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movl %edx, 0xf4(%rsp)
movq %rcx, 0xe8(%rsp)
movq %r8, 0xe0(%rsp)
movq %r9, 0xd8(%rsp)
movb $0x0, 0xcf(%rsp)
movq $0x0, 0xc0(%rsp)
cmpq $0x0, 0x168(%rsp)
je 0x116ae2
movq 0x168(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x116aaa
jmp 0x116ae2
movq 0x9d527(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x475ab(%rip), %rsi     # 0x15e066
leaq 0x47b86(%rip), %rdx     # 0x15e648
leaq 0x6f19c(%rip), %rcx     # 0x185c65
leaq 0x6eb8e(%rip), %r8      # 0x18565e
movl $0x5e5, %r9d            # imm = 0x5E5
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x116ae4
movq 0x100(%rsp), %rdi
movq 0x168(%rsp), %r9
leaq 0x6db89(%rip), %rsi     # 0x184684
leaq 0x6d320(%rip), %rdx     # 0x183e22
leaq 0x6eb55(%rip), %rcx     # 0x18565e
movl $0x5e6, %r8d            # imm = 0x5E6
callq 0x7faa0
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
jne 0x116b2f
movb $0x1, 0xcf(%rsp)
testb $0x1, 0xcf(%rsp)
jne 0x117213
callq 0x109990
movq %rax, 0xa0(%rsp)
cmpq $0x0, 0xe8(%rsp)
jbe 0x116bb3
movb $0x1, 0xa8(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0xb0(%rsp)
cmpl $0x2, 0xf4(%rsp)
je 0x116baf
movq 0x9d45a(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x474de(%rip), %rsi     # 0x15e066
leaq 0x6f105(%rip), %rdx     # 0x185c94
leaq 0x6f0cf(%rip), %rcx     # 0x185c65
leaq 0x6eac1(%rip), %r8      # 0x18565e
movl $0x5f1, %r9d            # imm = 0x5F1
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x116bb1
jmp 0x116c21
movb $0x0, 0xa8(%rsp)
movq $0x0, 0xb0(%rsp)
cmpl $0x4, 0xf4(%rsp)
je 0x116c1d
cmpl $0x5, 0xf4(%rsp)
je 0x116c1d
cmpl $0x6, 0xf4(%rsp)
je 0x116c1d
movq 0x9d3ec(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x47470(%rip), %rsi     # 0x15e066
leaq 0x6f0b9(%rip), %rdx     # 0x185cb6
leaq 0x6f061(%rip), %rcx     # 0x185c65
leaq 0x6ea53(%rip), %r8      # 0x18565e
movl $0x5f8, %r9d            # imm = 0x5F8
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x116c1f
jmp 0x116c21
movl 0xf4(%rsp), %eax
movl %eax, 0x6c(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x148(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x158(%rsp), %rdi
callq 0x117b60
movq %rax, 0x88(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x98(%rsp)
cmpq $0x0, 0xe8(%rsp)
jbe 0x116ca5
leaq 0xa8(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x116cae
xorl %eax, %eax
movq %rax, 0x60(%rsp)
jmp 0x116cae
movq 0x98(%rsp), %r11
movq 0x90(%rsp), %rbx
movq 0x88(%rsp), %r8
movq 0x80(%rsp), %rcx
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rsi
movl 0x6c(%rsp), %edi
movq 0x60(%rsp), %r10
movq 0xa0(%rsp), %rax
xorl %r9d, %r9d
xorl %ebp, %ebp
movq $0x0, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movq %r10, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movl $0x0, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
callq 0x117270
movq %rax, 0xc0(%rsp)
movq 0x138(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x280(%rax)
movq 0xf8(%rsp), %rdi
callq 0x117be0
movq %rax, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x288(%rax)
movq 0xc0(%rsp), %rax
movl $0x4, 0x2a8(%rax)
movq 0xc0(%rsp), %rax
movb $0x1, 0x360(%rax)
cmpq $0x0, 0x140(%rsp)
ja 0x116dd2
movq 0x9d237(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x472bb(%rip), %rsi     # 0x15e066
leaq 0x6ef72(%rip), %rdx     # 0x185d24
leaq 0x6eeac(%rip), %rcx     # 0x185c65
leaq 0x6e89e(%rip), %r8      # 0x18565e
movl $0x60f, %r9d            # imm = 0x60F
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x116dd4
callq 0x1b020
movq %rax, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x1f8(%rax)
movq $0x0, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x158(%rsp), %rdi
callq 0x1b720
movq %rax, %rcx
movq 0x58(%rsp), %rax
cmpq %rcx, %rax
jae 0x116e6a
movq 0xc0(%rsp), %rax
movq 0x1f8(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x158(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0x1b3c0
movq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x1b2a0
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0x116df7
movq 0x148(%rsp), %rdi
shlq $0x4, %rdi
leaq 0x6e7e1(%rip), %rsi     # 0x18565e
movl $0x617, %edx            # imm = 0x617
callq 0xd2e0
movq %rax, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0xf0(%rax)
movq $0x0, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
cmpq 0x148(%rsp), %rax
jae 0x116f10
movq 0xc0(%rsp), %rax
movq 0xf0(%rax), %rax
movq 0xb8(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x150(%rsp), %rcx
movq 0xb8(%rsp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0x116ea5
movq 0xc0(%rsp), %rax
movl 0x2a8(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
leaq 0x6e733(%rip), %rsi     # 0x18565e
movl $0x61d, %edx            # imm = 0x61D
callq 0xd2e0
movq %rax, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0xf8(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x340(%rax)
movq $0x0, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movq 0xc0(%rsp), %rcx
movl 0x2a8(%rcx), %ecx
cmpq %rcx, %rax
jae 0x117007
movq 0x160(%rsp), %rax
movq 0xb8(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0xc0(%rsp), %rax
movq 0xf8(%rax), %rax
movq 0xb8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0xc0(%rsp), %rax
movq 0xf8(%rax), %rax
movq 0xb8(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jbe 0x116fec
movq 0xc0(%rsp), %rax
movq 0x340(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x340(%rax)
jmp 0x116fee
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0x116f66
movq 0x140(%rsp), %rcx
subq $0x1, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x178(%rax)
movq 0x140(%rsp), %rcx
subq $0x1, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x180(%rax)
movq 0x140(%rsp), %rcx
subq $0x1, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x188(%rax)
movq 0x120(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x190(%rax)
movq 0x128(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x198(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1a0(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1a8(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1b0(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1b8(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1c0(%rax)
movq 0x130(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x1c8(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1d0(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1d8(%rax)
movq 0xc0(%rsp), %rax
movq $0x0, 0x1e0(%rax)
movq 0xe0(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x3b0(%rax)
movq 0xd8(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x3b8(%rax)
movq 0xa0(%rsp), %rdi
movq 0xc0(%rsp), %rsi
addq $0x238, %rsi            # imm = 0x238
movq 0xc0(%rsp), %rdx
addq $0x230, %rdx            # imm = 0x230
movq 0xc0(%rsp), %rcx
addq $0x228, %rcx            # imm = 0x228
xorl %r8d, %r8d
callq 0x117c40
movq 0xc0(%rsp), %rax
movq 0x1f8(%rax), %rdi
callq 0x117b60
movq %rax, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x58(%rax)
movq 0xd0(%rsp), %rsi
movq 0xc0(%rsp), %rdx
movq 0xc0(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x168(%rsp), %r8
leaq 0xbe2(%rip), %rdi       # 0x117dd0
callq 0x145e90
cmpl $0x0, %eax
je 0x117200
movb $0x1, 0xcf(%rsp)
movq 0xc0(%rsp), %rax
movq $0x0, 0x280(%rax)
cmpq $0x0, 0xc0(%rsp)
je 0x11722f
movq 0xc0(%rsp), %rdi
addq $0x70, %rdi
callq 0x117ff0
movq 0xc0(%rsp), %rdi
callq 0x118250
movq 0xd0(%rsp), %rdi
callq 0x7fd50
movb 0xcf(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
nopw (%rax,%rax)