// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0xddf9(%rip), %edi      # 0x103b8
pushq $0x4
popq %r15
movq %r15, %rsi
callq 0x8b24
movq %rax, 0xddfe(%rip)      # 0x103d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2922
movl 0xddd5(%rip), %edi      # 0x103b8
movq %r15, %rsi
callq 0x8b24
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x2922
movl 0xddb9(%rip), %edi      # 0x103b8
pushq $0x1
popq %rbp
movq %rbp, %rsi
callq 0x8b24
movq %rax, 0xddc7(%rip)      # 0x103d8
pushq $0x4
popq %r13
movl $0x100, %edi            # imm = 0x100
movl %r13d, %esi
callq 0x82c8
movq %rax, %r14
movl $0x100, %edi            # imm = 0x100
movl %r13d, %esi
callq 0x82c8
movq %rax, %r12
movl $0x100, %edi            # imm = 0x100
movl %r13d, %esi
callq 0x82c8
movq %rax, %r15
movl $0x100, %edi            # imm = 0x100
movl %r13d, %esi
callq 0x82c8
movq %rax, %r13
movl 0xdd5d(%rip), %eax      # 0x103b8
cmpq %rax, %rbp
jae 0x278a
movq 0xdd65(%rip), %rax      # 0x103d0
movzwl (%rax,%rbp,4), %eax
testw %ax, %ax
je 0x26af
jle 0x270f
movzwl (%rbx,%rbp,4), %ecx
testw %cx, %cx
jle 0x26bc
movq 0xdd4e(%rip), %rax      # 0x103d8
movb $0x3, (%rax,%rbp)
movq 0xdcfb(%rip), %rax      # 0x10390
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebp, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r14, %rdi
jmp 0x277b
movzwl (%rbx,%rbp,4), %ecx
testw %cx, %cx
je 0x2754
testw %cx, %cx
js 0x270f
cmpw $0x1, %ax
movl $0x0, %eax
adcb $0x1, %al
movq 0xdd05(%rip), %rcx      # 0x103d8
movb %al, (%rcx,%rbp)
movq 0xdcb3(%rip), %rax      # 0x10390
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebp, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r12, %rdi
callq 0x8560
incl (%rax)
movq 0xdcd0(%rip), %rax      # 0x103d0
cmpw $0x0, (%rax,%rbp,4)
jne 0x2782
movl (%rbx,%rbp,4), %ecx
movl %ecx, (%rax,%rbp,4)
jmp 0x2782
movq 0xdcc2(%rip), %rax      # 0x103d8
movb $0x4, (%rax,%rbp)
movq 0xdc6f(%rip), %rax      # 0x10390
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebp, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r13, %rdi
callq 0x8560
incl (%rax)
movzwl (%rbx,%rbp,4), %eax
movq 0xdc88(%rip), %rcx      # 0x103d0
cmpw (%rcx,%rbp,4), %ax
jge 0x2782
movw %ax, (%rcx,%rbp,4)
jmp 0x2782
movq 0xdc7d(%rip), %rax      # 0x103d8
movb $0x0, (%rax,%rbp)
movq 0xdc2a(%rip), %rax      # 0x10390
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebp, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r15, %rdi
callq 0x8560
incl (%rax)
incq %rbp
jmp 0x2655
movq 0xdc0f(%rip), %rcx      # 0x103a0
leaq 0x6dc2(%rip), %rdi      # 0x955a
pushq $0xf
popq %rsi
pushq $0x1
popq %rbp
movq %rbp, %rdx
callq 0x1260
movq 0xdbf3(%rip), %rcx      # 0x103a0
leaq 0x6db6(%rip), %rdi      # 0x956a
pushq $0x9
popq %rsi
movq %rbp, %rdx
callq 0x1260
movq %r14, %rdi
callq 0x2541
movq 0xdbd2(%rip), %rcx      # 0x103a0
leaq 0x6d9f(%rip), %rdi      # 0x9574
pushq $0x9
popq %rsi
movq %rbp, %rdx
callq 0x1260
movq %r12, %rdi
callq 0x2541
movq 0xdbb1(%rip), %rcx      # 0x103a0
leaq 0x6d88(%rip), %rdi      # 0x957e
pushq $0x8
popq %rsi
movq %rbp, %rdx
callq 0x1260
movq %r13, %rdi
callq 0x2541
movq 0xdb90(%rip), %rcx      # 0x103a0
leaq 0x6d70(%rip), %rdi      # 0x9587
pushq $0x8
popq %rsi
movq %rbp, %rdx
callq 0x1260
movq %r15, %rdi
callq 0x2541
cmpb $0x0, 0xdb4f(%rip)      # 0x10380
je 0x28ec
movq 0xdb62(%rip), %rcx      # 0x103a0
leaq 0x6d4b(%rip), %rdi      # 0x9590
pushq $0x3d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1260
pushq $0x1
popq %rbp
cmpl $0x100, %ebp            # imm = 0x100
je 0x28ec
xorl %r8d, %r8d
movslq %ebp, %rax
movl $0x0, %ecx
cmpl %ebp, 0x18(%r15)
jle 0x287f
movq 0x8(%r15), %rcx
movslq 0x14(%r15), %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %ecx
cmpl %ebp, 0x18(%r12)
jle 0x2898
movq 0x8(%r12), %rdx
movslq 0x14(%r12), %rsi
imulq %rax, %rsi
movl (%rdx,%rsi), %r8d
xorl %edx, %edx
movl $0x0, %r9d
cmpl %ebp, 0x18(%r14)
jle 0x28b6
movq 0x8(%r14), %rsi
movslq 0x14(%r14), %rdi
imulq %rax, %rdi
movl (%rsi,%rdi), %r9d
cmpl %ebp, 0x18(%r13)
jle 0x28cb
movq 0x8(%r13), %rdx
movslq 0x14(%r13), %rsi
imulq %rax, %rsi
movl (%rdx,%rsi), %edx
movq 0xdace(%rip), %rdi      # 0x103a0
movl %edx, (%rsp)
leaq 0x6cf2(%rip), %rsi      # 0x95ce
movl %ebp, %edx
xorl %eax, %eax
callq 0x1150
incl %ebp
jmp 0x2853
movq %r14, %rdi
callq 0x8408
movq %r12, %rdi
callq 0x8408
movq %r13, %rdi
callq 0x8408
movq %r15, %rdi
callq 0x8408
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1040