// File: jstaursky[P]hutch/src/Sleigh/globalcontext.cc
// Function: ContextInternal::restoreFromSpec(Element const*, AddrSpaceManager const*)
void ContextInternal::restoreFromSpec(const Element *el,const AddrSpaceManager *manage)

{
  const List &list(el->getChildren());
  List::const_iterator iter = list.begin();

  while(iter != list.end()) {
    const Element *subel = *iter;
    if (subel->getName() == "context_set") {
      Range range;
      range.restoreXml(subel,manage); // There MUST be a range
      Address addr1,addr2;
      addr1 = range.getFirstAddr();
      addr2 = range.getLastAddrOpen(manage);
      restoreContext(subel,addr1,addr2);
    }
    else if (subel->getName() == "tracked_set") {
      Range range;
      range.restoreXml(subel,manage); // There MUST be a range
      Address addr1,addr2;
      addr1 = range.getFirstAddr();
      addr2 = range.getLastAddrOpen(manage);
      restoreTracked(subel,manage,createSet(addr1,addr2));
    }
    else
      throw LowlevelError("Bad <context_data> tag: "+subel->getName());
    ++iter;
  }
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
movq %rdx, 0x130(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x138(%rsp), %rdi
callq 0xde930
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rdi
callq 0xd4960
movq %rax, 0x120(%rsp)
movq 0x128(%rsp), %rdi
callq 0xd7a70
movq %rax, 0x118(%rsp)
leaq 0x120(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0xd72b0
testb $0x1, %al
jne 0xecf39
jmp 0xed203
leaq 0x120(%rsp), %rdi
callq 0xddc90
movq (%rax), %rax
movq %rax, 0x110(%rsp)
movq 0x110(%rsp), %rdi
callq 0xcea10
movq %rax, %rdi
leaq 0x9a3a0(%rip), %rsi     # 0x187308
callq 0xe30f0
testb $0x1, %al
jne 0xecf76
jmp 0xed03d
leaq 0xf8(%rsp), %rdi
callq 0xd90b0
movq 0x110(%rsp), %rsi
movq 0x130(%rsp), %rdx
leaq 0xf8(%rsp), %rdi
callq 0xe1ba0
leaq 0xe8(%rsp), %rdi
callq 0xe1dc0
leaq 0xd8(%rsp), %rdi
callq 0xe1dc0
leaq 0xc8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xe2790
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xdafc0
movq 0x130(%rsp), %rdx
leaq 0xb8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xcff70
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xdafc0
movq 0x28(%rsp), %rdi
movq 0x110(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
leaq 0xd8(%rsp), %rcx
callq 0xd03d0
jmp 0xed1f1
movq 0x110(%rsp), %rdi
callq 0xcea10
movq %rax, %rdi
leaq 0x9a2c0(%rip), %rsi     # 0x187314
callq 0xe30f0
testb $0x1, %al
jne 0xed062
jmp 0xed142
leaq 0xa0(%rsp), %rdi
callq 0xd90b0
movq 0x110(%rsp), %rsi
movq 0x130(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0xe1ba0
leaq 0x90(%rsp), %rdi
callq 0xe1dc0
leaq 0x80(%rsp), %rdi
callq 0xe1dc0
leaq 0x70(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xe2790
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xdafc0
movq 0x130(%rsp), %rdx
leaq 0x60(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xcff70
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xdafc0
movq 0x28(%rsp), %rdi
movq 0x110(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x20(%rsp)
movq (%rdi), %rax
leaq 0x90(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq *0x70(%rax)
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rax, %rdx
callq 0xd95a0
jmp 0xed1ef
movb $0x1, 0x33(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x8(%rsp)
movq 0x110(%rsp), %rdi
callq 0xcea10
movq %rax, 0x10(%rsp)
jmp 0xed16a
movq 0x10(%rsp), %rdx
leaq 0x9a1aa(%rip), %rsi     # 0x187320
leaq 0x40(%rsp), %rdi
callq 0xd7370
jmp 0xed182
movq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xd1ae0
jmp 0xed193
movq 0x8(%rsp), %rdi
movb $0x0, 0x33(%rsp)
movq 0xdacec(%rip), %rsi     # 0x1c7e90
movq 0xdaa25(%rip), %rdx     # 0x1c7bd0
callq 0xe01f0
jmp 0xed215
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
jmp 0xed1da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xd4550
testb $0x1, 0x33(%rsp)
jne 0xed1e3
jmp 0xed1ed
movq 0x8(%rsp), %rdi
callq 0xd5400
jmp 0xed20b
jmp 0xed1f1
leaq 0x120(%rsp), %rdi
callq 0xd0700
jmp 0xecf06
addq $0x148, %rsp            # imm = 0x148
retq
movq 0x38(%rsp), %rdi
callq 0xe0be0
nopw %cs:(%rax,%rax)