// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/blatSrc/blat.c
// Function: performSearch
void* performSearch(void* args)
{
    int             id=*((int*)(((void**)args)[0]));
    int             queryCount=*((int*)(((void**)args)[1]));
    char            **files=(char**)(((void**)args)[2]);
    struct lineFile *lf=(struct lineFile *)(((void**)args)[3]);
    struct genoFind *gf=(struct genoFind *)(((void**)args)[4]);
    boolean         isProt=*((boolean*)(((void**)args)[5]));
    struct hash     *maskHash=(struct hash *)(((void**)args)[6]);
    FILE            *outFile=(FILE *)(((void**)args)[7]);
    boolean         showStatus=*((boolean*)(((void**)args)[8]));
    struct gfOutput *gvo=(struct gfOutput *)(((void**)args)[9]);

    int             i;
    char            *fileName;
    int             count = 0;
    long long   totalSize = 0;

    unsigned faFastBufSize = 0;
    DNA *faFastBuf = NULL;


    if (id==0)
        gfOutputHead(gvo, outFile);
//for (i=0; i<queryCount; ++i)
    {
        fileName = files[0];
        if (nibIsFile(fileName))
        {
            struct dnaSeq *seq;

            if (isProt)
                errAbort("%s: Can't use .nib files with -prot or d=prot option\n", fileName);
            seq = nibLoadAllMasked(NIB_MASK_MIXED, fileName);
            freez(&seq->name);
            seq->name = cloneString(fileName);
            searchOneMaskTrim(seq, isProt, gf, outFile,
                              maskHash, &totalSize, &count, gvo);
            freeDnaSeq(&seq);
        }
        else if (twoBitIsSpec(fileName))
        {
            struct twoBitSpec *tbs = twoBitSpecNew(fileName);
            struct twoBitFile *tbf = twoBitOpen(tbs->fileName);
            if (isProt)
                errAbort("%s is a two bit file, which doesn't work for proteins.",
                         fileName);
            if (tbs->seqs != NULL)
            {
                struct twoBitSeqSpec *ss = NULL;
                for (ss = tbs->seqs;  ss != NULL;  ss = ss->next)
                {
                    struct dnaSeq *seq = twoBitReadSeqFrag(tbf, ss->name,
                                                           ss->start, ss->end);
                    searchOneMaskTrim(seq, isProt, gf, outFile,
                                      maskHash, &totalSize, &count, gvo);
                    dnaSeqFree(&seq);
                }
            }
            else
            {
                struct twoBitIndex *index = NULL;
                for (index = tbf->indexList; index != NULL; index = index->next)
                {
                    struct dnaSeq *seq = twoBitReadSeqFrag(tbf, index->name, 0, 0);
                    searchOneMaskTrim(seq, isProt, gf, outFile,
                                      maskHash, &totalSize, &count, gvo);
                    dnaSeqFree(&seq);
                }
            }
            twoBitClose(&tbf);
        }
        else
        {
            struct dnaSeq seq;
            seq.name=(char*)malloc(sizeof(char)*512);
            while (queryCount-- && faMixedSpeedReadNext(lf, &seq.dna, &seq.size, &seq.name, &faFastBuf, &faFastBufSize))
            {
                searchOneMaskTrim(&seq, isProt, gf, outFile,
                                  maskHash, &totalSize, &count, gvo);
            }
            free(seq.name);
            faFreeFastBuf(&faFastBuf, &faFastBufSize);
        }
    }
    if (showStatus)
        printf("Searched %lld bases in %d sequences\n", totalSize, count);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movl (%rcx), %ebx
movq 0x10(%rdi), %r14
movq 0x18(%rdi), %rcx
movq %rcx, 0x38(%rsp)
movq 0x20(%rdi), %rcx
movq %rcx, 0x30(%rsp)
movq 0x28(%rdi), %rcx
movl (%rcx), %ebp
movq 0x30(%rdi), %r12
movq 0x38(%rdi), %r13
movq 0x40(%rdi), %rcx
movl (%rcx), %r15d
movq 0x48(%rdi), %rcx
movq %rcx, 0x10(%rsp)
xorl %ecx, %ecx
cmpl %ecx, (%rax)
movl %ecx, 0xc(%rsp)
movq %rcx, 0x18(%rsp)
movl %ecx, 0x24(%rsp)
movq %rcx, 0x48(%rsp)
jne 0x8ccc
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x14721
movq %r13, 0x28(%rsp)
movq (%r14), %r13
movq %r13, %rdi
callq 0x3221b
testl %eax, %eax
je 0x8d59
testl %ebp, %ebp
movq 0x30(%rsp), %r14
je 0x8cfa
leaq 0x84889(%rip), %rdi     # 0x8d579
movq %r13, %rsi
xorl %eax, %eax
callq 0x26b6f
movl $0x1, %edi
movq %r13, %rsi
callq 0x31e3f
leaq 0x50(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x8(%rax), %rdi
callq 0x2dd51
movq %r13, %rdi
callq 0x1f9f6
movq (%rbx), %rdi
movq %rax, 0x8(%rdi)
leaq 0xc(%rsp), %rax
leaq 0x18(%rsp), %r9
movl %ebp, %esi
movq %r14, %rdx
movq 0x28(%rsp), %rcx
movq %r12, %r8
pushq 0x10(%rsp)
pushq %rax
callq 0x8b65
addq $0x10, %rsp
movq %rbx, %rdi
callq 0x24ab1
jmp 0x8f1e
movq %r13, %rdi
callq 0x3ef22
testl %eax, %eax
je 0x8e16
movq %r13, %rdi
callq 0x3ea7b
movq %rax, %rbx
movq (%rax), %rdi
callq 0x3e08d
movq %rax, 0x50(%rsp)
testl %ebp, %ebp
je 0x8d96
leaq 0x84823(%rip), %rdi     # 0x8d5af
movq %r13, %rsi
xorl %eax, %eax
callq 0x26b6f
movl %ebp, %r13d
movq %r12, %rcx
movl %r15d, 0x38(%rsp)
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x8e9f
movq 0x30(%rsp), %r12
movq %rcx, %r15
movq 0x28(%rsp), %rbp
movq 0x10(%rsp), %rbx
movq 0x50(%rsp), %rdi
movq 0x8(%r14), %rsi
movl 0x10(%r14), %edx
movl 0x14(%r14), %ecx
callq 0x3e899
movq %rax, 0x40(%rsp)
movq %rax, %rdi
movl %r13d, %esi
movq %r12, %rdx
movq %rbp, %rcx
movq %r15, %r8
leaq 0x18(%rsp), %r9
pushq %rbx
leaq 0x14(%rsp), %rax
pushq %rax
callq 0x8b65
addq $0x10, %rsp
leaq 0x40(%rsp), %rdi
callq 0x24ab1
movq (%r14), %r14
testq %r14, %r14
jne 0x8dc0
jmp 0x8f0f
movl $0x200, %edi            # imm = 0x200
callq 0x69d0
movq %rax, 0x58(%rsp)
testl %ebx, %ebx
je 0x8e84
leaq 0xc(%rsp), %r14
leaq 0x18(%rsp), %r13
movq 0x38(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x58(%rsp), %rcx
leaq 0x48(%rsp), %r8
leaq 0x24(%rsp), %r9
callq 0x2790a
testl %eax, %eax
je 0x8e84
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq %r12, %r8
movq %r13, %r9
pushq 0x10(%rsp)
pushq %r14
callq 0x8b65
addq $0x10, %rsp
decl %ebx
jne 0x8e33
movq 0x58(%rsp), %rdi
callq 0x68a0
leaq 0x48(%rsp), %rdi
leaq 0x24(%rsp), %rsi
callq 0x275e3
jmp 0x8f1e
movq 0x50(%rsp), %rax
movq 0x28(%rax), %r14
testq %r14, %r14
movq 0x30(%rsp), %r15
movq 0x28(%rsp), %rbx
movl %r13d, %ebp
movq 0x10(%rsp), %r13
je 0x8f0f
movq %rcx, %r12
movq 0x50(%rsp), %rdi
movq 0x8(%r14), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3e899
movq %rax, 0x40(%rsp)
movq %rax, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %rbx, %rcx
movq %r12, %r8
leaq 0x18(%rsp), %r9
pushq %r13
leaq 0x14(%rsp), %rax
pushq %rax
callq 0x8b65
addq $0x10, %rsp
leaq 0x40(%rsp), %rdi
callq 0x24ab1
movq (%r14), %r14
testq %r14, %r14
jne 0x8ec2
leaq 0x50(%rsp), %rdi
callq 0x3df96
movl 0x38(%rsp), %r15d
testl %r15d, %r15d
je 0x8f3a
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
leaq 0x846b3(%rip), %rdi     # 0x8d5e6
xorl %eax, %eax
callq 0x6070
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq