// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/genoFind.c
// Function: pcrClumps
static struct gfClump *pcrClumps(struct genoFind *gf, char *fPrimer, int fPrimerSize, 
	char *rPrimer, int rPrimerSize, int minDistance, int maxDistance)
/* Find possible PCR hits.  The fPrimer and rPrimer are on the same strand. */
{
struct gfClump *clumpList = NULL;
int tileSize = gf->tileSize;
int fTile;
int fTileCount = fPrimerSize - tileSize;
int *rTiles, rTile;
int rTileCount = rPrimerSize - tileSize;
int fTileIx,rTileIx,fPosIx,rPosIx;
bits32 *fPosList, fPos, *rPosList, rPos;
int fPosListSize, rPosListSize;
struct hash *targetHash = newHash(0);

/* Build up array of all tiles in reverse primer. */
AllocArray(rTiles, rTileCount);
for (rTileIx = 0; rTileIx<rTileCount; ++rTileIx)
    {
    rTiles[rTileIx] = gfDnaTile(rPrimer + rTileIx, tileSize);
    if (rTiles[rTileIx] == -1)
        errAbort("Bad char in reverse primer sequence: %s", rPrimer);
    }

/* Loop through all tiles in forward primer. */
for (fTileIx=0; fTileIx<fTileCount; ++fTileIx)
    {
    fTile = gfDnaTile(fPrimer + fTileIx, tileSize);
    if (fTile >= 0)
        {
	fPosListSize = gf->listSizes[fTile];
	fPosList = gf->lists[fTile];
	for (fPosIx=0; fPosIx < fPosListSize; ++fPosIx)
	    {
	    fPos = fPosList[fPosIx];
	    /* Loop through hits to reverse primer. */
	    for (rTileIx=0; rTileIx < rTileCount; ++rTileIx)
	        {
		rTile = rTiles[rTileIx];
		rPosListSize = gf->listSizes[rTile];
		rPosList = gf->lists[rTile];
		for (rPosIx=0; rPosIx < rPosListSize; ++rPosIx)
		    {
		    rPos = rPosList[rPosIx];
		    if (rPos > fPos)
		        {
			int distance = rPos - fPos;
			if (distance >= minDistance && distance <= maxDistance)
			    {
			    struct gfSeqSource *target = findSource(gf, fPos);
			    if (rPos < target->end)
			        {
				struct binKeeper *bk;
				int tStart = target->start;
				char *tName = target->fileName;
				if (tName == NULL)
				    tName = target->seq->name;
				if ((bk = hashFindVal(targetHash, tName)) == NULL)
				    {
				    bk = binKeeperNew(0, target->end - tStart);
				    hashAdd(targetHash, tName, bk);
				    }
				mergeAdd(bk, fPos - tStart, rPos - tStart, target);
				}
			    }
			}
		    }
		}
	    }
	}
    }

/* Make clumps and clean up temporary structures. */
    {
    struct hashEl *tList, *tEl;
    tList = hashElListHash(targetHash);
    for (tEl = tList; tEl != NULL; tEl = tEl->next)
        {
	struct binKeeper *bk = tEl->val;
	struct binElement *bkList, *bkEl;
	bkList = binKeeperFindAll(bk);
	for (bkEl = bkList; bkEl != NULL; bkEl = bkEl->next)
	    {
	    struct gfClump *clump;
	    AllocVar(clump);
	    clump->target = bkEl->val;
	    clump->tStart = bkEl->start;
	    clump->tEnd = bkEl->end;
	    slAddHead(&clumpList, clump);
	    }
	slFreeList(&bkList);
	binKeeperFree(&bk);
	}
    hashElFreeList(&tList);
    hashFree(&targetHash);
    }
freez(&rTiles);
return clumpList;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x14(%rbp), %eax
subl -0x34(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x24(%rbp), %eax
subl -0x34(%rbp), %eax
movl %eax, -0x50(%rbp)
xorl %edi, %edi
movl $0x1, %esi
callq 0x398a0
movq %rax, -0x90(%rbp)
movslq -0x50(%rbp), %rdi
shlq $0x2, %rdi
callq 0x409d0
movq %rax, -0x48(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0xf899
movq -0x20(%rbp), %rdi
movslq -0x58(%rbp), %rax
addq %rax, %rdi
movl -0x34(%rbp), %esi
callq 0xcc50
movl %eax, %edx
movq -0x48(%rbp), %rax
movslq -0x58(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
movslq -0x58(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0xf88c
movq -0x20(%rbp), %rsi
leaq 0xc846b(%rip), %rdi     # 0xd7cf0
movb $0x0, %al
callq 0x35d40
jmp 0xf88e
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xf844
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xfae2
movq -0x10(%rbp), %rdi
movslq -0x54(%rbp), %rax
addq %rax, %rdi
movl -0x34(%rbp), %esi
callq 0xcc50
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0xfad2
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x80(%rbp), %eax
jge 0xfad0
movq -0x68(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0xfac0
movq -0x48(%rbp), %rax
movslq -0x58(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x84(%rbp), %eax
jge 0xfab0
movq -0x78(%rbp), %rax
movslq -0x60(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jbe 0xfaa0
movl -0x7c(%rbp), %eax
subl -0x6c(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
cmpl -0x28(%rbp), %eax
jl 0xfa9e
movl -0x94(%rbp), %eax
cmpl 0x10(%rbp), %eax
jg 0xfa9e
movq -0x8(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x10f20
movq %rax, -0xa0(%rbp)
movl -0x7c(%rbp), %eax
movq -0xa0(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jae 0xfa9c
movq -0xa0(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0xac(%rbp)
movq -0xa0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
jne 0xfa1f
movq -0xa0(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x90(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x39630
movq %rax, -0xa8(%rbp)
cmpq $0x0, %rax
jne 0xfa77
movq -0xa0(%rbp), %rax
movl 0x1c(%rax), %esi
subl -0xac(%rbp), %esi
xorl %edi, %edi
callq 0x24ac0
movq %rax, -0xa8(%rbp)
movq -0x90(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq -0xa8(%rbp), %rdx
callq 0x39230
movq -0xa8(%rbp), %rdi
movl -0x6c(%rbp), %esi
subl -0xac(%rbp), %esi
movl -0x7c(%rbp), %edx
subl -0xac(%rbp), %edx
movq -0xa0(%rbp), %rcx
callq 0x116d0
jmp 0xfa9e
jmp 0xfaa0
jmp 0xfaa2
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0xf964
jmp 0xfab2
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xf91a
jmp 0xfac2
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0xf8f9
jmp 0xfad2
jmp 0xfad4
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xf8a0
movq -0x90(%rbp), %rdi
callq 0x39d50
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0xfbee
movq -0xc8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x25200
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0xe0(%rbp)
je 0xfbc0
movl $0x38, %edi
callq 0x40c50
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0xe8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0xe0(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0xe8(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x10f80
movq -0xe0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
jmp 0xfb44
leaq -0xd8(%rbp), %rdi
callq 0x2ab30
leaq -0xd0(%rbp), %rdi
callq 0x24c00
movq -0xc8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
jmp 0xfb03
leaq -0xc0(%rbp), %rdi
callq 0x39e40
leaq -0x90(%rbp), %rdi
callq 0x3a080
leaq -0x48(%rbp), %rdi
callq 0x40d70
movq -0x30(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax)