// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/linearSat/linearSat.c
// Function: alphaStoreLoadMonomerOrder
void alphaStoreLoadMonomerOrder(struct alphaStore *store, char *readsFile, char *fileName)
/* Read in a file with one line for each monomer type, where first word is type name,
 * and rest of words are all the actually variants of that type.
 * Requires all variants already be in store.  The readsFile is passed
 * just for nicer error reporting. */
{
/* Stuff for processing file a line at a time. */
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *line, *word;
struct hash *uniq = hashNew(0);

/* Set up variables we'll put results in in store. */
store->typeList = NULL;

while (lineFileNextReal(lf, &line))
    {
    char *name = nextWord(&line);
    if (hashLookup(uniq, name) != NULL)
        errAbort("Type name '%s' repeated line %d of %s\n", name, lf->lineIx, lf->fileName);
    struct monomerType *type;
    AllocVar(type);
    type->name = cloneString(name);
    slAddHead(&store->typeList, type);
    while ((word = nextWord(&line)) != NULL)
        {
	struct monomer *monomer = hashFindVal(store->monomerHash, word);
	if (monomer == NULL)
	    errAbort("%s is in %s but not %s", word, lf->fileName, readsFile);
	struct monomerRef *ref;
	AllocVar(ref);
	ref->val = monomer;
	slAddHead(&type->list, ref);
	hashAddUnique(store->typeHash, word, type);
	}
    if (type->list == NULL)
        errAbort("Short line %d of %s.  Format should be:\ntype list-of-monomers-of-type\n",
	    lf->lineIx, lf->fileName);
    }
slReverse(&store->typeList);
if (store->typeList == NULL)
    errAbort("%s is empty", lf->fileName);
lineFileClose(&lf);
hashFree(&uniq);
verbose(3, "Added %d types containing %d words from %s\n", 
    slCount(store->typeList), store->typeHash->elCount, fileName);

/* Create type array */
store->typeCount = slCount(store->typeList);
struct monomerType **types = AllocArray(store->typeArray, store->typeCount);
struct monomerType *type;
int i;
for (i=0, type = store->typeList; i<store->typeCount; ++i, type = type->next)
    types[i] = type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %r14
movq %rdx, (%rsp)
movq %rdx, %rdi
movl $0x1, %esi
callq 0xcef9
movq %rax, %r12
movq %rax, 0x30(%rsp)
xorl %edi, %edi
movl $0x1, %esi
callq 0xc1ee
movq %rax, 0x10(%rsp)
movq %rax, 0x20(%rsp)
leaq 0x38(%r14), %r13
movq $0x0, 0x38(%r14)
leaq 0x28(%rsp), %rsi
movq %r12, %rdi
callq 0xd937
testl %eax, %eax
je 0x58da
leaq 0x28(%rsp), %r15
movq %r13, 0x8(%rsp)
movq %r15, %rdi
callq 0x7292
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xbb8c
testq %rax, %rax
je 0x5807
movl 0x28(%r12), %edx
movq 0x8(%r12), %rcx
leaq 0x13582(%rip), %rdi     # 0x18d7f
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb6c8
movl $0x18, %edi
callq 0xee10
movq %rax, %rbp
movq %rbx, %rdi
callq 0x6402
movq %rax, 0x8(%rbp)
movq (%r13), %rax
movq %rax, (%rbp)
movq %rbp, (%r13)
movq %r15, %rdi
callq 0x7292
testq %rax, %rax
je 0x58a3
movq %rax, %rbx
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0xc0b1
movq %rax, %r13
testq %rax, %rax
jne 0x586b
movq 0x8(%r12), %rdx
leaq 0x1354a(%rip), %rdi     # 0x18da6
movq %rbx, %rsi
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0xb6c8
movl $0x10, %edi
callq 0xee10
movq %r13, 0x8(%rax)
movq 0x10(%rbp), %rcx
movq %rcx, (%rax)
movq %rax, 0x10(%rbp)
movq 0x40(%r14), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0xbf58
movq %r15, %rdi
callq 0x7292
movq %rax, %rbx
testq %rax, %rax
jne 0x583c
cmpq $0x0, 0x10(%rbp)
jne 0x58c2
movl 0x28(%r12), %esi
movq 0x8(%r12), %rdx
leaq 0x13502(%rip), %rdi     # 0x18dbd
xorl %eax, %eax
callq 0xb6c8
movq %r12, %rdi
movq %r15, %rsi
callq 0xd937
testl %eax, %eax
movq 0x8(%rsp), %r13
jne 0x57cf
movq %r13, %rdi
callq 0x66bb
cmpq $0x0, (%r13)
jne 0x58fc
movq 0x8(%r12), %rsi
leaq 0x1350f(%rip), %rdi     # 0x18e04
xorl %eax, %eax
callq 0xb6c8
leaq 0x30(%rsp), %rdi
callq 0xd560
leaq 0x20(%rsp), %rdi
callq 0xc51f
movq 0x38(%r14), %rdi
callq 0x65f4
movq 0x40(%r14), %rcx
movl 0x28(%rcx), %ecx
leaq 0x134e9(%rip), %rsi     # 0x18e10
movl $0x3, %edi
movl %eax, %edx
movq (%rsp), %r8
xorl %eax, %eax
callq 0x12a31
movq 0x38(%r14), %rdi
callq 0x65f4
movl %eax, 0x48(%r14)
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0xec7f
movq %rax, 0x50(%r14)
movslq 0x48(%r14), %rcx
testq %rcx, %rcx
jle 0x5971
xorl %edx, %edx
movq (%r13), %r13
movq %r13, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x5961
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq