// File: /workspace/github_c_makefile_star2_O0/JimKent[P]linearSat/linearSat/linearSat.c
// Function: predictFromPreviousTypes
struct wordTree *predictFromPreviousTypes(struct alphaStore *store, struct dlList *past)
/* Predict next based on general pattern of monomer order. */
{
/* This routine is now a bit more complex than necessary but it still works.  It
 * these days only needs to look back 1 because of the read-based type fill-in. */
int maxToLookBack = 3;
    { /* Debugging block */
    struct dlNode *node = nodesFromTail(past, maxToLookBack);
    verbose(4, "predictFromPreviousTypes(");
    for (; !dlEnd(node); node = node->next)
        {
	struct monomer *monomer = node->val;
	verbose(4, "%s, ", monomer->word);
	}
    verbose(4, ")\n");
    }
int pastDepth;
struct dlNode *node;
for (pastDepth = 1, node = past->tail; pastDepth <= maxToLookBack; ++pastDepth)
    {
    if (dlStart(node))
	{
	verbose(3, "predictFromPreviousTypes with empty past\n");
	return NULL;
	}
    struct monomer *monomer = node->val;
    struct monomerType *prevType = hashFindVal(store->typeHash, monomer->word);
    if (prevType != NULL)
        {
	struct monomerType *curType = typeAfter(store, prevType, pastDepth);
	struct monomer *curInfo = pickRandomFromType(curType);
	struct wordTree *curTree = wordTreeFindInList(store->markovChains->children, curInfo);
	verbose(4, "predictFromPreviousType pastDepth %d, curInfo %s, curTree %p %s\n", 
	    pastDepth, curInfo->word, curTree, curTree->monomer->word);
	return curTree;
	}
    node = node->prev;
    }
verbose(3, "predictFromPreviousTypes past all unknown types\n");
return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x3, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x45f0
movq %rax, -0x28(%rbp)
movl $0x4, %edi
leaq 0x1f0f5(%rip), %rsi     # 0x23858
movb $0x0, %al
callq 0x1adf0
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x477d
jmp 0x47b1
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x4, %edi
leaq 0x1f0d5(%rip), %rsi     # 0x23872
movb $0x0, %al
callq 0x1adf0
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x476a
movl $0x4, %edi
leaq 0x1f8f2(%rip), %rsi     # 0x240af
movb $0x0, %al
callq 0x1adf0
movl $0x1, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x48c6
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x480e
movl $0x3, %edi
leaq 0x1f07d(%rip), %rsi     # 0x23877
movb $0x0, %al
callq 0x1adf0
movq $0x0, -0x8(%rbp)
jmp 0x48e1
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x10d00
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x48ac
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl -0x34(%rbp), %edx
callq 0x4660
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x4250
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x60(%rbp), %rsi
callq 0x3930
movq %rax, -0x68(%rbp)
movl -0x34(%rbp), %edx
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x68(%rbp), %r8
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %r9
movl $0x4, %edi
leaq 0x1f006(%rip), %rsi     # 0x238a1
movb $0x0, %al
callq 0x1adf0
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x48e1
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x47d7
movl $0x3, %edi
leaq 0x1f010(%rip), %rsi     # 0x238e2
movb $0x0, %al
callq 0x1adf0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)