// File: /workspace/github_cpp_makefile_star2_O3/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 0x584db
leaq 0x8(%rsp), %r14
movq (%rax), %r12
movslq 0x20(%rsp), %rcx
movl 0x24(%rsp,%rcx,4), %r13d
movq 0x20(%r12), %rbp
subq 0x18(%r12), %rbp
shrq $0x3, %rbp
cmpl %ebp, %r13d
jge 0x58490
movslq %r13d, %r13
movq 0x18(%r12), %rdx
movq (%rdx,%r13,8), %rdx
leal 0x1(%rcx), %esi
movl %esi, 0x20(%rsp)
movslq %ecx, %rcx
leal 0x1(%r13), %esi
movl %esi, 0x24(%rsp,%rcx,4)
movq 0x40(%rax), %rax
movq (%rax,%r13,8), %rax
movq %rax, 0x18(%rsp)
movslq 0x20(%rsp), %rax
movl $0x0, 0x24(%rsp,%rax,4)
movq 0x48(%rdx), %r15
testq %r15, %r15
je 0x58442
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
cmpl $0xb, %eax
je 0x58490
movq 0x18(%rsp), %rsi
addq $0x8, %rsi
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rdx
callq *0x40(%rax)
movq 0x18(%rsp), %rcx
jmp 0x5846f
movq 0x50(%rdx), %rdi
movq (%rdi), %rax
movq %r14, %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)
movq 0x58(%rcx), %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %ecx
decl %ecx
movl %ecx, 0x20(%rsp)
incq %r13
cmpl %r13d, %ebp
jne 0x583da
jmp 0x5849c
cmpl %ebp, %r13d
jge 0x5849c
movq 0x18(%rsp), %rax
jmp 0x584d2
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x584c0
movq 0x20(%rax), %rdi
testq %rdi, %rdi
je 0x584c0
movq 0x18(%rsp), %rsi
addq $0x8, %rsi
movq %r14, %rdx
callq 0x40a00
movq 0x18(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0x18(%rsp)
decl 0x20(%rsp)
testq %rax, %rax
jne 0x583b3
movl $0x2, (%rbx)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop