// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/mapspec.c
// Function: gt_mapspec_read_header
int  gt_mapspec_read_header(GtMapspecSetupFunc setup, void *data,
                            const char *filename, GtUword expectedsize,
                            void **mapped, GtError *err)
{
  void *mapptr;
  GtUword byteoffset = 0;
  size_t numofbytes;
  GtMapspec *ms = gt_malloc(sizeof (GtMapspec));
  GtMapspecification *mapspecptr;
  int had_err = 0;
  GtUword totalpadunits = 0;

  gt_error_check(err);
  GT_INITARRAY(&ms->mapspectable, GtMapspecification);
  setup(ms, data, false);

  mapptr = gt_fa_mmap_read(filename, &numofbytes, err);
  if (mapptr == NULL)
  {
    had_err = -1;
  }
  if (!had_err)
    *mapped = mapptr;
  if (!had_err)
  {
    if (assigncorrecttype(ms->mapspectable.spaceGtMapspecification,
                          mapptr,0,err) != 0)
    {
      had_err = -1;
    }
  }
  if (!had_err)
  {
    mapspecptr = ms->mapspectable.spaceGtMapspecification;
    gt_assert(mapspecptr != NULL);
    byteoffset = CALLCASTFUNC(uint64_t,unsigned_long,
                              (uint64_t) (mapspecptr->sizeofunit *
                                          mapspecptr->numofunits));
    if (byteoffset % (GtUword) GT_WORDSIZE_INBYTES > 0)
    {
      size_t padunits
        = GT_WORDSIZE_INBYTES - (byteoffset % GT_WORDSIZE_INBYTES);
      byteoffset += (GtUword) padunits;
      totalpadunits += (GtUword) padunits;
    }
    for (mapspecptr++;
         mapspecptr < ms->mapspectable.spaceGtMapspecification +
                      ms->mapspectable.nextfreeGtMapspecification; mapspecptr++)
    {
      if (assigncorrecttype(mapspecptr,mapptr,byteoffset,err) != 0)
      {
        had_err = -1;
        break;
      }
      byteoffset = CALLCASTFUNC(uint64_t,unsigned_long,
                                (uint64_t) (byteoffset +
                                            mapspecptr->sizeofunit *
                                            mapspecptr->numofunits));
      if (byteoffset % (GtUword) GT_WORDSIZE_INBYTES > 0)
      {
        size_t padunits
          = GT_WORDSIZE_INBYTES - (byteoffset % GT_WORDSIZE_INBYTES);
        byteoffset += (GtUword) padunits;
        totalpadunits += (GtUword) padunits;
      }
    }
  }
  if (!had_err)
  {
    if (expectedsize + totalpadunits != byteoffset)
    {
      gt_error_set(err,"mapping: expected header 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 $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x48(%rsp)
movq $0x0, 0x38(%rsp)
movl $0x18, %edi
leaq 0x47259(%rip), %rsi     # 0x18c390
movl $0xb3, %edx
callq 0xd2e0
movq %rax, 0x28(%rsp)
movl $0x0, 0x1c(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x1451a7
movq 0x48(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x14516f
jmp 0x1451a7
movq 0x6ee62(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x18ee6(%rip), %rsi     # 0x15e066
leaq 0x194c1(%rip), %rdx     # 0x15e648
leaq 0x47215(%rip), %rcx     # 0x18c3a3
leaq 0x471fb(%rip), %r8      # 0x18c390
movl $0xb8, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1451a9
jmp 0x1451ab
movq 0x28(%rsp), %rax
movq $0x0, (%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x70(%rsp), %rax
movq 0x28(%rsp), %rdi
movq 0x68(%rsp), %rsi
xorl %edx, %edx
callq *%rax
movq 0x60(%rsp), %rdi
movq 0x48(%rsp), %r8
leaq 0x30(%rsp), %rsi
leaq 0x47196(%rip), %rdx     # 0x18c390
movl $0xbc, %ecx
callq 0x80cb0
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
jne 0x145219
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x1c(%rsp)
jne 0x14522d
movq 0x40(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, (%rax)
cmpl $0x0, 0x1c(%rsp)
jne 0x14525e
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x1454c0
cmpl $0x0, %eax
je 0x14525c
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
jmp 0x14525e
cmpl $0x0, 0x1c(%rsp)
jne 0x145408
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x1452b6
movq 0x6ed53(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x18dd7(%rip), %rsi     # 0x15e066
leaq 0x47124(%rip), %rdx     # 0x18c3ba
leaq 0x47106(%rip), %rcx     # 0x18c3a3
leaq 0x470ec(%rip), %r8      # 0x18c390
movl $0xce, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x1452b8
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rdx
movq 0x20(%rsp), %rax
imulq 0x20(%rax), %rdx
leaq 0x470be(%rip), %rdi     # 0x18c390
movl $0xd1, %esi
callq 0x145930
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
andq $0x7, %rax
cmpq $0x0, %rax
jbe 0x145324
movq 0x38(%rsp), %rcx
andq $0x7, %rcx
movl $0x8, %eax
subq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movq 0x28(%rsp), %rdx
imulq $0x28, 0x10(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x145406
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x48(%rsp), %rcx
callq 0x1454c0
cmpl $0x0, %eax
je 0x145380
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
jmp 0x145406
movq 0x38(%rsp), %rdx
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rsp), %rcx
imulq 0x20(%rcx), %rax
addq %rax, %rdx
leaq 0x46fee(%rip), %rdi     # 0x18c390
movl $0xe5, %esi
callq 0x145930
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
andq $0x7, %rax
cmpq $0x0, %rax
jbe 0x1453f1
movq 0x38(%rsp), %rcx
andq $0x7, %rcx
movl $0x8, %eax
subq %rcx, %rax
movq %rax, (%rsp)
movq (%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x38(%rsp)
movq (%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x1453f3
movq 0x20(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x20(%rsp)
jmp 0x145332
jmp 0x145408
cmpl $0x0, 0x1c(%rsp)
jne 0x145447
movq 0x58(%rsp), %rax
addq 0x10(%rsp), %rax
cmpq 0x38(%rsp), %rax
je 0x145445
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x46f97(%rip), %rsi     # 0x18c3cd
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
jmp 0x145447
jmp 0x145449
movq 0x28(%rsp), %rax
cmpq $0x0, (%rax)
je 0x145493
movq 0x28(%rsp), %rax
movq (%rax), %rdi
leaq 0x46f2d(%rip), %rsi     # 0x18c390
movl $0xf9, %edx
callq 0xdab0
movq 0x28(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x28(%rsp), %rax
movq $0x0, (%rax)
jmp 0x145495
movq 0x28(%rsp), %rdi
leaq 0x46eef(%rip), %rsi     # 0x18c390
movl $0xfa, %edx
callq 0xdab0
movl 0x1c(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)