// File: /workspace/github_cpp_makefile_star2_O2/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: Sleigh::oneInstruction(PcodeEmit&, Address const&) const
int4 Sleigh::oneInstruction (PcodeEmit& emit, const Address& baseaddr) const

{
    int4 fallOffset;
    if (alignment != 1) {
        if ((baseaddr.getOffset () % alignment) != 0) {
            ostringstream s;
            s << "Instruction address not aligned: " << baseaddr;
            throw UnimplError (s.str (), 0);
        }
    }

    ParserContext* pos = obtainContext (baseaddr, ParserContext::pcode);
    pos->applyCommits ();
    fallOffset = pos->getLength ();

    if (pos->getDelaySlot () > 0) {
        int4 bytecount = 0;
        do {
            // Do not pass pos->getNaddr() to obtainContext, as pos may have
            // been previously cached and had naddr adjusted
            ParserContext* delaypos = obtainContext (
                pos->getAddr () + fallOffset, ParserContext::pcode);
            delaypos->applyCommits ();
            int4 len = delaypos->getLength ();
            fallOffset += len;
            bytecount += len;
        } while (bytecount < pos->getDelaySlot ());
        pos->setNaddr (pos->getAddr () + fallOffset);
    }
    ParserWalker walker (pos);
    walker.baseState ();
    pcode_cache.clear ();
    SleighBuilder builder (&walker, discache, &pcode_cache, getConstantSpace (),
                           getUniqueSpace (), unique_allocatemask);

    try {
        builder.build (walker.getConstructor ()->getTempl (), -1);
        pcode_cache.resolveRelatives ();
        pcode_cache.emit (baseaddr, &emit);
    } catch (UnimplError& err) {
        ostringstream s;
        s << "Instruction not implemented in pcode:\n ";
        ParserWalker* cur = builder.getCurrentWalker ();
        cur->baseState ();
        Constructor* ct = cur->getConstructor ();
        cur->getAddr ().printRaw (s);
        s << ": ";
        ct->printMnemonic (s, *cur);
        s << "  ";
        ct->printBody (s, *cur);
        err.explain = s.str ();
        err.instruction_length = fallOffset;
        throw err;
    }
    return fallOffset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r15
movslq 0x128(%rdi), %rcx
cmpq $0x1, %rcx
je 0x647d6
movq 0x8(%r12), %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x64939
pushq $0x2
popq %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x4e680
movq %rax, %r13
movq %rax, %rdi
callq 0x506a0
movq 0x98(%r13), %rax
movl 0x60(%rax), %ebx
cmpl $0x0, 0xa4(%r13)
jle 0x6489c
movq %rbp, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq %r13, %rbp
addq $0x50, %rbp
xorl %r12d, %r12d
movq %r15, 0x10(%rsp)
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq 0x4f560
movq 0x10(%rsp), %rdi
movq %r15, %rsi
pushq $0x2
popq %rdx
callq 0x4e680
movq %rax, %r14
movq %rax, %rdi
callq 0x506a0
movq 0x98(%r14), %rax
movl 0x60(%rax), %eax
addl %eax, %ebx
addl %eax, %r12d
cmpl 0xa4(%r13), %r12d
jl 0x64825
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq 0x4f560
movq (%r14), %rax
movq %rax, 0x60(%r13)
movq 0x8(%r14), %rax
movq %rax, 0x68(%r13)
movq 0x98(%r13), %rax
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %rbp
movq 0x10(%rsp), %r15
leaq 0x208(%rsp), %r14
movq %r13, (%r14)
andq $0x0, 0x8(%r14)
movq %rax, 0x10(%r14)
andq $0x0, 0x18(%r14)
leaq 0x200(%r15), %r13
movq %r13, %rdi
callq 0x4d100
movq 0x1f8(%r15), %rdx
movq 0x98(%r15), %r8
movq 0xc8(%r15), %r9
movl 0x1d4(%r15), %eax
movl %eax, (%rsp)
leaq 0x1c0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x4dae0
movq 0x10(%r14), %rax
movq (%rax), %rax
movq 0x60(%rax), %rsi
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x4d920
movq %r13, %rdi
callq 0x51d60
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x4f490
movl %ebx, %eax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x504a0
leaq 0x22b88(%rip), %rsi     # 0x874d5
movq %rbx, %rdi
callq 0x4f5b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x4f450
pushq $0x28
popq %rdi
callq 0x4e180
movq %rax, %rbx
leaq 0x50(%rsp), %rsi
leaq 0x208(%rsp), %rdi
callq 0x50fb0
movb $0x1, %bpl
leaq 0x208(%rsp), %rsi
movq %rbx, %rdi
callq 0x4ddf0
andl $0x0, 0x20(%rbx)
xorl %ebp, %ebp
movq 0x4a583(%rip), %rsi     # 0xaef20
movq 0x4a294(%rip), %rdx     # 0xaec38
movq %rbx, %rdi
callq 0x51630
jmp 0x64ae9
movq %rax, %r14
leaq 0x208(%rsp), %rdi
callq 0x4e020
testb %bpl, %bpl
jne 0x649cb
jmp 0x649d8
movq %rax, %r14
movq %rbx, %rdi
callq 0x4ea60
jmp 0x649d8
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x4d7c0
jmp 0x64b11
movq %rax, %r14
cmpl $0x1, %edx
jne 0x64b11
movq %r14, %rdi
callq 0x4de70
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x504a0
leaq 0x22ae8(%rip), %rsi     # 0x874f7
leaq 0x48(%rsp), %rdi
callq 0x4f5b0
movq 0x1d0(%rsp), %r15
movq (%r15), %rax
movq 0x8(%r15), %rdi
movq 0x98(%rax), %rcx
movq %rcx, 0x10(%r15)
andq $0x0, 0x18(%r15)
movq (%rcx), %r12
testq %rdi, %rdi
cmoveq %rax, %rdi
addq $0x50, %rdi
leaq 0x48(%rsp), %rsi
callq 0x4f5a0
leaq 0x22a9d(%rip), %rsi     # 0x874f4
leaq 0x48(%rsp), %rdi
callq 0x4f5b0
leaq 0x48(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x4e380
leaq 0x23c3d(%rip), %rsi     # 0x886b5
leaq 0x48(%rsp), %rdi
callq 0x4f5b0
leaq 0x48(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x4ffd0
leaq 0x50(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x50fb0
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4fef0
movq %r15, %rdi
callq 0x4e020
movl %ebx, 0x20(%r14)
pushq $0x28
popq %rdi
callq 0x4e180
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x4e8e0
movq 0x4a446(%rip), %rsi     # 0xaef20
movq 0x4a157(%rip), %rdx     # 0xaec38
movq %rbx, %rdi
callq 0x51630
movq %rax, %r14
movq %rbx, %rdi
callq 0x4ea60
jmp 0x64afd
jmp 0x64afa
jmp 0x64afa
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x4d7c0
jmp 0x64b0c
movq %rax, %r14
callq 0x51210
movq %r14, %rdi
callq 0x518c0
movq %rax, %rdi
callq 0x55fd2
nop