// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/genoFind.c
// Function: gfIndexTransNibsAndTwoBits
void gfIndexTransNibsAndTwoBits(struct genoFind *transGf[2][3], 
    int fileCount, char *fileNames[], 
    int minMatch, int maxGap, int tileSize, int maxPat, char *oocFile,
    boolean allowOneMismatch, boolean doMask, int stepSize)
/* Make translated (6 frame) index for all .nib and .2bit files. */
{
struct genoFind *gf;
int i,isRc, frame;
bits32 offset[2][3];
char *fileName;
struct dnaSeq *seq;
int sourceCount = 0;
long long totalBases = 0, warnAt = maxTotalBases();

if (allowOneMismatch)
    errAbort("Don't currently support allowOneMismatch in gfIndexTransNibsAndTwoBits");
/* Allocate indices for all reading frames. */
for (isRc=0; isRc <= 1; ++isRc)
    {
    for (frame = 0; frame < 3; ++frame)
	{
	transGf[isRc][frame] = gf = gfNewEmpty(minMatch, maxGap, 
		tileSize, stepSize, maxPat, oocFile, TRUE, allowOneMismatch);
	}
    }

/* Mask simple AA repeats (of period 1 and 2). */
for (isRc = 0; isRc <= 1; ++isRc)
    for (frame = 0; frame < 3; ++frame)
	maskSimplePepRepeat(transGf[isRc][frame]);

/* Scan through .nib and .2bit files once counting tiles. */
for (i=0; i<fileCount; ++i)
    {
    fileName = fileNames[i];
    printf("Counting %s\n", fileName);
    if (nibIsFile(fileName))
	{
	seq = readMaskedNib(fileName, doMask);
	transCountBothStrands(seq, transGf);
	sourceCount += 1;
	totalBases += seq->size;
	freeDnaSeq(&seq);
	}
    else if (twoBitIsFile(fileName))
        {
	struct twoBitFile *tbf = twoBitOpen(fileName);
	struct twoBitIndex *index;
	totalBases += twoBitCheckTotalSize(tbf);

	for (index = tbf->indexList; index != NULL; index = index->next)
	    {
	    seq = readMaskedTwoBit(tbf, index->name, doMask);
	    transCountBothStrands(seq, transGf);
	    sourceCount += 1;
	    freeDnaSeq(&seq);
	    }
	twoBitClose(&tbf);
	}
    else 
	errAbort("Unrecognized file type %s", fileName);
    if (totalBases >= warnAt)
	errAbort("Exceeding 4 billion bases, sorry gfServer can't handle that.");
    }

/* Get space for entries in indexed of all reading frames. */
for (isRc=0; isRc <= 1; ++isRc)
    {
    for (frame = 0; frame < 3; ++frame)
	{
	gf = transGf[isRc][frame];
	gfAllocLists(gf);
	gfZeroNonOverused(gf);
	AllocArray(gf->sources, sourceCount);
	gf->sourceCount = sourceCount;
	offset[isRc][frame] = 0;
	}
    }

/* Scan through nibs a second time building index. */
sourceCount = 0;
for (i=0; i<fileCount; ++i)
    {
    fileName = fileNames[i];
    printf("Indexing %s\n", fileName);
    if (nibIsFile(fileName))
	{
	seq = readMaskedNib(fileName, doMask);
	transIndexBothStrands(seq, transGf, offset, sourceCount, fileName);
	freeDnaSeq(&seq);
	sourceCount += 1;
	}
    else	/* .2bit file */
        {
	struct twoBitFile *tbf = twoBitOpen(fileName);
	struct twoBitIndex *index;
	for (index = tbf->indexList; index != NULL; index = index->next)
	    {
	    char nameBuf[PATH_LEN+256];
	    safef(nameBuf, sizeof(nameBuf), "%s:%s", fileName, index->name);
	    seq = readMaskedTwoBit(tbf, index->name, doMask);
	    transIndexBothStrands(seq, transGf, offset, sourceCount, nameBuf);
	    sourceCount += 1;
	    freeDnaSeq(&seq);
	    }
	twoBitClose(&tbf);
	}
    }

for (isRc=0; isRc <= 1; ++isRc)
    {
    for (frame = 0; frame < 3; ++frame)
	{
	gf = transGf[isRc][frame];
	gf->totalSeqSize = offset[isRc][frame];
	gfZeroOverused(gf);
	}
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3c0, %rsp            # imm = 0x3C0
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movl $0x0, -0x74(%rbp)
movq $0x0, -0x80(%rbp)
callq 0xcd50
movq %rax, -0x88(%rbp)
cmpl $0x0, 0x20(%rbp)
je 0xd970
leaq 0xca0cc(%rip), %rdi     # 0xd7a35
movb $0x0, %al
callq 0x35d40
movl $0x0, -0x38(%rbp)
cmpl $0x1, -0x38(%rbp)
jg 0xd9e7
movl $0x0, -0x3c(%rbp)
cmpl $0x3, -0x3c(%rbp)
jge 0xd9da
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl 0x30(%rbp), %ecx
movl 0x10(%rbp), %r8d
movq 0x18(%rbp), %r9
movl 0x20(%rbp), %eax
movl $0x1, (%rsp)
movl %eax, 0x8(%rsp)
callq 0xd0c0
movq %rax, %rdx
movq %rdx, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd984
jmp 0xd9dc
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd977
movl $0x0, -0x38(%rbp)
cmpl $0x1, -0x38(%rbp)
jg 0xda35
movl $0x0, -0x3c(%rbp)
cmpl $0x3, -0x3c(%rbp)
jge 0xda28
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xde30
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd9fb
jmp 0xda2a
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd9ee
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xdbab
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rsi
leaq 0xca019(%rip), %rdi     # 0xd7a7c
movb $0x0, %al
callq 0x6070
movq -0x68(%rbp), %rdi
callq 0x472b0
cmpl $0x0, %eax
je 0xdabc
movq -0x68(%rbp), %rdi
movl 0x28(%rbp), %esi
callq 0xd820
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xdef0
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x70(%rbp), %rax
movslq 0x18(%rax), %rax
addq -0x80(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x327f0
jmp 0xdb80
movq -0x68(%rbp), %rdi
callq 0x5aa00
cmpl $0x0, %eax
je 0xdb6c
movq -0x68(%rbp), %rdi
callq 0x59660
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
callq 0xdfa0
addq -0x80(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x90(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0xdb5e
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
movl 0x28(%rbp), %edx
callq 0xd890
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xdef0
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x327f0
movq -0x98(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x98(%rbp)
jmp 0xdb04
leaq -0x90(%rbp), %rdi
callq 0x594f0
jmp 0xdb7e
movq -0x68(%rbp), %rsi
leaq 0xc9e5a(%rip), %rdi     # 0xd79d1
movb $0x0, %al
callq 0x35d40
jmp 0xdb80
movq -0x80(%rbp), %rax
cmpq -0x88(%rbp), %rax
jl 0xdb9b
leaq 0xc9e57(%rip), %rdi     # 0xd79eb
movb $0x0, %al
callq 0x35d40
jmp 0xdb9d
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xda3c
movl $0x0, -0x38(%rbp)
cmpl $0x1, -0x38(%rbp)
jg 0xdc4d
movl $0x0, -0x3c(%rbp)
cmpl $0x3, -0x3c(%rbp)
jge 0xdc3d
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xd410
movq -0x30(%rbp), %rdi
callq 0xd530
movslq -0x74(%rbp), %rax
imulq $0x28, %rax, %rdi
callq 0x409d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x74(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x1c(%rax)
movslq -0x38(%rbp), %rcx
leaq -0x60(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xdbc3
jmp 0xdc3f
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xdbb2
movl $0x0, -0x74(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xddac
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rsi
leaq 0xc9e07(%rip), %rdi     # 0xd7a89
movb $0x0, %al
callq 0x6070
movq -0x68(%rbp), %rdi
callq 0x472b0
cmpl $0x0, %eax
je 0xdcd6
movq -0x68(%rbp), %rdi
movl 0x28(%rbp), %esi
callq 0xd820
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movl -0x74(%rbp), %ecx
movq -0x68(%rbp), %r8
callq 0xe000
leaq -0x70(%rbp), %rdi
callq 0x327f0
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xdd9c
movq -0x68(%rbp), %rdi
callq 0x59660
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
je 0xdd90
leaq -0x3b0(%rbp), %rdi
movq -0x68(%rbp), %rcx
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %r8
movl $0x300, %esi            # imm = 0x300
leaq 0xceb49(%rip), %rdx     # 0xdc871
movb $0x0, %al
callq 0x31090
movq -0xa0(%rbp), %rdi
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rsi
movl 0x28(%rbp), %edx
callq 0xd890
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movl -0x74(%rbp), %ecx
leaq -0x3b0(%rbp), %r8
callq 0xe000
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x327f0
movq -0xa8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
jmp 0xdcf8
leaq -0xa0(%rbp), %rdi
callq 0x594f0
jmp 0xdd9e
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xdc5b
movl $0x0, -0x38(%rbp)
cmpl $0x1, -0x38(%rbp)
jg 0xde1f
movl $0x0, -0x3c(%rbp)
cmpl $0x3, -0x3c(%rbp)
jge 0xde12
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movslq -0x38(%rbp), %rcx
leaq -0x60(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x30(%rbp), %rdi
callq 0xd7a0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xddc0
jmp 0xde14
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xddb3
addq $0x3c0, %rsp            # imm = 0x3C0
popq %rbp
retq
nopl (%rax,%rax)