// File: jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: SleighBuilder::dump(OpTpl*)
void SleighBuilder::dump (OpTpl* op)

{ // Dump on op through low-level dump interface
    // filling in dynamic loads and stores if necessary
    PcodeData* thisop;
    VarnodeData* invars;
    VarnodeData* loadvars;
    VarnodeData* storevars;
    VarnodeTpl *vn, *outvn;
    int4 isize = op->numInput ();
    // First build all the inputs
    invars = cache->allocateVarnodes (isize);
    for (int4 i = 0; i < isize; ++i) {
        vn = op->getIn (i);
        if (vn->isDynamic (*walker)) {
            // Input of -op- is really temporary storage
            generateLocation (vn, invars[i]);
            PcodeData* load_op = cache->allocateInstruction ();
            load_op->opc = CPUI_LOAD;
            load_op->outvar = invars + i;
            load_op->isize = 2;
            loadvars = load_op->invar = cache->allocateVarnodes (2);
            AddrSpace* spc = generatePointer (vn, loadvars[1]);
            loadvars[0].space = const_space;
            loadvars[0].offset = (uintb) (uintp)spc;
            loadvars[0].size = sizeof (spc);
        } else
            generateLocation (vn, invars[i]);
    }
    if ((isize > 0) && (op->getIn (0)->isRelative ())) {
        invars->offset += getLabelBase ();
        cache->addLabelRef (invars);
    }
    thisop = cache->allocateInstruction ();
    thisop->opc = op->getOpcode ();
    thisop->invar = invars;
    thisop->isize = isize;
    outvn = op->getOut ();
    if (outvn != (VarnodeTpl*)0) {
        if (outvn->isDynamic (*walker)) {
            storevars = cache->allocateVarnodes (3);
            generateLocation (
                outvn,
                storevars[2]); // Output of -op- is really temporary storage
            thisop->outvar = storevars + 2;
            PcodeData* store_op = cache->allocateInstruction ();
            store_op->opc = CPUI_STORE;
            store_op->isize = 3;
            // store_op->outvar = (VarnodeData *)0;
            store_op->invar = storevars;
            AddrSpace* spc = generatePointer (outvn, storevars[1]); // pointer
            storevars[0].space = const_space;
            storevars[0].offset = (uintb) (uintp)spc; // space in which to store
            storevars[0].size = sizeof (spc);
        } else {
            thisop->outvar = cache->allocateVarnodes (1);
            generateLocation (outvn, *thisop->outvar);
        }
    }
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rdi
callq 0xdf850
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x34(%rsp)
movq 0x40(%rax), %rdi
movl 0x34(%rsp), %esi
callq 0xdf780
movq %rax, 0x58(%rsp)
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x11ae0e
movq 0x68(%rsp), %rdi
movl 0x30(%rsp), %esi
callq 0xd3b80
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq 0x10(%rax), %rsi
callq 0xe1a30
testb $0x1, %al
jne 0x11ad07
jmp 0x11addc
movq 0x8(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x58(%rsp), %rdx
movslq 0x30(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdx
callq 0xd9040
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rdi
callq 0xde590
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x28(%rsp)
movq 0x28(%rsp), %rcx
movl $0x2, (%rcx)
movq 0x58(%rsp), %rdx
movslq 0x30(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rdx
movq 0x28(%rsp), %rcx
movq %rdx, 0x8(%rcx)
movq 0x28(%rsp), %rcx
movl $0x2, 0x18(%rcx)
movq 0x40(%rax), %rdi
movl $0x2, %esi
callq 0xdf780
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rcx
movq %rax, 0x10(%rcx)
movq %rax, 0x50(%rsp)
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq $0x18, %rdx
callq 0xce560
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x20(%rsp)
movq 0x18(%rax), %rcx
movq 0x50(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rsp), %rax
movl $0x8, 0x10(%rax)
jmp 0x11adfc
movq 0x8(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x58(%rsp), %rdx
movslq 0x30(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdx
callq 0xd9040
jmp 0x11adfe
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x11acc7
cmpl $0x0, 0x34(%rsp)
jle 0x11ae5f
movq 0x68(%rsp), %rdi
xorl %esi, %esi
callq 0xd3b80
movq %rax, %rdi
callq 0xddb80
testb $0x1, %al
jne 0x11ae2f
jmp 0x11ae5f
movq 0x8(%rsp), %rdi
callq 0xd7ad0
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x58(%rsp), %rcx
addq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rcx)
movq 0x40(%rax), %rdi
movq 0x58(%rsp), %rsi
callq 0xe2450
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rdi
callq 0xde590
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
callq 0xe2420
movl %eax, %ecx
movq 0x60(%rsp), %rax
movl %ecx, (%rax)
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x10(%rax)
movl 0x34(%rsp), %ecx
movq 0x60(%rsp), %rax
movl %ecx, 0x18(%rax)
movq 0x68(%rsp), %rdi
callq 0xdab40
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0x11afd6
movq 0x8(%rsp), %rax
movq 0x38(%rsp), %rdi
movq 0x10(%rax), %rsi
callq 0xe1a30
testb $0x1, %al
jne 0x11aed6
jmp 0x11af9d
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rdi
movl $0x3, %esi
callq 0xdf780
movq 0x8(%rsp), %rdi
movq %rax, 0x48(%rsp)
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq $0x30, %rdx
callq 0xd9040
movq 0x8(%rsp), %rax
movq 0x48(%rsp), %rdx
addq $0x30, %rdx
movq 0x60(%rsp), %rcx
movq %rdx, 0x8(%rcx)
movq 0x40(%rax), %rdi
callq 0xde590
movq 0x8(%rsp), %rdi
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movl $0x3, (%rax)
movq 0x18(%rsp), %rax
movl $0x3, 0x18(%rax)
movq 0x48(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq $0x18, %rdx
callq 0xce560
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x48(%rsp), %rax
movl $0x8, 0x10(%rax)
jmp 0x11afd4
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rdi
movl $0x1, %esi
callq 0xdf780
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x38(%rsp), %rsi
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0xd9040
jmp 0x11afd6
addq $0x78, %rsp
retq
nopl (%rax,%rax)