// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/maf.c
// Function: mafNextWithPos
struct mafAli *mafNextWithPos(struct mafFile *mf, off_t *retOffset)
/* Return next alignment in FILE or NULL if at end.  If retOffset is
 * nonNULL, return start offset of record in file. */
{
struct lineFile *lf = mf->lf;
struct mafAli *ali;
char *line, *word;

/* Loop until get an alignment paragraph or reach end of file. */
for (;;)
    {
    /* Get alignment header line.  If it's not there assume end of file. */
    if (!nextLine(lf, &line))
	{
	lineFileClose(&mf->lf);
	return NULL;
	}

    /* Parse alignment header line. */
    word = nextWord(&line);
    if (word == NULL)
	continue;	/* Ignore blank lines. */
	
    if (sameString(word, "a"))
	{
	if (retOffset != NULL)
	    *retOffset = lineFileTell(mf->lf);
	AllocVar(ali);
	while ((word = nextWord(&line)) != NULL)
	    {
	    /* Parse name=val. */
	    char *name = word;
	    char *val = strchr(word, '=');
	    if (val == NULL)
	       errAbort("Missing = after %s line 1 of %s", name, lf->fileName);
	    *val++ = 0;

	    if (sameString(name, "score"))
		ali->score = atof(val);
	    }

	/* Parse alignment components until blank line. */
	for (;;)
	    {
	    if (!nextLine(lf, &line))
		break;
	    word = nextWord(&line);
	    if (word == NULL)
		break;
	    if (sameString(word, "s") || sameString(word, "e"))
		{
		struct mafComp *comp;
		int wordCount;
		char *row[7];
		int textSize;

		/* Chop line up by white space.  This involves a few +-1's because
		 * have already chopped out first word. */
		row[0] = word;
		wordCount = chopByWhite(line, row+1, ArraySize(row)-1) + 1; /* +-1 because of "s" */
		lineFileExpectWords(lf, ArraySize(row), wordCount);
		AllocVar(comp);

		/* Convert ascii text representation to mafComp structure. */
		comp->src = cloneString(row[1]);
		comp->srcSize = lineFileNeedNum(lf, row, 5);
		comp->strand = row[4][0];
		comp->start = lineFileNeedNum(lf, row, 2);

		if (sameString(word, "e"))
		    {
		    comp->size = 0;
		    comp->rightLen = comp->leftLen = lineFileNeedNum(lf, row, 3);
		    comp->rightStatus = comp->leftStatus = *row[6];
		    }
		else
		    {
		    comp->size = lineFileNeedNum(lf, row, 3);
		    comp->text = cloneString(row[6]);
		    textSize = strlen(comp->text);

		    /* Fill in ali->text size. */
		    if (ali->textSize == 0)
			ali->textSize = textSize;
		    else if (ali->textSize != textSize)
			errAbort("Text size inconsistent (%d vs %d) line %d of %s",
			    textSize, ali->textSize, lf->lineIx, lf->fileName);
		    }

		/* Do some sanity checking. */
		if (comp->srcSize < 0 || comp->size < 0)
		     errAbort("Got a negative size line %d of %s", lf->lineIx, lf->fileName);
		if (comp->start < 0 || comp->start + comp->size > comp->srcSize)
		     errAbort("Coordinates out of range line %d of %s", lf->lineIx, lf->fileName);
		  
		/* Add component to head of list. */
		slAddHead(&ali->components, comp);
		}
	    if (sameString(word, "i"))
		{
		struct mafComp *comp;
		int wordCount;
		char *row[6];

		/* Chop line up by white space.  This involves a few +-1's because
		 * have already chopped out first word. */
		row[0] = word;
		wordCount = chopByWhite(line, row+1, ArraySize(row)-1) + 1; /* +-1 because of "s" */
		lineFileExpectWords(lf, ArraySize(row), wordCount);
		if (!sameString(row[1],ali->components->src))
		    errAbort("i line src mismatch: i is %s :: s is %s\n", row[1], ali->components->src);

		comp = ali->components;
		comp->leftStatus = *row[2];
		comp->leftLen = atoi(row[3]);
		comp->rightStatus = *row[4];
		comp->rightLen = atoi(row[5]);
		}
            if (sameString(word, "q"))
		{
		struct mafComp *comp;
		int wordCount;
		char *row[3];

		/* Chop line up by white space.  This involves a few +-1's because
		 * have already chopped out first word. */
		row[0] = word;
		wordCount = chopByWhite(line, row+1, ArraySize(row)-1) + 1; /* +-1 because of "s" */
		lineFileExpectWords(lf, ArraySize(row), wordCount);
		if (!sameString(row[1],ali->components->src))
		    errAbort("q line src mismatch: q is %s :: s is %s\n", row[1], ali->components->src);

			comp = ali->components;
			comp->quality = cloneString(row[2]);
		}
	    if (sameString(word, "r"))
                mafRegDefParse(mf, ali, line);
	    }
	slReverse(&ali->components);
	return ali;
	}
    else  /* Skip over paragraph we don't understand. */
	{
	for (;;)
	    {
	    if (!nextLine(lf, &line))
		return NULL;
            if (nextWord(&line) == NULL)
		break;
	    }
	}
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3eb20
cmpl $0x0, %eax
jne 0x3e55b
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
callq 0x3c110
movq $0x0, -0x8(%rbp)
jmp 0x3eb07
leaq -0x30(%rbp), %rdi
callq 0x2f230
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x3e571
jmp 0x3e52f
movq -0x38(%rbp), %rdi
leaq 0x9be36(%rip), %rsi     # 0xda3b2
callq 0x6a40
cmpl $0x0, %eax
jne 0x3eacf
cmpq $0x0, -0x18(%rbp)
je 0x3e5b3
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq 0x2c(%rax), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x28, %edi
callq 0x40c50
movq %rax, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2f230
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x3e64d
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movl $0x3d, %esi
callq 0x6260
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x3e60f
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x9cfcb(%rip), %rdi     # 0xdb5d3
movb $0x0, %al
callq 0x35d40
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x48(%rbp)
movb $0x0, (%rax)
movq -0x40(%rbp), %rdi
leaq 0x9b394(%rip), %rsi     # 0xd99c0
callq 0x6a40
cmpl $0x0, %eax
jne 0x3e648
movq -0x48(%rbp), %rdi
callq 0x6900
movq -0x28(%rbp), %rax
movsd %xmm0, 0x8(%rax)
jmp 0x3e5c1
jmp 0x3e64f
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3eb20
cmpl $0x0, %eax
jne 0x3e666
jmp 0x3eab8
leaq -0x30(%rbp), %rdi
callq 0x2f230
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x3e67f
jmp 0x3eab8
movq -0x38(%rbp), %rdi
leaq 0x9b988(%rip), %rsi     # 0xda012
callq 0x6a40
cmpl $0x0, %eax
je 0x3e6ad
movq -0x38(%rbp), %rdi
leaq 0x9b246(%rip), %rsi     # 0xd98e5
callq 0x6a40
cmpl $0x0, %eax
jne 0x3e8cf
movq -0x38(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x90(%rbp), %rsi
addq $0x8, %rsi
movl $0x6, %edx
callq 0x2e900
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x20(%rbp), %rdi
movl -0x54(%rbp), %edx
movl $0x7, %esi
callq 0x3c2f0
movl $0x40, %edi
callq 0x40c50
movq %rax, -0x50(%rbp)
movq -0x88(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x5, %edx
callq 0x3cc60
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x70(%rbp), %rax
movb (%rax), %cl
movq -0x50(%rbp), %rax
movb %cl, 0x14(%rax)
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x2, %edx
callq 0x3cc60
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rdi
leaq 0x9b184(%rip), %rsi     # 0xd98e5
callq 0x6a40
cmpl $0x0, %eax
jne 0x3e7b4
movq -0x50(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x3, %edx
callq 0x3cc60
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x50(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x60(%rbp), %rax
movb (%rax), %cl
movq -0x50(%rbp), %rax
movb %cl, 0x30(%rax)
movq -0x50(%rbp), %rax
movb %cl, 0x38(%rax)
jmp 0x3e84f
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x3, %edx
callq 0x3cc60
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x60(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x62c0
movl %eax, -0x94(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x3e812
movl -0x94(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
jmp 0x3e84d
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x94(%rbp), %eax
je 0x3e84b
movl -0x94(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x18(%rax), %edx
movq -0x20(%rbp), %rax
movl 0x28(%rax), %ecx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
leaq 0x9cdaf(%rip), %rdi     # 0xdb5f3
movb $0x0, %al
callq 0x35d40
jmp 0x3e84d
jmp 0x3e84f
movq -0x50(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jl 0x3e863
movq -0x50(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jge 0x3e880
movq -0x20(%rbp), %rax
movl 0x28(%rax), %esi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x9cdaa(%rip), %rdi     # 0xdb623
movb $0x0, %al
callq 0x35d40
movq -0x50(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jl 0x3e8a1
movq -0x50(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x50(%rbp), %rcx
addl 0x1c(%rcx), %eax
movq -0x50(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jle 0x3e8be
movq -0x20(%rbp), %rax
movl 0x28(%rax), %esi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x9cd8e(%rip), %rdi     # 0xdb645
movb $0x0, %al
callq 0x35d40
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
movq -0x50(%rbp), %rsi
callq 0x3eb80
movq -0x38(%rbp), %rdi
leaq 0xa3d15(%rip), %rsi     # 0xe25ef
callq 0x6a40
cmpl $0x0, %eax
jne 0x3e9cc
movq -0x38(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x30(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
addq $0x8, %rsi
movl $0x5, %edx
callq 0x2e900
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
movq -0x20(%rbp), %rdi
movl -0xa4(%rbp), %edx
movl $0x6, %esi
callq 0x3c2f0
movq -0xd8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x6a40
cmpl $0x0, %eax
je 0x3e967
movq -0xd8(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x9cd0c(%rip), %rdi     # 0xdb66c
movb $0x0, %al
callq 0x35d40
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0xd0(%rbp), %rax
movb (%rax), %cl
movq -0xa0(%rbp), %rax
movb %cl, 0x30(%rax)
movq -0xc8(%rbp), %rdi
callq 0x6bd0
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0xc0(%rbp), %rax
movb (%rax), %cl
movq -0xa0(%rbp), %rax
movb %cl, 0x38(%rax)
movq -0xb8(%rbp), %rdi
callq 0x6bd0
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x38(%rbp), %rdi
leaq 0x99a02(%rip), %rsi     # 0xd83d9
callq 0x6a40
cmpl $0x0, %eax
jne 0x3ea8d
movq -0x38(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x110(%rbp), %rsi
addq $0x8, %rsi
movl $0x2, %edx
callq 0x2e900
addl $0x1, %eax
movl %eax, -0xec(%rbp)
movq -0x20(%rbp), %rdi
movl -0xec(%rbp), %edx
movl $0x3, %esi
callq 0x3c2f0
movq -0x108(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x6a40
cmpl $0x0, %eax
je 0x3ea64
movq -0x108(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x9cc38(%rip), %rdi     # 0xdb695
movb $0x0, %al
callq 0x35d40
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x100(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0xe8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rdi
leaq 0xa12fe(%rip), %rsi     # 0xdfd96
callq 0x6a40
cmpl $0x0, %eax
jne 0x3eab3
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x3ebc0
jmp 0x3e64f
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
callq 0x2aad0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3eb07
jmp 0x3ead1
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3eb20
cmpl $0x0, %eax
jne 0x3eaed
movq $0x0, -0x8(%rbp)
jmp 0x3eb07
leaq -0x30(%rbp), %rdi
callq 0x2f230
cmpq $0x0, %rax
jne 0x3eafe
jmp 0x3eb00
jmp 0x3ead1
jmp 0x3eb02
jmp 0x3e52f
movq -0x8(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)