// File: /workspace/github_cpp_makefile_star2_O1/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 $0x298, %rsp            # imm = 0x298
movq %rdx, %r14
movq %rsi, %rbp
movq %rdi, %r12
movslq 0x128(%rdi), %rcx
cmpq $0x1, %rcx
je 0x58a5f
movq 0x8(%r14), %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x58bf0
movq %r12, %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x3fde0
movq %rax, %r13
movq %rax, %rdi
callq 0x41260
movq 0x98(%r13), %rax
movl 0x60(%rax), %ebx
cmpl $0x0, 0xa4(%r13)
jle 0x58b45
movq %rbp, 0x8(%rsp)
movq %r14, 0x10(%rsp)
xorl %r14d, %r14d
leaq 0x38(%rsp), %rbp
movq 0x50(%r13), %rcx
movslq %ebx, %rax
addq 0x58(%r13), %rax
movq 0x28(%rcx), %rsi
cmpq %rax, %rsi
jae 0x58acd
incq %rsi
cqto
idivq %rsi
movq %rdx, %rax
sarq $0x3f, %rax
andq %rsi, %rax
addq %rdx, %rax
movq %rcx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
movl $0x2, %edx
callq 0x3fde0
movq %rax, %r15
movq %rax, %rdi
callq 0x41260
movq 0x98(%r15), %rax
movl 0x60(%rax), %eax
addl %eax, %ebx
addl %eax, %r14d
cmpl 0xa4(%r13), %r14d
jl 0x58aa4
movq 0x50(%r13), %rcx
movslq %ebx, %rax
addq 0x58(%r13), %rax
movq 0x28(%rcx), %rsi
cmpq %rax, %rsi
jae 0x58b33
incq %rsi
cqto
idivq %rsi
movq %rdx, %rax
sarq $0x3f, %rax
andq %rsi, %rax
addq %rdx, %rax
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %rbp
movq %rcx, 0x60(%r13)
movq %rax, 0x68(%r13)
leaq 0x1b0(%rsp), %r15
movq %r13, (%r15)
xorl %eax, %eax
movq %rax, 0x8(%r15)
movq 0x98(%r13), %rcx
movq %rcx, 0x10(%r15)
movq %rax, 0x18(%r15)
leaq 0x200(%r12), %r13
movq %r13, %rdi
callq 0x3f0d0
movq 0x1f8(%r12), %rdx
movq 0x98(%r12), %r8
movq 0xc8(%r12), %r9
movl 0x1d4(%r12), %eax
movl %eax, (%rsp)
leaq 0x250(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rcx
callq 0x3f690
movq 0x10(%r15), %rax
movq (%rax), %rax
movq 0x60(%rax), %rsi
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3f5a0
movq %r13, %rdi
callq 0x42240
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x40720
movl %ebx, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x41110
leaq 0x278f1(%rip), %rsi     # 0x804f5
movl $0x21, %edx
movq %rbx, %rdi
callq 0x40b80
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x40700
movl $0x28, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x40(%rsp), %rsi
leaq 0x1b0(%rsp), %rdi
callq 0x418b0
movb $0x1, %bpl
leaq 0x1b0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f890
movl $0x0, 0x20(%rbx)
xorl %ebp, %ebp
movq 0x4a2c8(%rip), %rsi     # 0xa2f28
movq 0x49fd1(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
jmp 0x58e12
movq %rax, %r14
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x58ca0
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x58ca0
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x58cb2
movq %rbx, %rdi
callq 0x40080
jmp 0x58cb2
movq %rax, %r14
movq 0x4a0c7(%rip), %rsi     # 0xa2d80
leaq 0x38(%rsp), %rdi
callq 0x3fc30
leaq 0xa8(%rsp), %rdi
callq 0x3f730
jmp 0x58e4e
movq %rax, %r14
cmpl $0x1, %edx
jne 0x58e4e
movq %r14, %rdi
callq 0x3f910
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x41110
leaq 0x2781a(%rip), %rsi     # 0x80517
leaq 0x38(%rsp), %rdi
movl $0x27, %edx
callq 0x40b80
movq 0x260(%rsp), %r15
movq (%r15), %rax
movq 0x8(%r15), %rdi
movq 0x98(%rax), %rcx
movq %rcx, 0x10(%r15)
movq $0x0, 0x18(%r15)
movq (%rcx), %r12
testq %rdi, %rdi
cmoveq %rax, %rdi
addq $0x50, %rdi
leaq 0x38(%rsp), %rsi
callq 0x407e0
leaq 0x277c7(%rip), %rsi     # 0x80514
leaq 0x38(%rsp), %rdi
movl $0x2, %edx
callq 0x40b80
leaq 0x38(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x3fbf0
leaq 0x2896d(%rip), %rsi     # 0x816e0
leaq 0x38(%rsp), %rdi
movl $0x2, %edx
callq 0x40b80
leaq 0x38(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x40e40
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x418b0
leaq 0x18(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x40da0
movq (%r15), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x58dcb
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x40870
movl %ebx, 0x20(%r14)
movl $0x28, %edi
callq 0x3fb00
movq %rax, %rbx
addq $0x10, %rax
movq %rax, (%rbx)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3f8e0
movl 0x20(%r14), %eax
movl %eax, 0x20(%rbx)
movq 0x4a125(%rip), %rsi     # 0xa2f28
movq 0x49e2e(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
movq %rax, %r14
movq %rbx, %rdi
callq 0x40080
jmp 0x58e26
jmp 0x58e23
jmp 0x58e23
movq %rax, %r14
movq 0x49f53(%rip), %rsi     # 0xa2d80
leaq 0x38(%rsp), %rdi
callq 0x3fc30
leaq 0xa8(%rsp), %rdi
callq 0x3f730
jmp 0x58e49
movq %rax, %r14
callq 0x41a90
movq %r14, %rdi
callq 0x41f00
movq %rax, %rdi
callq 0x477f0