// File: /workspace/github_cpp_makefile_star2_O2/jstaursky[P]hutch/src/hutch.cpp
// Function: Hutch::inspectPreviousInstruction(unsigned long, unsigned long, Hutch_Instructions&, bool (*)(PcodeData))
vector<Instruction>
Hutch::inspectPreviousInstruction (uintb offset, uintb limit,
                                   Hutch_Instructions& insn,
                                   bool (*select) (PcodeData))
{
    vector<Instruction> res;

    resetMark (offset, insn);
    if (insn.getMark ()->address - 1 == 0)
        return {};

    for (auto r = 1; (r != limit) && ((offset - r) > 0) &&
                     disassemble_iter (offset - r, &insn);
         ++r)
        ;
    for (auto rinsn = insn.getMark () - 1; rinsn != insn.current (); --rinsn) {
        // For ROP:
        // Need to determine whether the instruction ends immediately prior to
        // the marked/c3(ret) instruction for instruction to be useful.
        if (select == nullptr) {
            if ((rinsn->address + rinsn->bytelength) ==
                insn.getMark ()->address)
                res.push_back (*rinsn);
            continue;
        }
        // Only add those instructions that meet the alignment requirement
        // described above AND satisfy whatever condition the fptr "select" imposes.
        if (bool isSelected = false;
            (rinsn->address + rinsn->bytelength) == insn.getMark ()->address) {
            for (auto p : rinsn->pcode) {
                isSelected = select (p);
                if (isSelected) {
                    res.push_back (*rinsn);
                    break;
                }
            }
        }
    }
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, %r14
movq %r8, %r12
movq %rcx, %rbx
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %rsi, %rdi
movq %rdx, %rsi
movq %r8, %rdx
callq 0x51930
movq %r12, 0x8(%rsp)
movq 0x30(%r12), %rax
cmpq $0x1, (%rax)
movq %r15, %rax
je 0x7eb96
movq %r15, 0x30(%rsp)
decq %rbp
decq %rbx
movq %rbp, %r15
subq $0x1, %r15
setb %al
subq $0x1, %rbx
jb 0x7eae3
testb %al, %al
jne 0x7eae3
movq %r13, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
callq 0x50c90
movq %r15, %rbp
testl %eax, %eax
jne 0x7eabb
movq 0x8(%rsp), %rax
movq 0x30(%rax), %r13
leaq 0x58(%rsp), %rbp
leaq 0x38(%rsp), %rbx
movq %r13, %rax
addq $-0x58, %r13
movq 0x8(%rsp), %rdx
cmpq 0x28(%rdx), %r13
je 0x7eb7a
movq -0x50(%rax), %rcx
addq -0x58(%rax), %rcx
movq 0x30(%rdx), %rdx
movq (%rdx), %rdx
testq %r14, %r14
je 0x7eb54
cmpq %rdx, %rcx
jne 0x7eaf6
movq -0x28(%rax), %r12
movq -0x20(%rax), %r15
cmpq %r15, %r12
je 0x7eaf6
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4e120
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x4e120
movq %rbx, %rdi
callq *%r14
testb %al, %al
jne 0x7eb68
addq $0x20, %r12
jmp 0x7eb29
cmpq %rdx, %rcx
jne 0x7eaf6
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x519b0
jmp 0x7eaf6
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x519b0
jmp 0x7eaf6
movaps 0x10(%rsp), %xmm0
movq 0x30(%rsp), %r15
movups %xmm0, (%r15)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%r15)
leaq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x10(%rsp), %rdi
callq 0x4ec40
movq %r15, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7ebc5
jmp 0x7ebc5
jmp 0x7ebc5
jmp 0x7ebc5
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4ec40
movq %rbx, %rdi
callq 0x518c0