// File: /workspace/github_c_makefile_star2_O2/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 0x5aae(%rip), %rsi      # 0x704d
leaq 0x6944(%rip), %rdx      # 0x7eea
callq 0x6715
movq %rax, %rbx
testq %rax, %rax
jne 0x15c4
leaq 0x5a80(%rip), %rdi      # 0x703a
movq %r15, %rsi
xorl %eax, %eax
callq 0x64dc
movq %rbx, %rdi
callq 0x4eb9
movq %rax, %r14
movq %rbx, %rdi
callq 0x10a0
leaq 0x5a87(%rip), %rsi      # 0x7065
leaq 0x6905(%rip), %rdx      # 0x7eea
movq %r15, %rdi
callq 0x6715
movq %rax, %rbx
testq %rax, %rax
jne 0x1606
leaq 0x5a56(%rip), %rdi      # 0x7052
movq %r15, %rsi
xorl %eax, %eax
callq 0x64dc
movq %rsp, %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
cmpq $0x1, %rax
je 0x162b
leaq 0x5aa7(%rip), %rdi      # 0x70cb
xorl %eax, %eax
callq 0x64dc
movabsq $0x327648534d5352, %rax # imm = 0x327648534D5352
cmpq %rax, (%rsp)
je 0x164c
leaq 0x5aa7(%rip), %rdi      # 0x70e9
movq %rsp, %rsi
xorl %eax, %eax
callq 0x64dc
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x136c
movq %rax, %r14
leaq 0x10(%rax), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
cmpq $0x1, %rax
je 0x1680
leaq 0x5a91(%rip), %rdi      # 0x710a
xorl %eax, %eax
callq 0x64dc
movq 0x8(%r14), %rdi
callq 0x5ea8
movq %rbx, %rdi
callq 0x612e
movq %rax, 0x8(%r14)
movq 0x8(%rax), %rbp
addq $0x10, %rbp
pushq $0x2
popq %r12
xorl %r15d, %r15d
cmpl 0x18(%rax), %r15d
jge 0x1731
movslq -0xc(%rbp), %r13
testq %r13, %r13
je 0x1721
leaq (,%r13,4), %rdi
callq 0x659c
movq %rax, -0x8(%rbp)
movq %rax, %rdi
pushq $0x4
popq %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1080
cmpq %r13, %rax
je 0x16ec
leaq 0x5a3b(%rip), %rdi      # 0x7120
xorl %eax, %eax
callq 0x64dc
leaq (,%r13,2), %rdi
callq 0x659c
movq %rax, (%rbp)
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1080
cmpq %r13, %rax
je 0x1721
leaq 0x5a17(%rip), %rdi      # 0x7131
xorl %eax, %eax
callq 0x64dc
incl %r15d
movq 0x8(%r14), %rax
addq $0x48, %rbp
jmp 0x16a4
movq %rbx, %rdi
callq 0x10a0
movq %r14, %rdi
callq 0x1753
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq