// File: /workspace/github_c_makefile_star2_O3/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 0x5edc(%rip), %rsi      # 0x804d
leaq 0x6d9b(%rip), %rdx      # 0x8f13
callq 0x70d7
movq %rax, %rbx
testq %rax, %rax
jne 0x2196
leaq 0x5eae(%rip), %rdi      # 0x803a
movq %r15, %rsi
xorl %eax, %eax
callq 0x6e84
movq %rbx, %rdi
callq 0x5754
movq %rax, %r14
movq %rbx, %rdi
callq 0x10a0
leaq 0x5eb5(%rip), %rsi      # 0x8065
leaq 0x6d5c(%rip), %rdx      # 0x8f13
movq %r15, %rdi
callq 0x70d7
movq %rax, %rbx
testq %rax, %rax
jne 0x21d8
leaq 0x5e84(%rip), %rdi      # 0x8052
movq %r15, %rsi
xorl %eax, %eax
callq 0x6e84
movq %rsp, %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
cmpq $0x1, %rax
je 0x2201
leaq 0x5ed1(%rip), %rdi      # 0x80cb
xorl %eax, %eax
callq 0x6e84
movabsq $0x327648534d5352, %rax # imm = 0x327648534D5352
cmpq %rax, (%rsp)
je 0x2222
leaq 0x5ed1(%rip), %rdi      # 0x80e9
movq %rsp, %rsi
xorl %eax, %eax
callq 0x6e84
movq %r14, %rdi
movl $0x10, %esi
callq 0x1f2c
movq %rax, %r14
leaq 0x10(%rax), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
cmpq $0x1, %rax
je 0x225c
leaq 0x5eb5(%rip), %rdi      # 0x810a
xorl %eax, %eax
callq 0x6e84
movq 0x8(%r14), %rdi
callq 0x6862
movq %rbx, %rdi
callq 0x6aef
movq %rax, 0x8(%r14)
cmpl $0x0, 0x18(%rax)
jle 0x2315
movq 0x8(%rax), %rbp
addq $0x10, %rbp
leaq 0x5e96(%rip), %r12      # 0x8120
xorl %r15d, %r15d
movslq -0xc(%rbp), %r13
testq %r13, %r13
je 0x2300
leaq (,%r13,4), %rdi
callq 0x6f4c
movq %rax, -0x8(%rbp)
movl $0x4, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1080
cmpq %r13, %rax
je 0x22c9
movq %r12, %rdi
xorl %eax, %eax
callq 0x6e84
leaq (,%r13,2), %rdi
callq 0x6f4c
movq %rax, (%rbp)
movl $0x2, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1080
cmpq %r13, %rax
je 0x2300
leaq 0x5e38(%rip), %rdi      # 0x8131
xorl %eax, %eax
callq 0x6e84
incl %r15d
movq 0x8(%r14), %rax
addq $0x48, %rbp
cmpl 0x18(%rax), %r15d
jl 0x228d
movq %rbx, %rdi
callq 0x10a0
movq %r14, %rdi
callq 0x2337
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq