// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/mapspec.c
// Function: gt_mapspec_write
int gt_mapspec_write(GtMapspecSetupFunc setup, FILE *fp,
                     void *data, GtUword expectedsize, GtError *err)
{
  GtMapspecification *mapspecptr;
  GtUword byteoffset = 0;
  int had_err = 0;
  GtUword totalpadunits = 0;
  GtUword byteswritten;
  GtMapspec *ms = gt_malloc(sizeof (GtMapspec));

  gt_error_check(err);
  GT_INITARRAY(&ms->mapspectable,GtMapspecification);
  setup(ms, data, true);
  gt_assert(ms->mapspectable.spaceGtMapspecification != NULL);
  for (mapspecptr = ms->mapspectable.spaceGtMapspecification;
       mapspecptr < ms->mapspectable.spaceGtMapspecification +
                    ms->mapspectable.nextfreeGtMapspecification;
       mapspecptr++)
  {
#ifdef SKDEBUG
    printf("# %s",__func__);
    showmapspec(mapspecptr);
    printf(" at byteoffset "GT_WU"\n",byteoffset);
#endif
    if (mapspecptr->numofunits > 0)
    {
      switch (mapspecptr->typespec)
      {
        case GtCharType:
          WRITEACTIONWITHTYPE(char);
          break;
        case GtFilelengthvaluesType:
          WRITEACTIONWITHTYPE(GtFilelengthvalues);
          break;
        case GtUcharType:
          WRITEACTIONWITHTYPE(GtUchar);
          break;
        case Uint16Type:
          WRITEACTIONWITHTYPE(uint16_t);
          break;
        case Uint32Type:
          WRITEACTIONWITHTYPE(uint32_t);
          break;
        case GtUwordType:
          WRITEACTIONWITHTYPE(GtUword);
          break;
        case Uint64Type:
          WRITEACTIONWITHTYPE(uint64_t);
          break;
        case GtBitsequenceType:
          WRITEACTIONWITHTYPE(GtBitsequence);
          break;
        case GtUwordBoundType:
          WRITEACTIONWITHTYPE(GtUwordBound);
          break;
        case GtPairBwtidxType:
          WRITEACTIONWITHTYPE(GtPairBwtidx);
          break;
        case GtTwobitencodingType:
          WRITEACTIONWITHTYPE(GtTwobitencoding);
          break;
        case GtSpecialcharinfoType:
          WRITEACTIONWITHTYPE(GtSpecialcharinfo);
          break;
        case GtBitElemType:
          WRITEACTIONWITHTYPE(BitElem);
          break;
        case GtUintType:
          WRITEACTIONWITHTYPE(unsigned int);
          break;
        default:
           gt_error_set(err, "no map specification for size " GT_WU,
                        (GtUword) mapspecptr->sizeofunit);
           had_err = -1;
      }
    }
    if (had_err)
    {
      break;
    }
    byteoffset = CALLCASTFUNC(uint64_t,unsigned_long,
                              (uint64_t) (byteoffset +
                                          mapspecptr->sizeofunit *
                                          mapspecptr->numofunits));
    if (gt_mapspec_pad(fp,&byteswritten,byteoffset,err) != 0)
    {
      had_err = -1;
    }
    byteoffset += byteswritten;
    totalpadunits += byteswritten;
  }
  if (!had_err)
  {
    if (expectedsize + totalpadunits != byteoffset)
    {
      gt_error_set(err, "expected file size is " GT_WU " bytes, "
                   "but file has " GT_WU " bytes",
                   expectedsize, byteoffset);
      had_err = -1;
    }
  }
  GT_FREEARRAY(&ms->mapspectable,GtMapspecification);
  gt_free(ms);
  return had_err;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movq $0x0, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x18, %edi
leaq 0x464bd(%rip), %rsi     # 0x18c390
movl $0x177, %edx            # imm = 0x177
callq 0xd2e0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x145f32
movq 0x40(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x145efa
jmp 0x145f32
movq 0x6e0d7(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1815b(%rip), %rsi     # 0x15e066
leaq 0x18736(%rip), %rdx     # 0x15e648
leaq 0x46571(%rip), %rcx     # 0x18c48a
leaq 0x46470(%rip), %r8      # 0x18c390
movl $0x179, %r9d            # imm = 0x179
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x145f34
jmp 0x145f36
movq 0x10(%rsp), %rax
movq $0x0, (%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x60(%rsp), %rax
movq 0x10(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl $0x1, %edx
callq *%rax
movq 0x10(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x145fb5
movq 0x6e054(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x180d8(%rip), %rsi     # 0x15e066
leaq 0x46506(%rip), %rdx     # 0x18c49b
leaq 0x464ee(%rip), %rcx     # 0x18c48a
leaq 0x463ed(%rip), %r8      # 0x18c390
movl $0x17c, %r9d            # imm = 0x17C
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x145fb7
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq 0x10(%rsp), %rdx
imulq $0x28, 0x10(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x146349
movq 0x38(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jbe 0x1462b5
movq 0x38(%rsp), %rax
movl (%rax), %eax
movq %rax, 0x8(%rsp)
subq $0xd, %rax
ja 0x14628f
movq 0x8(%rsp), %rax
leaq 0x4633f(%rip), %rcx     # 0x18c358
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x58(%rsp), %rcx
callq 0x1cab0
jmp 0x1462b3
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rdx
leaq 0x46228(%rip), %rsi     # 0x18c4cc
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x1462b5
cmpl $0x0, 0x2c(%rsp)
je 0x1462c1
jmp 0x146349
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x38(%rsp), %rcx
imulq 0x20(%rcx), %rax
addq %rax, %rdx
leaq 0x460ad(%rip), %rdi     # 0x18c390
movl $0x1c2, %esi            # imm = 0x1C2
callq 0x145930
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq 0x40(%rsp), %rcx
leaq 0x18(%rsp), %rsi
callq 0x145e00
cmpl $0x0, %eax
je 0x146318
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
addq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x38(%rsp)
jmp 0x145fc4
cmpl $0x0, 0x2c(%rsp)
jne 0x146388
movq 0x48(%rsp), %rax
addq 0x20(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x146386
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rdx
movq 0x30(%rsp), %rcx
leaq 0x460db(%rip), %rsi     # 0x18c452
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x146388
jmp 0x14638a
movq 0x10(%rsp), %rax
cmpq $0x0, (%rax)
je 0x1463d4
movq 0x10(%rsp), %rax
movq (%rax), %rdi
leaq 0x45fec(%rip), %rsi     # 0x18c390
movl $0x1d4, %edx            # imm = 0x1D4
callq 0xdab0
movq 0x10(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x10(%rsp), %rax
movq $0x0, (%rax)
jmp 0x1463d6
movq 0x10(%rsp), %rdi
leaq 0x45fae(%rip), %rsi     # 0x18c390
movl $0x1d5, %edx            # imm = 0x1D5
callq 0xdab0
movl 0x2c(%rsp), %eax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)