// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/samfile_encseq_mapping.c
// Function: gt_samfile_encseq_mapping_new
GtSamfileEncseqMapping *gt_samfile_encseq_mapping_new(
    /*const*/ GtSamfileIterator *samfile_iterator, const GtEncseq *encseq,
    GtError *err)
{
  GtSamfileEncseqMapping *samfile_encseq_mapping;
  bool haserr = false;
  gt_assert(samfile_iterator != NULL);
  gt_assert(encseq != NULL);
  gt_error_check(err);
  samfile_encseq_mapping = gt_malloc(sizeof (GtSamfileEncseqMapping));
  samfile_encseq_mapping->nof_sequences = gt_encseq_num_of_sequences(encseq);
  samfile_encseq_mapping->samfile2encseq = NULL;
  samfile_encseq_mapping->encseq = encseq;
  if ((GtUword)gt_samfile_iterator_number_of_references(samfile_iterator)
      != samfile_encseq_mapping->nof_sequences)
  {
    gt_error_set(err, "The number of sequences in the encoded sequence "
        "is not the same as the number of references in the SAM file.");
    haserr = true;
  }
  else
  {
    GtHashmap *seqid2seqnum;
    GtUword i, cnum, dlen, *stored, *seqnum;
    int32_t refnum;
    const char *d;
    char *seqid = NULL;
    seqid2seqnum = gt_hashmap_new(GT_HASH_STRING, gt_free_func, gt_free_func);
    for (i = 0; i < samfile_encseq_mapping->nof_sequences; i++)
    {

      d = gt_encseq_description(encseq, &dlen, i);
      seqid = gt_cstr_dup_nt(d, dlen);
      for (cnum = 0; cnum < dlen; cnum++)
      {
        if (seqid[cnum] == ' ')
        {
          seqid[cnum] = '\0';
          break;
        }
      }
      if ((stored = gt_hashmap_get(seqid2seqnum, seqid)) != NULL)
      {
        gt_error_set(err, "The encseq identifier '%s' is not unique!", seqid);
        haserr = true;
        break;
      }
      else
      {
        seqnum = gt_malloc(sizeof (GtUword));
        *seqnum = i;
        gt_hashmap_add(seqid2seqnum, seqid, seqnum);
      }
    }
    if (!haserr)
    {
      samfile_encseq_mapping->samfile2encseq = gt_malloc(
          sizeof (*samfile_encseq_mapping->samfile2encseq) *
          samfile_encseq_mapping->nof_sequences);
      for (refnum = 0; refnum < (int32_t)samfile_encseq_mapping->nof_sequences;
          refnum++)
      {
        d = gt_samfile_iterator_reference_name(samfile_iterator, refnum);
        if ((seqnum = gt_hashmap_get(seqid2seqnum, d)) == NULL)
        {
          gt_error_set(err,
              "The SAM identifier '%s' was not found in the encseq!", d);
          haserr = true;
          break;
        }
        samfile_encseq_mapping->samfile2encseq[refnum] = *seqnum;
      }
    }
    gt_hashmap_delete(seqid2seqnum);
  }
  if (haserr)
  {
    gt_samfile_encseq_mapping_delete(samfile_encseq_mapping);
    return NULL;
  }
  else
    return samfile_encseq_mapping;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movb $0x0, 0x4f(%rsp)
cmpq $0x0, 0x68(%rsp)
jne 0x1cf318
movq 0x46ccb9(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x346d22(%rip), %rsi    # 0x516013
leaq 0x394f24(%rip), %rdx    # 0x56421c
leaq 0x394f36(%rip), %rcx    # 0x564235
leaq 0x394f4d(%rip), %r8     # 0x564253
movl $0x25, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1cf31a
jmp 0x1cf31c
cmpq $0x0, 0x60(%rsp)
jne 0x1cf35c
movq 0x46cc75(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x346cde(%rip), %rsi    # 0x516013
leaq 0x3a30a6(%rip), %rdx    # 0x5723e2
leaq 0x394ef2(%rip), %rcx    # 0x564235
leaq 0x394f09(%rip), %r8     # 0x564253
movl $0x26, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1cf35e
jmp 0x1cf360
cmpq $0x0, 0x58(%rsp)
je 0x1cf3b0
movq 0x58(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1cf378
jmp 0x1cf3b0
movq 0x46cc21(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x346c8a(%rip), %rsi    # 0x516013
leaq 0x346e2f(%rip), %rdx    # 0x5161bf
leaq 0x394e9e(%rip), %rcx    # 0x564235
leaq 0x394eb5(%rip), %r8     # 0x564253
movl $0x27, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1cf3b2
movl $0x18, %edi
leaq 0x394e95(%rip), %rsi    # 0x564253
movl $0x28, %edx
callq 0xe80f0
movq %rax, 0x50(%rsp)
movq 0x60(%rsp), %rdi
callq 0xa9d50
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x60(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, (%rax)
movq 0x68(%rsp), %rdi
callq 0x1cfc60
cltq
movq 0x50(%rsp), %rcx
cmpq 0x10(%rcx), %rax
je 0x1cf431
movq 0x58(%rsp), %rdi
leaq 0x394e59(%rip), %rsi    # 0x564279
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0x4f(%rsp)
jmp 0x1cf63a
movq $0x0, (%rsp)
movl $0x1, %edi
leaq -0xe6a15(%rip), %rdx    # 0xe8a30
movq %rdx, %rsi
callq 0xe0c40
movq %rax, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x50(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x1cf56a
movq 0x60(%rsp), %rdi
movq 0x38(%rsp), %rdx
leaq 0x28(%rsp), %rsi
callq 0xb1b40
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xa2e50
movq %rax, (%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x28(%rsp), %rax
jae 0x1cf4e3
movq (%rsp), %rax
movq 0x30(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x1cf4d1
movq (%rsp), %rax
movq 0x30(%rsp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x1cf4e3
jmp 0x1cf4d3
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x1cf4a4
movq 0x40(%rsp), %rdi
movq (%rsp), %rsi
callq 0xe0f20
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x1cf51a
movq 0x58(%rsp), %rdi
movq (%rsp), %rdx
leaq 0x394dda(%rip), %rsi    # 0x5642e6
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0x4f(%rsp)
jmp 0x1cf56a
movl $0x8, %edi
leaq 0x394d2d(%rip), %rsi    # 0x564253
movl $0x50, %edx
callq 0xe80f0
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rdi
movq (%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0xe0fc0
jmp 0x1cf557
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x1cf45b
testb $0x1, 0x4f(%rsp)
jne 0x1cf630
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rdi
shlq $0x3, %rdi
leaq 0x394cca(%rip), %rsi    # 0x564253
movl $0x59, %edx
callq 0xe80f0
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x50(%rsp), %rcx
movq 0x10(%rcx), %rcx
cmpl %ecx, %eax
jge 0x1cf62e
movq 0x68(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x1cfba0
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xe0f20
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
jne 0x1cf604
movq 0x58(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq 0x394d1a(%rip), %rsi    # 0x564310
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0x4f(%rsp)
jmp 0x1cf62e
movq 0x18(%rsp), %rax
movq (%rax), %rdx
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x1cf5a7
jmp 0x1cf630
movq 0x40(%rsp), %rdi
callq 0xe1770
testb $0x1, 0x4f(%rsp)
je 0x1cf656
movq 0x50(%rsp), %rdi
callq 0x1cf670
movq $0x0, 0x70(%rsp)
jmp 0x1cf660
movq 0x50(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
addq $0x78, %rsp
retq
nopw (%rax,%rax)