// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x99ac(%rip), %rsi      # 0xb043
leaq 0xa337(%rip), %rdx      # 0xb9d5
callq 0xa470
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
jne 0x16bf
movq -0x8(%rbp), %rsi
leaq 0x9978(%rip), %rdi      # 0xb030
movb $0x0, %al
callq 0xa100
movq -0x10(%rbp), %rdi
callq 0x7770
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1090
movq -0x8(%rbp), %rdi
leaq 0x997b(%rip), %rsi      # 0xb05b
leaq 0xa2ee(%rip), %rdx      # 0xb9d5
callq 0xa470
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
jne 0x1708
movq -0x8(%rbp), %rsi
leaq 0x9947(%rip), %rdi      # 0xb048
movb $0x0, %al
callq 0xa100
leaq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x1070
cmpq $0x1, %rax
je 0x1733
leaq 0x9995(%rip), %rdi      # 0xb0c1
movb $0x0, %al
callq 0xa100
leaq -0x20(%rbp), %rdi
leaq 0x99ba(%rip), %rsi      # 0xb0f8
callq 0x1100
cmpl $0x0, %eax
je 0x175a
leaq -0x20(%rbp), %rsi
leaq 0x998c(%rip), %rdi      # 0xb0df
movb $0x0, %al
callq 0xa100
movq -0x18(%rbp), %rdi
movl $0x10, %esi
callq 0x1360
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x1070
cmpq $0x1, %rax
je 0x179b
leaq 0x996c(%rip), %rdi      # 0xb100
movb $0x0, %al
callq 0xa100
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9420
movq -0x10(%rbp), %rdi
callq 0x9860
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x8(%rcx), %rcx
imull $0x0, 0x14(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x28(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpl 0x18(%rcx), %eax
jge 0x18bb
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, %eax
je 0x189f
movslq -0x30(%rbp), %rdi
shlq $0x2, %rdi
callq 0xa1e0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl $0x4, %esi
callq 0x1070
movslq -0x30(%rbp), %rcx
cmpq %rcx, %rax
je 0x1855
leaq 0x98c8(%rip), %rdi      # 0xb116
movb $0x0, %al
callq 0xa100
movslq -0x30(%rbp), %rdi
shlq %rdi
callq 0xa1e0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl $0x2, %esi
callq 0x1070
movslq -0x30(%rbp), %rcx
cmpq %rcx, %rax
je 0x189d
leaq 0x9891(%rip), %rdi      # 0xb127
movb $0x0, %al
callq 0xa100
jmp 0x189f
jmp 0x18a1
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x38(%rbp)
jmp 0x17e5
movq -0x10(%rbp), %rdi
callq 0x1090
movq -0x28(%rbp), %rdi
callq 0x18e0
movq -0x28(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)