// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x772c(%rip), %rdi      # 0x916b
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1260
cmpq $0x1, %rax
jne 0x1abf
leaq 0xd70e(%rip), %rdi      # 0xf168
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1260
cmpq $0x1, %rax
jne 0x1abf
leaq 0xd6f7(%rip), %rdi      # 0xf16c
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1260
cmpq $0x1, %rax
jne 0x1abf
leaq 0xd6de(%rip), %rdi      # 0xf16e
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1260
cmpq $0x1, %rax
jne 0x1abf
leaq 0xd6b5(%rip), %rdi      # 0xf160
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1260
cmpq $0x1, %rax
je 0x1acd
leaq 0x76aa(%rip), %rdi      # 0x9170
xorl %eax, %eax
callq 0x8a3c
movq 0xe8d4(%rip), %rdi      # 0x103a8
movq 0xe8d5(%rip), %rdx      # 0x103b0
pushq $0x4
popq %rsi
movq %rbx, %rcx
callq 0x1260
cmpq 0xe8c3(%rip), %rax      # 0x103b0
je 0x1afd
leaq 0x7687(%rip), %rdi      # 0x917d
xorl %eax, %eax
callq 0x8a3c
leaq 0xe8b4(%rip), %rdi      # 0x103b8
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1260
cmpq $0x1, %rax
je 0x1b26
leaq 0x766b(%rip), %rdi      # 0x918a
xorl %eax, %eax
callq 0x8a3c
movq 0xe893(%rip), %rdi      # 0x103c0
movl 0xe885(%rip), %edx      # 0x103b8
pushq $0x8
popq %rsi
movq %rbx, %rcx
callq 0x1260
movl 0xe874(%rip), %ecx      # 0x103b8
cmpq %rcx, %rax
je 0x1b57
leaq 0x7655(%rip), %rdi      # 0x91a5
xorl %eax, %eax
callq 0x8a3c
movq 0xe832(%rip), %rdi      # 0x10390
movq %rbx, %rsi
callq 0x8646
testb %al, %al
jne 0x1b78
leaq 0x764e(%rip), %rdi      # 0x91bf
xorl %eax, %eax
callq 0x8a3c
movq 0xe819(%rip), %rdi      # 0x10398
movq %rbx, %rsi
callq 0x8646
testb %al, %al
jne 0x1b99
leaq 0x764d(%rip), %rdi      # 0x91df
xorl %eax, %eax
callq 0x8a3c
pushq $0x1
popq %rbp
pushq $0x8
popq %r14
leaq 0x765c(%rip), %r15      # 0x9203
movq 0xe7ea(%rip), %rax      # 0x10398
cmpl 0x18(%rax), %ebp
jge 0x1bef
movq 0x8(%rax), %r12
movslq 0x14(%rax), %rax
movslq %ebp, %r13
imulq %rax, %r13
movq 0x10(%r12,%r13), %rdi
movl 0x4(%r12,%r13), %edx
movq %r14, %rsi
movq %rbx, %rcx
callq 0x1260
movl 0x4(%r12,%r13), %ecx
cmpq %rcx, %rax
je 0x1beb
movq %r15, %rdi
xorl %eax, %eax
callq 0x8a3c
incl %ebp
jmp 0x1ba7
movq %rbx, %rdi
callq 0x10b0
movq 0xe7a2(%rip), %rdi      # 0x103a0
movq 0xe7ab(%rip), %rdx      # 0x103b0
movq 0xe78c(%rip), %rax      # 0x10398
movl 0x18(%rax), %ecx
leaq 0x75fa(%rip), %rsi      # 0x9210
xorl %eax, %eax
callq 0x1150
movq 0xe77c(%rip), %rax      # 0x103a0
movq 0xd39d(%rip), %rcx      # 0xefc8
cmpq (%rcx), %rax
je 0x1c5d
movq 0xe779(%rip), %rsi      # 0x103b0
movq 0xe75a(%rip), %rax      # 0x10398
movl 0x18(%rax), %edx
leaq 0x75c8(%rip), %rdi      # 0x9210
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10d0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq