// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/moshasm.c
// Function: readsetRead
Readset *readsetRead (char *root)
{
  FILE *f ;
  if (!(f = fopenTag (root, "mosh", "r"))) die ("can't open file %s.mosh", root) ;
  Moshset *ms = moshsetRead (f) ; fclose (f) ;
  if (!(f = fopenTag (root, "readset", "r"))) die ("can't open file %s.readset", root) ;
  char name[8] ;
  if (fread (name,8,1,f) != 1) die ("failed to read readset header") ;
  if (strcmp (name, "RSMSHv2")) die ("bad readset header %s != RSMSHv2", name) ;
  Readset *rs = readsetCreate (ms, 16) ;
  if (fread (&rs->totHit,sizeof(U64),1,f) != 1) die ("failed to read totHit") ;
  arrayDestroy (rs->reads) ; rs->reads = arrayRead (f) ;
  int i, n ; Read *r = arrp(rs->reads,0,Read) ;
  for (i = 0 ; i < arrayMax(rs->reads) ; ++i, ++r)
    if ((n = r->nHit))
      { r->hit = new (n, U32) ; if (fread(r->hit,sizeof(U32),n,f) != n) die ("failed read hits") ;
	r->dx = new (n, U16) ;	if (fread(r->dx,sizeof(U16),n,f) != n) die ("failed read dx") ;
      }
  fclose (f) ;
  invBuild (rs) ;
  return rs ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
leaq 0x5ffa(%rip), %rsi      # 0x804b
leaq 0x6985(%rip), %rdx      # 0x89dd
callq 0x6e23
movq %rax, %rbx
testq %rax, %rax
jne 0x2076
leaq 0x5fcc(%rip), %rdi      # 0x8038
movq %r15, %rsi
xorl %eax, %eax
callq 0x6bcc
movq %rbx, %rdi
callq 0x5478
movq %rax, %r14
movq %rbx, %rdi
callq 0x10a0
leaq 0x5fd3(%rip), %rsi      # 0x8063
leaq 0x6946(%rip), %rdx      # 0x89dd
movq %r15, %rdi
callq 0x6e23
movq %rax, %rbx
testq %rax, %rax
jne 0x20b8
leaq 0x5fa2(%rip), %rdi      # 0x8050
movq %r15, %rsi
xorl %eax, %eax
callq 0x6bcc
movq %rsp, %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
cmpq $0x1, %rax
je 0x20e1
leaq 0x5fef(%rip), %rdi      # 0x80c9
xorl %eax, %eax
callq 0x6bcc
movabsq $0x327648534d5352, %rax # imm = 0x327648534D5352
cmpq %rax, (%rsp)
je 0x2102
leaq 0x5fef(%rip), %rdi      # 0x80e7
movq %rsp, %rsi
xorl %eax, %eax
callq 0x6bcc
movq %r14, %rdi
movl $0x10, %esi
callq 0x1e0c
movq %rax, %r14
leaq 0x10(%rax), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
cmpq $0x1, %rax
je 0x213c
leaq 0x5fd3(%rip), %rdi      # 0x8108
xorl %eax, %eax
callq 0x6bcc
movq 0x8(%r14), %rdi
callq 0x658d
movq %rbx, %rdi
callq 0x6821
movq %rax, 0x8(%r14)
cmpl $0x0, 0x18(%rax)
jle 0x21f5
movq 0x8(%rax), %rbp
addq $0x10, %rbp
leaq 0x5fb4(%rip), %r12      # 0x811e
xorl %r15d, %r15d
movslq -0xc(%rbp), %r13
testq %r13, %r13
je 0x21e0
leaq (,%r13,4), %rdi
callq 0x6c94
movq %rax, -0x8(%rbp)
movl $0x4, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1080
cmpq %r13, %rax
je 0x21a9
movq %r12, %rdi
xorl %eax, %eax
callq 0x6bcc
leaq (,%r13,2), %rdi
callq 0x6c94
movq %rax, (%rbp)
movl $0x2, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1080
cmpq %r13, %rax
je 0x21e0
leaq 0x5f56(%rip), %rdi      # 0x812f
xorl %eax, %eax
callq 0x6bcc
incl %r15d
movq 0x8(%r14), %rax
addq $0x48, %rbp
cmpl 0x18(%rax), %r15d
jl 0x216d
movq %rbx, %rdi
callq 0x10a0
movq %r14, %rdi
callq 0x2217
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq