// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/psl.c
// Function: pslFromFakeFfAli
struct psl *pslFromFakeFfAli(struct ffAli *ff, 
	DNA *needle, DNA *haystack, char strand,
	char *qName, int qSize, char *tName, int tSize)
/* This will create a basic psl structure from a sorted series of ffAli
 * blocks.  The fields that would need actual sequence to be filled in
 * are left zero however - fields including match, repMatch, mismatch. */
{
struct psl *psl;
unsigned *blockSizes;
unsigned *qStarts;
unsigned *tStarts;
int blockCount;
int i;
int nStart, hStart;
int nEnd, hEnd;

AllocVar(psl);
psl->blockCount = blockCount = ffAliCount(ff);
psl->blockSizes = AllocArray(blockSizes, blockCount);
psl->qStarts = AllocArray(qStarts, blockCount);
psl->tStarts = AllocArray(tStarts, blockCount);
psl->qName = cloneString(qName);
psl->qSize = qSize;
psl->tName = cloneString(tName);
psl->tSize = tSize;
psl->strand[0] = strand;

for (i=0; i<blockCount; ++i)
    {
    nStart = ff->nStart - needle;
    nEnd = ff->nEnd - needle;
    hStart = ff->hStart - haystack;
    hEnd = ff->hEnd - haystack;
    blockSizes[i] = nEnd - nStart;
    qStarts[i] = nStart;
    tStarts[i] = hStart;
    if (i == 0)
       {
       psl->qStart = nStart;
       psl->tStart = hStart;
       }
    if (i == blockCount-1)
       {
       psl->qEnd = nEnd;
       psl->tEnd = hEnd;
       }
    ff = ff->right;
    }
if (strand == '-')
    {
    reverseIntRange(&psl->qStart, &psl->qEnd, psl->qSize);
    }
return psl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %cl, %al
movl 0x18(%rbp), %ecx
movq 0x10(%rbp), %rcx
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl $0x88, %edi
callq 0x40c50
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x37d90
movl %eax, %ecx
movl %ecx, -0x54(%rbp)
movq -0x38(%rbp), %rax
movl %ecx, 0x5c(%rax)
movslq -0x54(%rbp), %rdi
shlq $0x2, %rdi
callq 0x409d0
movq %rax, %rcx
movq %rcx, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq %rcx, 0x60(%rax)
movslq -0x54(%rbp), %rdi
shlq $0x2, %rdi
callq 0x409d0
movq %rax, %rcx
movq %rcx, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq %rcx, 0x68(%rax)
movslq -0x54(%rbp), %rdi
shlq $0x2, %rdi
callq 0x409d0
movq %rax, %rcx
movq %rcx, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x28(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x30(%rax)
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x38(%rax)
movq 0x10(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x48(%rax)
movl 0x18(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x50(%rax)
movb -0x19(%rbp), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x28(%rax)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x4fc92
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x68(%rbp)
movl -0x64(%rbp), %edx
subl -0x5c(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x58(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x5c(%rbp), %edx
movq -0x48(%rbp), %rax
movslq -0x58(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x60(%rbp), %edx
movq -0x50(%rbp), %rax
movslq -0x58(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x58(%rbp)
jne 0x4fc57
movl -0x5c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x3c(%rax)
movl -0x60(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x54(%rax)
movl -0x58(%rbp), %eax
movl -0x54(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4fc78
movl -0x64(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x40(%rax)
movl -0x68(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x4fbbc
movsbl -0x19(%rbp), %eax
cmpl $0x2d, %eax
jne 0x4fcb7
movq -0x38(%rbp), %rdi
addq $0x3c, %rdi
movq -0x38(%rbp), %rsi
addq $0x40, %rsi
movq -0x38(%rbp), %rax
movl 0x38(%rax), %edx
callq 0x33350
movq -0x38(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)