// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/genoFind.c
// Function: gfIndexNibsAndTwoBits
struct genoFind *gfIndexNibsAndTwoBits(int fileCount, char *fileNames[],
	int minMatch, int maxGap, int tileSize, int maxPat, char *oocFile,
	boolean allowOneMismatch, int stepSize)
/* Make index for all nibs and .2bits in list. 
 *      minMatch - minimum number of matching tiles to trigger alignments
 *      maxGap   - maximum deviation from diagonal of tiles
 *      tileSize - size of tile in nucleotides
 *      maxPat   - maximum use of tile to not be considered a repeat
 *      oocFile  - .ooc format file that lists repeat tiles.  May be NULL. 
 *      allowOneMismatch - allow one mismatch in a tile.  
 *      stepSize - space between tiles.  Zero means default (which is tileSize). */
{
struct genoFind *gf = gfNewEmpty(minMatch, maxGap, tileSize, stepSize,
	maxPat, oocFile, FALSE, allowOneMismatch);
int i;
bits32 offset = 0, nibSize;
char *fileName;
struct gfSeqSource *ss;
long long totalBases = 0, warnAt = maxTotalBases();
int totalSeq = 0;

if (allowOneMismatch)
    errAbort("Don't currently support allowOneMismatch in gfIndexNibsAndTwoBits");
if (stepSize == 0)
    stepSize = gf->tileSize;
for (i=0; i<fileCount; ++i)
    {
    fileName = fileNames[i];
    if (twoBitIsFile(fileName))
	{
	int seqCount;
	long long baseCount;
        gfCountTilesInTwoBit(gf, stepSize, fileName, &seqCount, &baseCount);
	totalBases += baseCount;
	totalSeq += seqCount;
	}
    else if (nibIsFile(fileName))
	{
	totalBases += gfCountTilesInNib(gf, stepSize, fileName);
	totalSeq += 1;
	}
    else
        errAbort("Unrecognized file type %s", fileName);
    /* Warn if they exceed 4 gig. */
    if (totalBases >= warnAt)
	errAbort("Exceeding 4 billion bases, sorry gfServer can't handle that.");
    }
gfAllocLists(gf);
gfZeroNonOverused(gf);
AllocArray(gf->sources, totalSeq);
gf->sourceCount = totalSeq;
ss = gf->sources;
for (i=0; i<fileCount; ++i)
    {
    fileName = fileNames[i];
    if (nibIsFile(fileName))
	{
	nibSize = gfAddTilesInNib(gf, fileName, offset, stepSize);
	ss->fileName = fileName;
	ss->start = offset;
	offset += nibSize;
	ss->end = offset;
	++ss;
	}
    else
        {
	struct twoBitFile *tbf = twoBitOpen(fileName);
	struct twoBitIndex *index;
	char nameBuf[PATH_LEN+256];
	for (index = tbf->indexList; index != NULL; index = index->next)
	    {
	    struct dnaSeq *seq = twoBitReadSeqFragLower(tbf, index->name, 0,0);
	    gfAddSeq(gf, seq, offset);
	    safef(nameBuf, sizeof(nameBuf), "%s:%s", fileName, index->name);
	    ss->fileName = cloneString(nameBuf);
	    ss->start = offset;
	    offset += seq->size;
	    ss->end = offset;
	    ++ss;
	    dnaSeqFree(&seq);
	    }
	twoBitClose(&tbf);
	}
    }
gf->totalSeqSize = offset;
gfZeroOverused(gf);
printf("Done adding\n");
return gf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
movl 0x20(%rbp), %ecx
movl -0x20(%rbp), %r8d
movq 0x10(%rbp), %r9
movl 0x18(%rbp), %eax
xorl %r10d, %r10d
movl $0x0, (%rsp)
movl %eax, 0x8(%rsp)
callq 0xd0c0
movq %rax, -0x28(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x0, -0x50(%rbp)
callq 0xcd50
movq %rax, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
cmpl $0x0, 0x18(%rbp)
je 0xcdfb
leaq 0xcab9b(%rip), %rdi     # 0xd798f
movb $0x0, %al
callq 0x35d40
cmpl $0x0, 0x20(%rbp)
jne 0xce0b
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, 0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xceda
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5aa00
cmpl $0x0, %eax
je 0xce6b
movq -0x28(%rbp), %rdi
movl 0x20(%rbp), %esi
movq -0x40(%rbp), %rdx
leaq -0x60(%rbp), %rcx
leaq -0x68(%rbp), %r8
callq 0xd270
movq -0x68(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x60(%rbp), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0xceb2
movq -0x40(%rbp), %rdi
callq 0x472b0
cmpl $0x0, %eax
je 0xce9e
movq -0x28(%rbp), %rdi
movl 0x20(%rbp), %esi
movq -0x40(%rbp), %rdx
callq 0xd340
cltq
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0xceb0
movq -0x40(%rbp), %rsi
leaq 0xcab28(%rip), %rdi     # 0xd79d1
movb $0x0, %al
callq 0x35d40
jmp 0xceb2
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jl 0xceca
leaq 0xcab28(%rip), %rdi     # 0xd79eb
movb $0x0, %al
callq 0x35d40
jmp 0xcecc
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xce12
movq -0x28(%rbp), %rdi
callq 0xd410
movq -0x28(%rbp), %rdi
callq 0xd530
movslq -0x5c(%rbp), %rax
imulq $0x28, %rax, %rdi
callq 0x409d0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x5c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xd090
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x472b0
cmpl $0x0, %eax
je 0xcf9b
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x30(%rbp), %edx
movl 0x20(%rbp), %ecx
callq 0xd5b0
movl %eax, -0x34(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x30(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x34(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x48(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x48(%rbp)
jmp 0xd080
movq -0x40(%rbp), %rdi
callq 0x59660
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0xd077
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rsi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x5a460
movq %rax, -0x388(%rbp)
movq -0x28(%rbp), %rdi
movq -0x388(%rbp), %rsi
movl -0x30(%rbp), %edx
callq 0xd680
leaq -0x380(%rbp), %rdi
movq -0x40(%rbp), %rcx
movq -0x78(%rbp), %rax
movq 0x8(%rax), %r8
movl $0x300, %esi            # imm = 0x300
leaq 0xcf864(%rip), %rdx     # 0xdc871
movb $0x0, %al
callq 0x31090
leaq -0x380(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x30(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x388(%rbp), %rax
movl 0x18(%rax), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x48(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x48(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x327f0
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0xcfb4
leaq -0x70(%rbp), %rdi
callq 0x594f0
jmp 0xd082
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xcf21
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rdi
callq 0xd7a0
leaq 0xca97e(%rip), %rdi     # 0xd7a28
movb $0x0, %al
callq 0x6070
movq -0x28(%rbp), %rax
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
nop