// File: /workspace/github_c_makefile_star2_O0/richarddurbin[P]hash10x/moshmap.c
// Function: referenceFastaRead
void referenceFastaRead (Reference *ref, FILE *f, BOOL isAdd)
{
  char *seq, *seqName ;
  int len ;
  U64 totLen = 0 ;
  
  dna2indexConv['N'] = dna2indexConv['n'] = 0 ; /* to get 2-bit encoding */
  while (readSequence (f, dna2indexConv, &seq, &seqName, 0, &len))
    { int id ;
      if (!dictAdd (ref->dict, seqName, &id)) die ("duplicate ref sequence name %s", seqName) ;
      array (ref->len, id, int) = len ;
      totLen += len ;
      SeqhashRCiterator *mi = moshRCiterator (ref->ms->hasher, seq, len) ;
      U64 hash ; int pos ;
      while (moshRCnext (mi, &hash, &pos, 0))
	{ U32 index = moshsetIndexFind (ref->ms, hash, isAdd) ;
	  if (index)
	    { if (ref->max+1 >= ref->size) die ("reference size overflow") ;
	      ref->index[ref->max] = index ;
	      ++ref->depth[index] ;
	      ref->offset[ref->max] = pos ;
	      ref->id[ref->max] = id ;
	      ++ref->max ;
	    }
	}
      seqhashRCiteratorDestroy (mi) ;
      free (seq) ; free (seqName) ;
    }
  fclose (f) ;

  fprintf (outFile, "  %d hashes from %d reference sequences, total length %lld\n",
	   ref->max, dictMax(ref->dict), totLen) ;
  int i ; U32 *d = &ref->depth[1] ; U32 n1 = 0, n2 = 0, nM = 0 ;
  for (i = 1 ; i <= ref->ms->max ; ++i, ++d)
    if (*d == 1) { msSetCopy1 (ref->ms, i) ; ++n1 ; }
    else if (*d == 2) { msSetCopy2 (ref->ms, i) ; ++n2 ; }
    else { msSetCopyM (ref->ms, i) ; ++nM ; }
  fprintf (outFile, "  %d copy 1, %d copy 2, %d multiple\n", n1, n2, nM) ;

  if (isAdd) moshsetPack (ref->ms) ;
  referencePack (ref) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq $0x0, -0x38(%rbp)
leaq 0xce89(%rip), %rax      # 0xe730
movl $0x0, 0x1b8(%rax)
leaq 0xce78(%rip), %rax      # 0xe730
movl $0x0, 0x138(%rax)
movq -0x10(%rbp), %rdi
leaq 0xce63(%rip), %rsi      # 0xe730
leaq -0x20(%rbp), %rdx
leaq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x2c(%rbp), %r9
callq 0x3690
cmpl $0x0, %eax
je 0x1a3d
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x28(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
callq 0x7b00
cmpl $0x0, %eax
jne 0x1918
movq -0x28(%rbp), %rsi
leaq 0x873d(%rip), %rdi      # 0xa04e
movb $0x0, %al
callq 0x8ca0
movl -0x2c(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x3c(%rbp), %esi
callq 0x8220
movl -0x78(%rbp), %ecx
movl %ecx, (%rax)
movslq -0x2c(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x5790
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x54(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x59b0
cmpb $0x0, %al
je 0x1a1d
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
movsbl -0x11(%rbp), %edx
callq 0x5ef0
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0x1a18
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jb 0x19b8
leaq 0x86bc(%rip), %rdi      # 0xa06d
movb $0x0, %al
callq 0x8ca0
movl -0x58(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x58(%rbp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x54(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0x1959
movq -0x48(%rbp), %rdi
callq 0x1b70
movq -0x20(%rbp), %rdi
callq 0x1040
movq -0x28(%rbp), %rdi
callq 0x1040
jmp 0x18c2
movq -0x10(%rbp), %rdi
callq 0x1090
movq 0xd8fb(%rip), %rdi      # 0xf348
movq -0x8(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl 0x10(%rax), %ecx
movq -0x38(%rbp), %r8
leaq 0x861b(%rip), %rsi      # 0xa085
movb $0x0, %al
callq 0x1120
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x4, %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x1, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x40(%rcx), %eax
ja 0x1b28
movq -0x68(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x1acf
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x5c(%rbp), %esi
callq 0x1bb0
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x1b0c
movq -0x68(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1af2
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x5c(%rbp), %esi
callq 0x1bf0
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x1b0a
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x5c(%rbp), %esi
callq 0x1c30
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1b0c
jmp 0x1b0e
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x68(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x68(%rbp)
jmp 0x1a9d
movq 0xd819(%rip), %rdi      # 0xf348
movl -0x6c(%rbp), %edx
movl -0x70(%rbp), %ecx
movl -0x74(%rbp), %r8d
leaq 0x8581(%rip), %rsi      # 0xa0c1
movb $0x0, %al
callq 0x1120
cmpb $0x0, -0x11(%rbp)
je 0x1b59
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x5d00
movq -0x8(%rbp), %rdi
callq 0x1500
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)