// File: /workspace/github_c_makefile_star2_O1/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 0xd424(%rip), %edi      # 0x103a8
movl $0x4, %esi
callq 0x94f8
movq %rax, 0xd42b(%rip)      # 0x103c0
movq %r14, %rdi
movq %rax, %rsi
callq 0x334d
movl 0xd402(%rip), %edi      # 0x103a8
movl $0x4, %esi
callq 0x94f8
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
callq 0x334d
movl 0xd3e4(%rip), %edi      # 0x103a8
movl $0x1, %esi
callq 0x94f8
movq %rax, 0xd3f3(%rip)      # 0x103c8
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8c70
movq %rax, %r14
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8c70
movq %rax, %r12
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8c70
movq %rax, %r15
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x8c70
movq %rax, %r13
cmpl $0x2, 0xd384(%rip)      # 0x103a8
jb 0x3190
xorl %ebx, %ebx
movq 0xd38d(%rip), %rax      # 0x103c0
movzwl 0x4(%rax,%rbx,4), %eax
testw %ax, %ax
jne 0x3049
cmpw $0x0, 0x4(%rbp,%rbx,4)
je 0x3144
testw %ax, %ax
jle 0x3086
cmpw $0x0, 0x4(%rbp,%rbx,4)
jle 0x3086
movq 0xd36b(%rip), %rax      # 0x103c8
movb $0x3, 0x1(%rax,%rbx)
movq 0xd317(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
leal 0x1(%rbx), %edx
movslq %edx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r14, %rdi
jmp 0x316f
testw %ax, %ax
js 0x30f8
cmpw $0x0, 0x4(%rbp,%rbx,4)
js 0x30f8
cmpw $0x1, %ax
movl $0x0, %eax
adcb $0x1, %al
movq 0xd323(%rip), %rcx      # 0x103c8
movb %al, 0x1(%rcx,%rbx)
movq 0xd2d0(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
leal 0x1(%rbx), %edx
movslq %edx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r12, %rdi
callq 0x8f2b
incl (%rax)
movq 0xd2ea(%rip), %rax      # 0x103c0
cmpw $0x0, 0x4(%rax,%rbx,4)
jne 0x3176
movzwl 0x4(%rbp,%rbx,4), %ecx
movw %cx, 0x4(%rax,%rbx,4)
movzwl 0x6(%rbp,%rbx,4), %ecx
movw %cx, 0x6(%rax,%rbx,4)
jmp 0x3176
movq 0xd2c9(%rip), %rax      # 0x103c8
movb $0x4, 0x1(%rax,%rbx)
movq 0xd275(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
leal 0x1(%rbx), %edx
movslq %edx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r13, %rdi
callq 0x8f2b
incl (%rax)
movzwl 0x4(%rbp,%rbx,4), %eax
movq 0xd28a(%rip), %rcx      # 0x103c0
cmpw 0x4(%rcx,%rbx,4), %ax
jge 0x3176
movw %ax, 0x4(%rcx,%rbx,4)
jmp 0x3176
movq 0xd27d(%rip), %rax      # 0x103c8
movb $0x0, 0x1(%rax,%rbx)
movq 0xd229(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
leal 0x1(%rbx), %edx
movslq %edx, %rdx
imulq %rax, %rdx
movl (%rcx,%rdx), %esi
movq %r15, %rdi
callq 0x8f2b
incl (%rax)
movl 0xd22c(%rip), %eax      # 0x103a8
leaq 0x1(%rbx), %rcx
addq $0x2, %rbx
cmpq %rax, %rbx
movq %rcx, %rbx
jb 0x302c
movq %rbp, 0x10(%rsp)
movq 0xd1f4(%rip), %rcx      # 0x10390
leaq 0x73b7(%rip), %rdi      # 0xa55a
movl $0xf, %esi
movl $0x1, %edx
callq 0x1250
movq 0xd1d7(%rip), %rcx      # 0x10390
leaq 0x73aa(%rip), %rdi      # 0xa56a
movl $0x9, %esi
movl $0x1, %edx
callq 0x1250
movq %r14, %rdi
callq 0x2efb
movq 0xd1b2(%rip), %rcx      # 0x10390
leaq 0x738f(%rip), %rdi      # 0xa574
movl $0x9, %esi
movl $0x1, %edx
callq 0x1250
movq %r12, %rdi
callq 0x2efb
movq 0xd18d(%rip), %rcx      # 0x10390
leaq 0x7374(%rip), %rdi      # 0xa57e
movl $0x8, %esi
movl $0x1, %edx
callq 0x1250
movq %r13, %rdi
callq 0x2efb
movq 0xd168(%rip), %rcx      # 0x10390
leaq 0x7358(%rip), %rdi      # 0xa587
movl $0x8, %esi
movl $0x1, %edx
callq 0x1250
movq %r15, %rdi
callq 0x2efb
cmpb $0x0, 0xd123(%rip)      # 0x10370
je 0x3315
movq 0xd136(%rip), %rcx      # 0x10390
leaq 0x732f(%rip), %rdi      # 0xa590
movl $0x3d, %esi
movl $0x1, %edx
callq 0x1250
movl $0x1, %ebp
leaq 0x7352(%rip), %rbx      # 0xa5ce
movl $0x0, %ecx
cmpl %ebp, 0x18(%r15)
jle 0x3299
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 0x32be
movq 0x8(%r12), %rax
movslq 0x14(%r12), %rdx
movslq %ebp, %rsi
imulq %rdx, %rsi
movl (%rax,%rsi), %r8d
cmpl %ebp, 0x18(%r14)
jle 0x32d7
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 0x32f1
movq 0x8(%r13), %rax
movslq 0x14(%r13), %rdx
movslq %ebp, %rsi
imulq %rdx, %rsi
movl (%rax,%rsi), %eax
movq 0xd098(%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 0x327c
movq %r14, %rdi
callq 0x8dc9
movq %r12, %rdi
callq 0x8dc9
movq %r13, %rdi
callq 0x8dc9
movq %r15, %rdi
callq 0x8dc9
movq 0x10(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1040