// File: jstaursky[P]hutch/src/Sleigh/translate.cc
// Function: PcodeEmit::restoreXmlOp(Element const*, AddrSpaceManager const*)
void PcodeEmit::restoreXmlOp(const Element *el,const AddrSpaceManager *manage)

{ // Read a raw pcode op from DOM (and dump it)
  int4 opcode;
  VarnodeData outvar;
  VarnodeData invar[30];
  VarnodeData *outptr;

  istringstream i(el->getAttributeValue("code"));
  i >> opcode;
  const List &list(el->getChildren());
  List::const_iterator iter = list.begin();
  Address pc = Address::restoreXml(*iter,manage);
  ++iter;
  if ((*iter)->getName() == "void") 
    outptr = (VarnodeData *)0;
  else {
    outvar.restoreXml(*iter,manage);
    outptr = &outvar;
  }
  ++iter;
  int4 isize = 0;
  while(iter != list.end() && isize < 30) {
    if ((*iter)->getName() == "spaceid") {
      invar[isize].space = manage->getConstantSpace();
      invar[isize].offset = (uintb)(uintp)manage->getSpaceByName( (*iter)->getAttributeValue("name") );
      invar[isize].size = sizeof(void *);
    }
    else
      invar[isize].restoreXml(*iter,manage);
    isize += 1;
    ++iter;
  }
  dump(pc,(OpCode)opcode,outptr,invar,isize);
}

// Assembly:
subq $0x5a8, %rsp            # imm = 0x5A8
movq %rdi, 0x5a0(%rsp)
movq %rsi, 0x598(%rsp)
movq %rdx, 0x590(%rsp)
movq 0x5a0(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x598(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0xf7(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0xe0c80
movq 0x80(%rsp), %rdx
leaq 0x89740(%rip), %rsi     # 0x187cfd
leaq 0xf8(%rsp), %rdi
callq 0xe00a0
jmp 0xfe5cc
movq 0x78(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xdb6f0
movq %rax, 0x68(%rsp)
jmp 0xfe5e5
movq 0x68(%rsp), %rsi
leaq 0x118(%rsp), %rdi
movl $0x8, %edx
callq 0xdfcc0
jmp 0xfe5fe
leaq 0xf8(%rsp), %rdi
callq 0xd4550
leaq 0xf7(%rsp), %rdi
callq 0xd8ec0
leaq 0x118(%rsp), %rdi
leaq 0x58c(%rsp), %rsi
callq 0xd4480
jmp 0xfe62f
movq 0x598(%rsp), %rdi
callq 0xde930
movq %rax, 0x60(%rsp)
jmp 0xfe643
movq 0x60(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0xd4960
movq %rax, 0xd0(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xddc90
movq (%rax), %rsi
movq 0x590(%rsp), %rdx
leaq 0xc0(%rsp), %rdi
callq 0xe1830
jmp 0xfe68c
leaq 0xd0(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0xd0700
movq 0x50(%rsp), %rdi
callq 0xddc90
movq (%rax), %rdi
callq 0xcea10
movq %rax, 0x58(%rsp)
jmp 0xfe6b7
movq 0x58(%rsp), %rdi
leaq 0x8963f(%rip), %rsi     # 0x187d02
callq 0xe30f0
movb %al, 0x4f(%rsp)
jmp 0xfe6ce
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0xfe6d8
jmp 0xfe74b
movq $0x0, 0x298(%rsp)
jmp 0xfe782
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0xfe720
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xd4550
leaq 0xf7(%rsp), %rdi
callq 0xd8ec0
jmp 0xfea39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0xfea2c
leaq 0xd0(%rsp), %rdi
callq 0xddc90
movq (%rax), %rsi
movq 0x590(%rsp), %rdx
leaq 0x570(%rsp), %rdi
callq 0xe1360
jmp 0xfe772
leaq 0x570(%rsp), %rax
movq %rax, 0x298(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xd0700
movl $0x0, 0xbc(%rsp)
movq 0xd8(%rsp), %rdi
callq 0xd7a70
movq %rax, 0xb0(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0xd72b0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x4e(%rsp)
jne 0xfe7d3
jmp 0xfe7e2
cmpl $0x1e, 0xbc(%rsp)
setl %al
movb %al, 0x4e(%rsp)
movb 0x4e(%rsp), %al
testb $0x1, %al
jne 0xfe7ef
jmp 0xfe9e0
leaq 0xd0(%rsp), %rdi
callq 0xddc90
movq (%rax), %rdi
callq 0xcea10
movq %rax, 0x40(%rsp)
jmp 0xfe80b
movq 0x40(%rsp), %rdi
leaq 0x894f0(%rip), %rsi     # 0x187d07
callq 0xe30f0
movb %al, 0x3f(%rsp)
jmp 0xfe822
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xfe82f
jmp 0xfe980
movq 0x590(%rsp), %rdi
callq 0xd9e20
movq %rax, 0x30(%rsp)
jmp 0xfe843
movq 0x30(%rsp), %rcx
movslq 0xbc(%rsp), %rax
leaq (%rax,%rax,2), %rax
movq %rcx, 0x2a0(%rsp,%rax,8)
movq 0x590(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xddc90
movq (%rax), %rax
movq %rax, 0x20(%rsp)
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xe0c80
movq 0x28(%rsp), %rdx
leaq 0x88795(%rip), %rsi     # 0x187031
leaq 0x90(%rsp), %rdi
callq 0xe00a0
jmp 0xfe8ab
movq 0x20(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xdb6f0
movq %rax, 0x10(%rsp)
jmp 0xfe8c4
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdi
callq 0xe10d0
movq %rax, 0x8(%rsp)
jmp 0xfe8da
movq 0x8(%rsp), %rcx
movslq 0xbc(%rsp), %rdx
leaq 0x2a0(%rsp), %rax
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
leaq 0x90(%rsp), %rdi
callq 0xd4550
leaq 0x8f(%rsp), %rdi
callq 0xd8ec0
movslq 0xbc(%rsp), %rcx
leaq 0x2a0(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x8, 0x10(%rax)
jmp 0xfe9bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0xfe96e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x90(%rsp), %rdi
callq 0xd4550
leaq 0x8f(%rsp), %rdi
callq 0xd8ec0
jmp 0xfea2c
movslq 0xbc(%rsp), %rax
leaq (%rax,%rax,2), %rax
leaq 0x2a0(%rsp,%rax,8), %rax
movq %rax, (%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xddc90
movq (%rsp), %rdi
movq (%rax), %rsi
movq 0x590(%rsp), %rdx
callq 0xe1360
jmp 0xfe9bb
jmp 0xfe9bd
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xd0700
jmp 0xfe79a
movq 0x70(%rsp), %rdi
movl 0x58c(%rsp), %edx
movq 0x298(%rsp), %rcx
movl 0xbc(%rsp), %r9d
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq 0xc0(%rsp), %rsi
leaq 0x2a0(%rsp), %r8
callq *%rax
jmp 0xfea17
leaq 0x118(%rsp), %rdi
callq 0xd25a0
addq $0x5a8, %rsp            # imm = 0x5A8
retq
leaq 0x118(%rsp), %rdi
callq 0xd25a0
movq 0xe8(%rsp), %rdi
callq 0xe0be0
nopw %cs:(%rax,%rax)