// File: /workspace/github_cpp_makefile_star2_O2/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 $0xb8, %rsp
leaq 0x18(%rsp), %r14
movq %rsi, (%r14)
andq $0x0, 0x8(%r14)
movq %rsi, 0x8(%rsp)
movq 0x98(%rsi), %rax
movq %rax, 0x10(%r14)
andq $0x0, 0x18(%r14)
testq %rax, %rax
je 0x645b0
movq (%rax), %r13
movslq 0x30(%rsp), %rax
movslq 0x34(%rsp,%rax,4), %r15
movq 0x20(%r13), %rax
subq 0x18(%r13), %rax
shrq $0x3, %rax
movq %rax, 0x10(%rsp)
movslq %eax, %rbx
cmpq %rbx, %r15
jge 0x64576
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rbp
movq %r14, %rdi
movl %r15d, %esi
callq 0x4d570
movq 0x48(%rbp), %r12
testq %r12, %r12
je 0x64524
movq (%r12), %rax
movq %r12, %rdi
callq *0x10(%rax)
cmpl $0xb, %eax
je 0x64565
movq 0x28(%rsp), %rsi
addq $0x8, %rsi
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rdx
callq *0x40(%rax)
movq 0x28(%rsp), %rcx
jmp 0x64550
movq 0x50(%rbp), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rdx
movq %rdx, 0x8(%rcx)
andq $0x0, 0x18(%rcx)
movq %rax, 0x20(%rcx)
andl $0x0, 0x10(%rcx)
movq 0x58(%rcx), %rax
movq %rax, 0x28(%rsp)
decl 0x30(%rsp)
incq %r15
jmp 0x644d3
cmpl 0x10(%rsp), %r15d
jge 0x64576
movq 0x28(%rsp), %rax
jmp 0x644a9
movq 0x60(%r13), %rax
testq %rax, %rax
je 0x64599
movq 0x20(%rax), %rdi
testq %rdi, %rdi
je 0x64599
movq 0x28(%rsp), %rsi
addq $0x8, %rsi
movq %r14, %rdx
callq 0x4f8b0
movq 0x28(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0x28(%rsp)
decl 0x30(%rsp)
jmp 0x644a9
movq 0x8(%rsp), %rax
movl $0x2, (%rax)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop