// File: jstaursky[P]hutch/src/Sleigh/address.cc
// Function: Range::restoreXml(Element const*, AddrSpaceManager const*)
void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)

{
  spc = (AddrSpace *)0;
  first = 0;
  last = ~((uintb)0);
  for(int4 i=0;i<el->getNumAttributes();++i) {
    if (el->getAttributeName(i) == "space") {
      spc = manage->getSpaceByName(el->getAttributeValue(i));
      if (spc == (AddrSpace *)0)
        throw LowlevelError("Undefined space: "+el->getAttributeValue(i));
    }
    else if (el->getAttributeName(i) == "first") {
      istringstream s(el->getAttributeValue(i));
      s.unsetf(ios::dec | ios::hex | ios::oct);
      s >> first;
    }
    else if (el->getAttributeName(i) == "last") {
      istringstream s(el->getAttributeValue(i));
      s.unsetf(ios::dec | ios::hex | ios::oct);
      s >> last;
    }
    else if (el->getAttributeName(i) == "name") {
      const Translate *trans = manage->getDefaultSpace()->getTrans();
      const VarnodeData &point(trans->getRegister(el->getAttributeValue(i)));
      spc = point.space;
      first = point.offset;
      last = (first-1) + point.size;
      break;		// There should be no (space,first,last) attributes
    }
  }
  if (spc == (AddrSpace *)0)
	  throw LowlevelError("No address space indicated in range tag");
  last = spc->wrapOffset(last);
}

// Assembly:
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rdi, 0x3f0(%rsp)
movq %rsi, 0x3e8(%rsp)
movq %rdx, 0x3e0(%rsp)
movq 0x3f0(%rsp), %rax
movq %rax, 0x68(%rsp)
movq $0x0, (%rax)
movq $0x0, 0x8(%rax)
movq $-0x1, 0x10(%rax)
movl $0x0, 0x3dc(%rsp)
movl 0x3dc(%rsp), %eax
movl %eax, 0x64(%rsp)
movq 0x3e8(%rsp), %rdi
callq 0xd2b80
movl %eax, %ecx
movl 0x64(%rsp), %eax
cmpl %ecx, %eax
jge 0xe4474
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd5520
movq %rax, %rdi
leaq 0xa3aa7(%rip), %rsi     # 0x187b19
callq 0xe30f0
testb $0x1, %al
jne 0xe4080
jmp 0xe41a0
movq 0x3e0(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd9670
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0xe10d0
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, (%rax)
cmpq $0x0, (%rax)
jne 0xe419b
movb $0x1, 0x3ab(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x48(%rsp)
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd9670
movq %rax, 0x50(%rsp)
jmp 0xe40f5
movq 0x50(%rsp), %rdx
leaq 0xa2f1e(%rip), %rsi     # 0x18701f
leaq 0x3b8(%rsp), %rdi
callq 0xd7370
jmp 0xe4110
movq 0x48(%rsp), %rdi
leaq 0x3b8(%rsp), %rsi
callq 0xd1ae0
jmp 0xe4124
movq 0x48(%rsp), %rdi
movb $0x0, 0x3ab(%rsp)
movq 0xe3d58(%rip), %rsi     # 0x1c7e90
movq 0xe3a91(%rip), %rdx     # 0x1c7bd0
callq 0xe01f0
jmp 0xe4572
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3b0(%rsp)
movl %eax, 0x3ac(%rsp)
jmp 0xe4180
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3b0(%rsp)
movl %eax, 0x3ac(%rsp)
leaq 0x3b8(%rsp), %rdi
callq 0xd4550
testb $0x1, 0x3ab(%rsp)
jne 0xe418c
jmp 0xe4196
movq 0x48(%rsp), %rdi
callq 0xd5400
jmp 0xe4565
jmp 0xe445c
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd5520
movq %rax, %rdi
leaq 0xa2e56(%rip), %rsi     # 0x187014
callq 0xe30f0
testb $0x1, %al
jne 0xe41cc
jmp 0xe429a
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd9670
movq %rax, %rsi
leaq 0x228(%rsp), %rdi
movl $0x8, %edx
movl %edx, 0x34(%rsp)
callq 0xdfcc0
movl 0x34(%rsp), %esi
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x228(%rsp,%rax), %rax
movq %rax, 0x38(%rsp)
movl $0x2, %edi
callq 0xe0e70
movl %eax, 0x44(%rsp)
jmp 0xe4226
movl 0x44(%rsp), %edi
movl $0x40, %esi
callq 0xe0e70
movl %eax, 0x30(%rsp)
jmp 0xe423a
movl 0x30(%rsp), %esi
movq 0x38(%rsp), %rdi
callq 0xda6e0
jmp 0xe424a
movq 0x68(%rsp), %rsi
addq $0x8, %rsi
leaq 0x228(%rsp), %rdi
callq 0xdcd70
jmp 0xe4262
leaq 0x228(%rsp), %rdi
callq 0xd25a0
jmp 0xe445a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3b0(%rsp)
movl %eax, 0x3ac(%rsp)
leaq 0x228(%rsp), %rdi
callq 0xd25a0
jmp 0xe4565
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd5520
movq %rax, %rdi
leaq 0xa2d62(%rip), %rsi     # 0x18701a
callq 0xe30f0
testb $0x1, %al
jne 0xe42c6
jmp 0xe4394
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd9670
movq %rax, %rsi
leaq 0xa8(%rsp), %rdi
movl $0x8, %edx
movl %edx, 0x1c(%rsp)
callq 0xdfcc0
movl 0x1c(%rsp), %esi
movq 0xa8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xa8(%rsp,%rax), %rax
movq %rax, 0x20(%rsp)
movl $0x2, %edi
callq 0xe0e70
movl %eax, 0x2c(%rsp)
jmp 0xe4320
movl 0x2c(%rsp), %edi
movl $0x40, %esi
callq 0xe0e70
movl %eax, 0x18(%rsp)
jmp 0xe4334
movl 0x18(%rsp), %esi
movq 0x20(%rsp), %rdi
callq 0xda6e0
jmp 0xe4344
movq 0x68(%rsp), %rsi
addq $0x10, %rsi
leaq 0xa8(%rsp), %rdi
callq 0xdcd70
jmp 0xe435c
leaq 0xa8(%rsp), %rdi
callq 0xd25a0
jmp 0xe4458
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3b0(%rsp)
movl %eax, 0x3ac(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xd25a0
jmp 0xe4565
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd5520
movq %rax, %rdi
leaq 0xa2c7f(%rip), %rsi     # 0x187031
callq 0xe30f0
testb $0x1, %al
jne 0xe43c0
jmp 0xe4456
movq 0x3e0(%rsp), %rdi
callq 0xd9770
movq %rax, %rdi
callq 0xdf7e0
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x3e8(%rsp), %rdi
movl 0x3dc(%rsp), %esi
callq 0xd9670
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movq (%rdi), %rax
callq *0x38(%rax)
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x98(%rsp)
movq 0x98(%rsp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq 0x98(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rcx
subq $0x1, %rcx
movq 0x98(%rsp), %rdx
movl 0x10(%rdx), %edx
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
jmp 0xe4474
jmp 0xe4458
jmp 0xe445a
jmp 0xe445c
jmp 0xe445e
movl 0x3dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3dc(%rsp)
jmp 0xe402e
movq 0x68(%rsp), %rax
cmpq $0x0, (%rax)
jne 0xe4540
movb $0x1, 0x76(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, (%rsp)
leaq 0x77(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xe0c80
movq 0x8(%rsp), %rdx
leaq 0xa2b85(%rip), %rsi     # 0x187036
leaq 0x78(%rsp), %rdi
callq 0xe00a0
jmp 0xe44bd
movq (%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0xd1ae0
jmp 0xe44cd
movq (%rsp), %rdi
movb $0x0, 0x76(%rsp)
movq 0xe39b3(%rip), %rsi     # 0x1c7e90
movq 0xe36ec(%rip), %rdx     # 0x1c7bd0
callq 0xe01f0
jmp 0xe4572
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3b0(%rsp)
movl %eax, 0x3ac(%rsp)
jmp 0xe4522
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3b0(%rsp)
movl %eax, 0x3ac(%rsp)
leaq 0x78(%rsp), %rdi
callq 0xd4550
leaq 0x77(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0x76(%rsp)
jne 0xe4535
jmp 0xe453e
movq (%rsp), %rdi
callq 0xd5400
jmp 0xe4565
movq 0x68(%rsp), %rax
movq (%rax), %rdi
movq 0x10(%rax), %rsi
callq 0xcfa10
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x10(%rax)
addq $0x3f8, %rsp            # imm = 0x3F8
retq
movq 0x3b0(%rsp), %rdi
callq 0xe0be0
nopw %cs:(%rax,%rax)