// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/genoFind.c
// Function: gfStraightFindNearHits
static struct gfHit *gfStraightFindNearHits(struct genoFind *gf, aaSeq *seq, 
	Bits *qMaskBits, int qMaskOffset, struct lm *lm, int *retHitCount,
	struct gfSeqSource *target, int tMin, int tMax)
/* Find hits associated with one sequence in a non-segmented
 * index where hits can mismatch in one letter. */
{
struct gfHit *hitList = NULL, *hit;
int size = seq->size;
int tileSize = gf->tileSize;
int lastStart = size - tileSize;
char *poly = seq->dna;
int i, j;
int tile;
int listSize;
bits32 qStart, *tList;
int hitCount = 0;
int varPos, varVal;	/* Variable position. */
int (*makeTile)(char *poly, int n); 
int alphabetSize;
char oldChar, zeroChar;
int *seqValLookup;
int posMul, avoid;

initNtLookup();
if (gf->isPep)
    {
    makeTile = gfPepTile;
    alphabetSize = 20;
    zeroChar = 'A';
    seqValLookup = aaVal;
    }
else
    {
    makeTile = gfDnaTile;
    alphabetSize = 4;
    zeroChar = 't';
    seqValLookup = ntVal;
    }

for (i=0; i<=lastStart; ++i)
    {
    posMul = 1;
    for (varPos = tileSize-1; varPos >=0; --varPos)
	{
	/* Make a tile that has zero value at variable position. */
	oldChar = poly[i+varPos];
	poly[i+varPos] = zeroChar;
	tile = makeTile(poly+i, tileSize);
	poly[i+varPos] = oldChar;

	/* Avoid checking the unmodified tile multiple times. */
	if (varPos == 0)
	    avoid = -1;
	else
	    avoid = seqValLookup[(int)oldChar];

	if (tile >= 0)
	    {
	    /* Look up all possible values of variable position. */
	    for (varVal=0; varVal<alphabetSize; ++varVal)
		{
		if (varVal != avoid)
		    {
		    listSize = gf->listSizes[tile];
		    if (listSize > 0)
			{
			qStart = i;
			if (qMaskBits == NULL || bitCountRange(qMaskBits, qStart+qMaskOffset, tileSize) == 0)
			    {
			    tList = gf->lists[tile];
			    for (j=0; j<listSize; ++j)
				{
				int tStart = tList[j];
				if (target == NULL || 
					(target == findSource(gf, tStart) 
					&& tStart >= tMin && tStart < tMax) ) 
				    {
				    lmAllocVar(lm,hit);
				    hit->qStart = qStart;
				    hit->tStart = tStart;
				    hit->diagonal = tStart + size - qStart;
				    slAddHead(&hitList, hit);
				    ++hitCount;
				    }
				}
			    }
			}
		    }
		tile += posMul;
		}
	    }
	posMul *= alphabetSize;
	}
    }
*retHitCount = hitCount;
return hitList;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
subl -0x48(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x7c(%rbp)
callq 0xfde0
movq -0x8(%rbp), %rax
cmpb $0x0, 0x28(%rax)
je 0x10392
leaq -0x369a(%rip), %rax     # 0xccd0
movq %rax, -0x90(%rbp)
movl $0x14, -0x94(%rbp)
movb $0x41, -0x96(%rbp)
leaq 0xf9247(%rip), %rax     # 0x1095d0
movq %rax, -0xa0(%rbp)
jmp 0x103bf
leaq -0x3749(%rip), %rax     # 0xcc50
movq %rax, -0x90(%rbp)
movl $0x4, -0x94(%rbp)
movb $0x74, -0x96(%rbp)
leaq 0xf74e8(%rip), %rax     # 0x1078a0
movq %rax, -0xa0(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x1062c
movl $0x1, -0xa4(%rbp)
movl -0x48(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x80(%rbp)
jl 0x1061c
movq -0x58(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl -0x80(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x95(%rbp)
movb -0x96(%rbp), %dl
movq -0x58(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl -0x80(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rdi
movslq -0x5c(%rbp), %rcx
addq %rcx, %rdi
movl -0x48(%rbp), %esi
callq *%rax
movl %eax, -0x64(%rbp)
movb -0x95(%rbp), %dl
movq -0x58(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl -0x80(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x80(%rbp)
jne 0x1045d
movl $0xffffffff, -0xa8(%rbp) # imm = 0xFFFFFFFF
jmp 0x10477
movq -0xa0(%rbp), %rax
movsbl -0x95(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xa8(%rbp)
cmpl $0x0, -0x64(%rbp)
jl 0x105fb
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x94(%rbp), %eax
jge 0x105f9
movl -0x84(%rbp), %eax
cmpl -0xa8(%rbp), %eax
je 0x105d9
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x68(%rbp)
jle 0x105d7
movl -0x5c(%rbp), %eax
movl %eax, -0x6c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x104f3
movq -0x18(%rbp), %rdi
movl -0x6c(%rbp), %esi
addl -0x1c(%rbp), %esi
movl -0x48(%rbp), %edx
callq 0x23e00
cmpl $0x0, %eax
jne 0x105d5
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x105d3
movq -0x78(%rbp), %rax
movslq -0x60(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xac(%rbp)
cmpq $0x0, 0x10(%rbp)
je 0x10571
movq 0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x10f20
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
jne 0x105c3
movl -0xac(%rbp), %eax
cmpl 0x18(%rbp), %eax
jl 0x105c3
movl -0xac(%rbp), %eax
cmpl 0x20(%rbp), %eax
jge 0x105c3
movq -0x28(%rbp), %rdi
movl $0x18, %esi
callq 0x3de60
movq %rax, -0x40(%rbp)
movl -0x6c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xac(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0xac(%rbp), %ecx
addl -0x44(%rbp), %ecx
subl -0x6c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x10f80
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x105c5
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x1050e
jmp 0x105d5
jmp 0x105d7
jmp 0x105d9
movl -0xa4(%rbp), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x1048b
jmp 0x105fb
movl -0x94(%rbp), %eax
imull -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0x80(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x103e5
jmp 0x1061e
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x103c6
movl -0x7c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)