// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/axt.c
// Function: axtScoreSchemeFromProteinText
struct axtScoreScheme *axtScoreSchemeFromProteinText(char *text, char *fileName)
/* Parse text into a scoring scheme.  This should be in BLAST protein matrix
 * format as in blosumText above. */
{
char *line, *nextLine;
int lineIx = 0;
int realCount = 0;
char columns[24];
char *row[25];
char *txt;
int i;
static struct axtScoreScheme *ss;
static struct axtScoreScheme *tt;

if (ss != NULL)
    return ss;
if (tt == NULL)
    AllocVar(tt);

txt = cloneString(text);
for (line = txt; line != NULL; line = nextLine)
    {
    nextLine = strchr(line, '\n');
    if (nextLine != NULL)
        *nextLine++ = 0;
    ++lineIx;
    line = skipLeadingSpaces(line);
    if (line[0] == '#' || line[0] == 0)
        continue;
    ++realCount;
    if (realCount == 1)
        {
	int wordCount = chopLine(line, row);
	if (wordCount != 24)
	    errAbort("Not a good protein matrix - expecting 24 letters line %d of %s", lineIx, fileName);
	for (i=0; i<wordCount; ++i)
	    {
	    char *letter = row[i];
	    if (strlen(letter) != 1)
		errAbort("Not a good protein matrix - got word not letter line %d of %s", lineIx, fileName);
	    columns[i] = letter[0];
	    }
	}
    else
        {
	int wordCount = chopLine(line, row);
	char letter, lcLetter;
	if (wordCount != 25)
	    badProteinMatrixLine(lineIx, fileName);
	letter = row[0][0];
	if (strlen(row[0]) != 1 || isdigit(letter))
	    badProteinMatrixLine(lineIx, fileName);
	lcLetter = tolower(letter);
	for (i=1; i<wordCount; ++i)
	    {
	    char *s = row[i];
	    int val;
	    char otherLetter, lcOtherLetter;
	    if (s[0] == '-') ++s;
	    if (!isdigit(s[0]))
		badProteinMatrixLine(lineIx, fileName);
	    otherLetter = columns[i-1];
	    lcOtherLetter = tolower(otherLetter);
	    val = atoi(row[i]);
	    tt->matrix[(int)letter][(int)otherLetter] = val;
	    tt->matrix[(int)lcLetter][(int)otherLetter] = val;
	    tt->matrix[(int)letter][(int)lcOtherLetter] = val;
	    tt->matrix[(int)lcLetter][(int)lcOtherLetter] = val;
	    }
	}
    }
freeMem(txt);
if (realCount < 25)
    errAbort("Unexpected end of %s", fileName);
ss = tt;
return ss;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
cmpq $0x0, 0xe52e7(%rip)     # 0x107430
je 0x2215b
movq 0xe52de(%rip), %rax     # 0x107430
movq %rax, -0x8(%rbp)
jmp 0x22535
cmpq $0x0, 0xe52d5(%rip)     # 0x107438
jne 0x22176
movl $0x40018, %edi          # imm = 0x40018
callq 0x40c50
movq %rax, 0xe52c2(%rip)     # 0x107438
movq -0x10(%rbp), %rdi
callq 0x2a450
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x224f8
movq -0x20(%rbp), %rdi
movl $0xa, %esi
callq 0x6260
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x221c7
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x0, (%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2ca80
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x221f5
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x221fa
jmp 0x224eb
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0x222c5
movq -0x20(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movl $0x19, %edx
callq 0x2e900
movl %eax, -0x130(%rbp)
cmpl $0x18, -0x130(%rbp)
je 0x22246
movl -0x2c(%rbp), %esi
movq -0x18(%rbp), %rdx
leaq 0xb652a(%rip), %rdi     # 0xd8769
movb $0x0, %al
callq 0x35d40
movl $0x0, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
cmpl -0x130(%rbp), %eax
jge 0x222c0
movslq -0x12c(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rdi
callq 0x62c0
cmpq $0x1, %rax
je 0x2229b
movl -0x2c(%rbp), %esi
movq -0x18(%rbp), %rdx
leaq 0xb6514(%rip), %rdi     # 0xd87a8
movb $0x0, %al
callq 0x35d40
movq -0x138(%rbp), %rax
movb (%rax), %cl
movslq -0x12c(%rbp), %rax
movb %cl, -0x50(%rbp,%rax)
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x22250
jmp 0x224e9
movq -0x20(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movl $0x19, %edx
callq 0x2e900
movl %eax, -0x13c(%rbp)
cmpl $0x19, -0x13c(%rbp)
je 0x222f5
movl -0x2c(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x22550
movq -0x120(%rbp), %rax
movb (%rax), %al
movb %al, -0x13d(%rbp)
movq -0x120(%rbp), %rdi
callq 0x62c0
cmpq $0x1, %rax
jne 0x22336
callq 0x6780
movq (%rax), %rax
movsbl -0x13d(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x22342
movl -0x2c(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x22550
movsbl -0x13d(%rbp), %edi
callq 0x6ab0
movb %al, -0x13e(%rbp)
movl $0x1, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
cmpl -0x13c(%rbp), %eax
jge 0x224e7
movslq -0x12c(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x223a7
movq -0x148(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x148(%rbp)
callq 0x6780
movq (%rax), %rax
movq -0x148(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x223d6
movl -0x2c(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x22550
movl -0x12c(%rbp), %eax
subl $0x1, %eax
cltq
movb -0x50(%rbp,%rax), %al
movb %al, -0x14d(%rbp)
movsbl -0x14d(%rbp), %edi
callq 0x6ab0
movb %al, -0x14e(%rbp)
movslq -0x12c(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rdi
callq 0x6bd0
movl %eax, -0x14c(%rbp)
movl -0x14c(%rbp), %edx
movq 0xe5014(%rip), %rax     # 0x107438
addq $0x8, %rax
movsbl -0x13d(%rbp), %ecx
movslq %ecx, %rcx
shlq $0xa, %rcx
addq %rcx, %rax
movsbl -0x14d(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14c(%rbp), %edx
movq 0xe4fe5(%rip), %rax     # 0x107438
addq $0x8, %rax
movsbl -0x13e(%rbp), %ecx
movslq %ecx, %rcx
shlq $0xa, %rcx
addq %rcx, %rax
movsbl -0x14d(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14c(%rbp), %edx
movq 0xe4fb6(%rip), %rax     # 0x107438
addq $0x8, %rax
movsbl -0x13d(%rbp), %ecx
movslq %ecx, %rcx
shlq $0xa, %rcx
addq %rcx, %rax
movsbl -0x14e(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14c(%rbp), %edx
movq 0xe4f87(%rip), %rax     # 0x107438
addq $0x8, %rax
movsbl -0x13e(%rbp), %ecx
movslq %ecx, %rcx
shlq $0xa, %rcx
addq %rcx, %rax
movsbl -0x14e(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x2235e
jmp 0x224e9
jmp 0x224eb
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x22191
movq -0x128(%rbp), %rdi
callq 0x40d40
cmpl $0x19, -0x30(%rbp)
jge 0x2251c
movq -0x18(%rbp), %rsi
leaq 0xb62d1(%rip), %rdi     # 0xd87e6
movb $0x0, %al
callq 0x35d40
movq 0xe4f15(%rip), %rax     # 0x107438
movq %rax, 0xe4f06(%rip)     # 0x107430
movq 0xe4eff(%rip), %rax     # 0x107430
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)