// File: /workspace/github_cpp_makefile_star2_O3/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 0x5877d
movq 0x8(%r14), %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x5890e
movq %r12, %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x3fde0
movq %rax, %r13
movq %rax, %rdi
callq 0x41270
movq 0x98(%r13), %rax
movl 0x60(%rax), %ebx
cmpl $0x0, 0xa4(%r13)
jle 0x5886a
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 0x587eb
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 0x41270
movq 0x98(%r15), %rax
movl 0x60(%rax), %eax
addl %eax, %ebx
addl %eax, %r14d
cmpl 0xa4(%r13), %r14d
jl 0x587c2
movq 0x50(%r13), %rcx
movslq %ebx, %rax
addq 0x58(%r13), %rax
movq 0x28(%rcx), %rsi
cmpq %rax, %rsi
jae 0x58851
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)
movq 0x98(%r13), %rax
leaq 0x1b0(%rsp), %r15
movq %r13, (%r15)
xorl %ecx, %ecx
movq %rcx, 0x8(%r15)
movq %rax, 0x10(%r15)
movq %rcx, 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 0x42250
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x40730
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 0x41120
leaq 0x27bd3(%rip), %rsi     # 0x804f5
movl $0x21, %edx
movq %rbx, %rdi
callq 0x40b90
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x40710
movl $0x28, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x40(%rsp), %rsi
leaq 0x1b0(%rsp), %rdi
callq 0x418c0
movb $0x1, %bpl
leaq 0x1b0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f890
movl $0x0, 0x20(%rbx)
xorl %ebp, %ebp
movq 0x4a5aa(%rip), %rsi     # 0xa2f28
movq 0x4a2b3(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d70
jmp 0x58b2d
movq %rax, %r14
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x589b6
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x40880
testb %bpl, %bpl
jne 0x589c0
jmp 0x589cd
movq %rax, %r14
movq %rbx, %rdi
callq 0x40090
jmp 0x589cd
movq %rax, %r14
movq 0x4a3ac(%rip), %rsi     # 0xa2d80
leaq 0x38(%rsp), %rdi
callq 0x3fc30
leaq 0xa8(%rsp), %rdi
callq 0x3f730
jmp 0x58b69
movq %rax, %r14
cmpl $0x1, %edx
jne 0x58b69
movq %r14, %rdi
callq 0x3f910
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x41120
leaq 0x27aff(%rip), %rsi     # 0x80517
leaq 0x38(%rsp), %rdi
movl $0x27, %edx
callq 0x40b90
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 0x407f0
leaq 0x27aac(%rip), %rsi     # 0x80514
leaq 0x38(%rsp), %rdi
movl $0x2, %edx
callq 0x40b90
leaq 0x38(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x3fbf0
leaq 0x28c52(%rip), %rsi     # 0x816e0
leaq 0x38(%rsp), %rdi
movl $0x2, %edx
callq 0x40b90
leaq 0x38(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x40e50
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x418c0
leaq 0x18(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x40db0
movq (%r15), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x58ae6
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x40880
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 0x4a40a(%rip), %rsi     # 0xa2f28
movq 0x4a113(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d70
movq %rax, %r14
movq %rbx, %rdi
callq 0x40090
jmp 0x58b41
jmp 0x58b3e
jmp 0x58b3e
movq %rax, %r14
movq 0x4a238(%rip), %rsi     # 0xa2d80
leaq 0x38(%rsp), %rdi
callq 0x3fc30
leaq 0xa8(%rsp), %rdi
callq 0x3f730
jmp 0x58b64
movq %rax, %r14
callq 0x41aa0
movq %r14, %rdi
callq 0x41f10
movq %rax, %rdi
callq 0x47736
nop