// File: /workspace/github_c_makefile_star2_O3/richarddurbin[P]hash10x/hash10x.c
// Function: cribBuild
void cribBuild (FILE *f1, FILE *f2)
{
  crib = new0 (hashNumber, CribInfo) ; cribAddGenome (f1, crib) ;
  CribInfo *crib2 = new0 (hashNumber, CribInfo) ; cribAddGenome (f2, crib2) ;

  cribType = new0 (hashNumber, U8) ;
  Array aHom = arrayCreate (256, int), aHet = arrayCreate (256, int) ;
  Array aErr = arrayCreate (256, int), aMul = arrayCreate (256, int) ;
  int i ;
  for (i = 1 ; i < hashNumber ; ++i)
    if (crib[i].chr == 0 && crib2[i].chr == 0)
      { cribType[i] = CRIB_ERR ; ++array(aErr, arr(hashDepth, i, int), int) ; }
    else if (crib[i].chr > 0 && crib2[i].chr > 0)
      { cribType[i] = CRIB_HOM ; ++array(aHom, arr(hashDepth, i, int), int) ; }
    else if (crib[i].chr < 0 || crib2[i].chr < 0)
      { cribType[i] = CRIB_MUL ; ++array(aMul, arr(hashDepth, i, int), int) ;
	if (crib2[i].chr < crib[i].chr) crib[i].chr = crib2[i].chr ;
      }
    else
      { cribType[i] = crib[i].chr ? CRIB_HTA : CRIB_HTB ;
	++array(aHet, arr(hashDepth, i, int), int) ;
	if (!crib[i].chr) { crib[i].chr = crib2[i].chr ; crib[i].pos = crib2[i].pos ; }
      }

  fprintf (outFile, "  crib matches\n") ;
  fprintf (outFile, "    hom  ") ; printArrayStats (aHom) ;
  fprintf (outFile, "    het  ") ; printArrayStats (aHet) ;
  fprintf (outFile, "    mul ") ; printArrayStats (aMul) ;
  fprintf (outFile, "    err ") ; printArrayStats (aErr) ;

  if (isPrintTables)
    { fprintf (outFile, "CRIB_TABLE      i   err         het          hom         mul\n") ;
      for (i = 1 ; i < 256 ; ++i)
	fprintf (outFile, "CRIB_TABLE      %4d%12d%12d%12d%12d\n", i,
		 arrayMax(aErr)>i?arr(aErr,i,int):0, arrayMax(aHet)>i?arr(aHet,i,int):0,
		 arrayMax(aHom)>i?arr(aHom,i,int):0, arrayMax(aMul)>i?arr(aMul,i,int):0) ;
    }

  arrayDestroy (aHom) ; arrayDestroy (aHet) ; arrayDestroy (aMul) ; arrayDestroy (aErr) ;
  free (crib2) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0xd43c(%rip), %edi      # 0x103a8
movl $0x4, %esi
callq 0x96e8
movq %rax, 0xd443(%rip)      # 0x103c0
movq %r14, %rdi
movq %rax, %rsi
callq 0x3308
movl 0xd41a(%rip), %edi      # 0x103a8
movl $0x4, %esi
callq 0x96e8
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3308
movl 0xd3fc(%rip), %edi      # 0x103a8
movl $0x1, %ebx
movl $0x1, %esi
callq 0x96e8
movq %rax, 0xd406(%rip)      # 0x103c8
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8e88
movq %rax, %r14
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8e88
movq %rax, %r12
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8e88
movq %rax, %r15
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8e88
movq %rax, %r13
cmpl $0x2, 0xd397(%rip)      # 0x103a8
jb 0x314b
movq 0xd3a2(%rip), %rax      # 0x103c0
movzwl (%rax,%rbx,4), %eax
testw %ax, %ax
je 0x3063
jle 0x30c5
movzwl (%rbp,%rbx,4), %ecx
testw %cx, %cx
jle 0x3071
movq 0xd38a(%rip), %rax      # 0x103c8
movb $0x3, (%rax,%rbx)
movq 0xd337(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r14, %rdi
jmp 0x3132
movzwl (%rbp,%rbx,4), %ecx
testw %cx, %cx
je 0x310b
testw %cx, %cx
js 0x30c5
cmpw $0x1, %ax
movl $0x0, %eax
adcb $0x1, %al
movq 0xd340(%rip), %rcx      # 0x103c8
movb %al, (%rcx,%rbx)
movq 0xd2ee(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r12, %rdi
callq 0x9131
incl (%rax)
movq 0xd30b(%rip), %rax      # 0x103c0
cmpw $0x0, (%rax,%rbx,4)
jne 0x3139
movl (%rbp,%rbx,4), %ecx
movl %ecx, (%rax,%rbx,4)
jmp 0x3139
movq 0xd2fc(%rip), %rax      # 0x103c8
movb $0x4, (%rax,%rbx)
movq 0xd2a9(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r13, %rdi
callq 0x9131
incl (%rax)
movzwl (%rbp,%rbx,4), %eax
movq 0xd2c1(%rip), %rcx      # 0x103c0
cmpw (%rcx,%rbx,4), %ax
jge 0x3139
movw %ax, (%rcx,%rbx,4)
jmp 0x3139
movq 0xd2b6(%rip), %rax      # 0x103c8
movb $0x0, (%rax,%rbx)
movq 0xd263(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r15, %rdi
callq 0x9131
incl (%rax)
incq %rbx
movl 0xd266(%rip), %eax      # 0x103a8
cmpq %rax, %rbx
jb 0x3017
movq %rbp, 0x10(%rsp)
movq 0xd239(%rip), %rcx      # 0x10390
leaq 0x743c(%rip), %rdi      # 0xa59a
movl $0xf, %esi
movl $0x1, %edx
callq 0x1250
movq 0xd21c(%rip), %rcx      # 0x10390
leaq 0x742f(%rip), %rdi      # 0xa5aa
movl $0x9, %esi
movl $0x1, %edx
callq 0x1250
movq %r14, %rdi
callq 0x2ee3
movq 0xd1f7(%rip), %rcx      # 0x10390
leaq 0x7414(%rip), %rdi      # 0xa5b4
movl $0x9, %esi
movl $0x1, %edx
callq 0x1250
movq %r12, %rdi
callq 0x2ee3
movq 0xd1d2(%rip), %rcx      # 0x10390
leaq 0x73f9(%rip), %rdi      # 0xa5be
movl $0x8, %esi
movl $0x1, %edx
callq 0x1250
movq %r13, %rdi
callq 0x2ee3
movq 0xd1ad(%rip), %rcx      # 0x10390
leaq 0x73dd(%rip), %rdi      # 0xa5c7
movl $0x8, %esi
movl $0x1, %edx
callq 0x1250
movq %r15, %rdi
callq 0x2ee3
cmpb $0x0, 0xd168(%rip)      # 0x10370
je 0x32d0
movq 0xd17b(%rip), %rcx      # 0x10390
leaq 0x73b4(%rip), %rdi      # 0xa5d0
movl $0x3d, %esi
movl $0x1, %edx
callq 0x1250
movl $0x1, %ebp
leaq 0x73d7(%rip), %rbx      # 0xa60e
movl $0x0, %ecx
cmpl %ebp, 0x18(%r15)
jle 0x3254
movq 0x8(%r15), %rax
movslq 0x14(%r15), %rcx
movslq %ebp, %rdx
imulq %rcx, %rdx
movl (%rax,%rdx), %ecx
xorl %r9d, %r9d
movl $0x0, %r8d
cmpl %ebp, 0x18(%r12)
jle 0x3279
movq 0x8(%r12), %rax
movslq 0x14(%r12), %rdx
movslq %ebp, %rsi
imulq %rdx, %rsi
movl (%rax,%rsi), %r8d
cmpl %ebp, 0x18(%r14)
jle 0x3292
movq 0x8(%r14), %rax
movslq 0x14(%r14), %rdx
movslq %ebp, %rsi
imulq %rdx, %rsi
movl (%rax,%rsi), %r9d
xorl %eax, %eax
cmpl %ebp, 0x18(%r13)
jle 0x32ac
movq 0x8(%r13), %rax
movslq 0x14(%r13), %rdx
movslq %ebp, %rsi
imulq %rdx, %rsi
movl (%rax,%rsi), %eax
movq 0xd0dd(%rip), %rdi      # 0x10390
movl %eax, (%rsp)
movq %rbx, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x1150
incl %ebp
cmpl $0x100, %ebp            # imm = 0x100
jne 0x3237
movq %r14, %rdi
callq 0x8fd6
movq %r12, %rdi
callq 0x8fd6
movq %r13, %rdi
callq 0x8fd6
movq %r15, %rdi
callq 0x8fd6
movq 0x10(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1040