// File: /workspace/github_c_makefile_star2_O3/richarddurbin[P]hash10x/hash10x.c
// Function: writeHashFile
void writeHashFile (FILE *f)
{
  if ((fwrite ("10XH", 4, 1, f) != 1) || (fwrite (&HASHFILE_VERSION, 4, 1, f) != 1) ||
      (fwrite (&CLUSTERHASH_SIZE, 2, 1, f) != 1) || (fwrite (&CLUSTERBLOCK_SIZE, 2, 1, f) != 1) ||
      (fwrite (&hashTableBits, 4, 1, f) != 1)) die ("write fail 1") ;
  if (fwrite (hashIndex, sizeof(U32), hashTableSize, f) != hashTableSize) die ("write fail 2") ;
  if (fwrite (&hashNumber, sizeof(U32), 1, f) != 1) die ("failed to write hashNumber") ;
  if (fwrite (hashValue, sizeof(U64), hashNumber, f) != hashNumber) die ("failed to write hashValue") ;
  
  if (!arrayWrite (hashDepth, f)) die ("failed to write hashDepth array") ;
  if (!arrayWrite (clusterBlocks, f)) die ("failed to write clusterBlocks array") ;
  int i ;
  for (i = 1 ; i < arrayMax(clusterBlocks) ; ++i)
    { ClusterBlock *b = arrp(clusterBlocks, i, ClusterBlock) ;
      if (fwrite (b->clusHash, sizeof(ClusterHash), b->nHash, f) != b->nHash) die ("write fail 3") ;
    }
  fclose (f) ;

  fprintf (outFile, "  wrote %lld hash table entries and %d barcode blocks\n",
	   hashTableSize, arrayMax(clusterBlocks)) ;
  if (outFile != stdout)
    printf ("  wrote %lld hash table entries and %d barcode blocks\n",
	    hashTableSize, arrayMax(clusterBlocks)) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x7e3e(%rip), %rdi      # 0xa1ab
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1250
cmpq $0x1, %rax
jne 0x2401
leaq 0xcdcc(%rip), %rdi      # 0xf158
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1250
cmpq $0x1, %rax
jne 0x2401
leaq 0xcdb1(%rip), %rdi      # 0xf15c
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1250
cmpq $0x1, %rax
jne 0x2401
leaq 0xcd94(%rip), %rdi      # 0xf15e
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1250
cmpq $0x1, %rax
jne 0x2401
leaq 0xcd67(%rip), %rdi      # 0xf150
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1250
cmpq $0x1, %rax
je 0x240f
leaq 0x7da8(%rip), %rdi      # 0xa1b0
xorl %eax, %eax
callq 0x95f8
movq 0xdf82(%rip), %rdi      # 0x10398
movq 0xdf83(%rip), %rdx      # 0x103a0
movl $0x4, %esi
movq %rbx, %rcx
callq 0x1250
cmpq 0xdf6f(%rip), %rax      # 0x103a0
je 0x2441
leaq 0x7d83(%rip), %rdi      # 0xa1bd
xorl %eax, %eax
callq 0x95f8
leaq 0xdf60(%rip), %rdi      # 0x103a8
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1250
cmpq $0x1, %rax
je 0x246e
leaq 0x7d63(%rip), %rdi      # 0xa1ca
xorl %eax, %eax
callq 0x95f8
movq 0xdf3b(%rip), %rdi      # 0x103b0
movl 0xdf2d(%rip), %edx      # 0x103a8
movl $0x8, %esi
movq %rbx, %rcx
callq 0x1250
movl 0xdf1a(%rip), %ecx      # 0x103a8
cmpq %rcx, %rax
je 0x24a1
leaq 0x7d4b(%rip), %rdi      # 0xa1e5
xorl %eax, %eax
callq 0x95f8
movq 0xded8(%rip), %rdi      # 0x10380
movq %rbx, %rsi
callq 0x9217
testb %al, %al
jne 0x24c2
leaq 0x7d44(%rip), %rdi      # 0xa1ff
xorl %eax, %eax
callq 0x95f8
movq 0xdebf(%rip), %rdi      # 0x10388
movq %rbx, %rsi
callq 0x9217
testb %al, %al
jne 0x24e3
leaq 0x7d43(%rip), %rdi      # 0xa21f
xorl %eax, %eax
callq 0x95f8
movq 0xde9e(%rip), %rax      # 0x10388
cmpl $0x2, 0x18(%rax)
jl 0x2544
movl $0x1, %ebp
leaq 0x7d47(%rip), %r14      # 0xa243
movq 0x8(%rax), %r15
movslq 0x14(%rax), %rax
movslq %ebp, %r12
imulq %rax, %r12
movq 0x10(%r15,%r12), %rdi
movl 0x4(%r15,%r12), %edx
movl $0x8, %esi
movq %rbx, %rcx
callq 0x1250
movl 0x4(%r15,%r12), %ecx
cmpq %rcx, %rax
je 0x2536
movq %r14, %rdi
xorl %eax, %eax
callq 0x95f8
incl %ebp
movq 0xde49(%rip), %rax      # 0x10388
cmpl 0x18(%rax), %ebp
jl 0x24fc
movq %rbx, %rdi
callq 0x10b0
movq 0xde3d(%rip), %rdi      # 0x10390
movq 0xde46(%rip), %rdx      # 0x103a0
movq 0xde27(%rip), %rax      # 0x10388
movl 0x18(%rax), %ecx
leaq 0x7ce5(%rip), %rsi      # 0xa250
xorl %eax, %eax
callq 0x1150
movq 0xde17(%rip), %rax      # 0x10390
movq 0xca48(%rip), %rcx      # 0xefc8
cmpq (%rcx), %rax
je 0x25ac
movq 0xde14(%rip), %rsi      # 0x103a0
movq 0xddf5(%rip), %rax      # 0x10388
movl 0x18(%rax), %edx
leaq 0x7cb3(%rip), %rdi      # 0xa250
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10d0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq