// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::resolveHandles(ParserContext&) const
void Sleigh::resolveHandles (ParserContext& pos) const

{ // Resolve handles (assuming Constructors already resolved)
    TripleSymbol* triple;
    Constructor* ct;
    int4 oper, numoper;

    ParserWalker walker (&pos);
    walker.baseState ();
    while (walker.isState ()) {
        ct = walker.getConstructor ();
        oper = walker.getOperand ();
        numoper = ct->getNumOperands ();
        while (oper < numoper) {
            OperandSymbol* sym = ct->getOperand (oper);
            walker.pushOperand (oper); // Descend into node
            triple = sym->getDefiningSymbol ();
            if (triple != (TripleSymbol*)0) {
                if (triple->getType () == SleighSymbol::subtable_symbol)
                    break;
                else // Some other kind of symbol as an operand
                    triple->getFixedHandle (walker.getParentHandle (), walker);
            } else { // Must be an expression
                PatternExpression* patexp = sym->getDefiningExpression ();
                intb res = patexp->getValue (walker);
                FixedHandle& hand (walker.getParentHandle ());
                // Result of expression is a constant
                hand.space = pos.getConstSpace ();
                hand.offset_space = (AddrSpace*)0;
                hand.offset_offset = (uintb)res;
                hand.size = 0;  // This size should not get used
            }
            walker.popOperand ();
            oper += 1;
        }
        if (oper >= numoper) { // Finished processing constructor
            ConstructTpl* templ = ct->getTempl ();
            if (templ != (ConstructTpl*)0) {
                HandleTpl* res = templ->getResult ();
                // Pop up handle to containing operand
                if (res != (HandleTpl*)0) 
                    res->fix (walker.getParentHandle (), walker);
                // If we need an indicator that the constructor exports nothing try
                // else
                //   walker.getParentHandle().setInvalid();
            }
            walker.popOperand ();
        }
    }
    pos.setParserState (ParserContext::pcode);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rbx
movq %rsi, 0x8(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x10(%rsp)
movq 0x98(%rsi), %rax
movq %rax, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
testq %rax, %rax
je 0x587be
movq (%rax), %r12
movslq 0x20(%rsp), %rax
movl 0x24(%rsp,%rax,4), %r14d
movq 0x20(%r12), %r13
subq 0x18(%r12), %r13
shrq $0x3, %r13
cmpl %r13d, %r14d
jge 0x58774
movslq %r14d, %rcx
movq 0x18(%r12), %rax
movq (%rax,%rcx,8), %rax
leal 0x1(%r14), %ebp
movslq 0x20(%rsp), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x20(%rsp)
movl %ebp, 0x24(%rsp,%rdx,4)
movq 0x18(%rsp), %rdx
movq 0x40(%rdx), %rdx
movq (%rdx,%rcx,8), %rcx
movq %rcx, 0x18(%rsp)
movslq 0x20(%rsp), %rcx
movl $0x0, 0x24(%rsp,%rcx,4)
movq 0x48(%rax), %r15
testq %r15, %r15
je 0x5870b
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
cmpl $0xb, %eax
jne 0x5873c
xorl %eax, %eax
movl %r14d, %ebp
jmp 0x5876a
movq 0x50(%rax), %rdi
movq (%rdi), %rax
leaq 0x8(%rsp), %rsi
callq *0x10(%rax)
movq 0x18(%rsp), %rcx
movq 0x8(%rbx), %rdx
movq %rdx, 0x8(%rcx)
movq $0x0, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movl $0x0, 0x10(%rcx)
jmp 0x58753
movq 0x18(%rsp), %rsi
addq $0x8, %rsi
movq (%r15), %rax
movq %r15, %rdi
leaq 0x8(%rsp), %rdx
callq *0x40(%rax)
movq 0x18(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0x18(%rsp)
decl 0x20(%rsp)
movb $0x1, %al
movl %ebp, %r14d
testb %al, %al
jne 0x586a5
jmp 0x58777
movl %r14d, %ebp
cmpl %r13d, %ebp
jl 0x587b4
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x587a2
movq 0x20(%rax), %rdi
testq %rdi, %rdi
je 0x587a2
movq 0x18(%rsp), %rsi
addq $0x8, %rsi
leaq 0x8(%rsp), %rdx
callq 0x409f0
movq 0x18(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0x18(%rsp)
decl 0x20(%rsp)
movq 0x18(%rsp), %rax
jmp 0x58681
movl $0x2, (%rbx)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq