// File: jstaursky[P]hutch/src/Sleigh/space.cc
// Function: AddrSpace::restoreXmlAttributes(Element const*, unsigned int&) const
uintb AddrSpace::restoreXmlAttributes(const Element *el,uint4 &size) const

{
  uintb offset;
  int4 num = el->getNumAttributes();
  bool foundoffset = false;
  for(int4 i=0;i<num;++i) {
    if (el->getAttributeName(i)=="offset") {
      foundoffset = true;
      istringstream s1(el->getAttributeValue(i));
      s1.unsetf(ios::dec | ios::hex | ios::oct);
      s1 >> offset;
    }
    else if (el->getAttributeName(i)=="size") {
      istringstream s2(el->getAttributeValue(i));
      s2.unsetf(ios::dec | ios::hex | ios::oct);
      s2 >> size;
    }
  }
  if (!foundoffset)
    throw LowlevelError("Address is missing offset");

  return offset;
}

// Assembly:
subq $0x3a8, %rsp            # imm = 0x3A8
movq %rdi, 0x3a0(%rsp)
movq %rsi, 0x398(%rsp)
movq %rdx, 0x390(%rsp)
movq 0x398(%rsp), %rdi
callq 0xd2b80
movl %eax, 0x384(%rsp)
movb $0x0, 0x383(%rsp)
movl $0x0, 0x37c(%rsp)
movl 0x37c(%rsp), %eax
cmpl 0x384(%rsp), %eax
jge 0xf6219
movq 0x398(%rsp), %rdi
movl 0x37c(%rsp), %esi
callq 0xd5520
movq %rax, %rdi
leaq 0x91ce2(%rip), %rsi     # 0x187d1a
callq 0xe30f0
testb $0x1, %al
jne 0xf6046
jmp 0xf611b
movb $0x1, 0x383(%rsp)
movq 0x398(%rsp), %rdi
movl 0x37c(%rsp), %esi
callq 0xd9670
movq %rax, %rsi
leaq 0x1f8(%rsp), %rdi
movl $0x8, %edx
movl %edx, 0x34(%rsp)
callq 0xdfcc0
movl 0x34(%rsp), %esi
movq 0x1f8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1f8(%rsp,%rax), %rax
movq %rax, 0x38(%rsp)
movl $0x2, %edi
callq 0xe0e70
movl %eax, 0x40(%rsp)
jmp 0xf60a8
movl 0x40(%rsp), %edi
movl $0x40, %esi
callq 0xe0e70
movl %eax, 0x30(%rsp)
jmp 0xf60bc
movl 0x30(%rsp), %esi
movq 0x38(%rsp), %rdi
callq 0xda6e0
jmp 0xf60cc
leaq 0x1f8(%rsp), %rdi
leaq 0x388(%rsp), %rsi
callq 0xdcd70
jmp 0xf60e3
leaq 0x1f8(%rsp), %rdi
callq 0xd25a0
jmp 0xf6201
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0xd25a0
jmp 0xf62f5
movq 0x398(%rsp), %rdi
movl 0x37c(%rsp), %esi
callq 0xd5520
movq %rax, %rdi
leaq 0x97874(%rip), %rsi     # 0x18d9ad
callq 0xe30f0
testb $0x1, %al
jne 0xf6147
jmp 0xf61ff
movq 0x398(%rsp), %rdi
movl 0x37c(%rsp), %esi
callq 0xd9670
movq %rax, %rsi
leaq 0x68(%rsp), %rdi
movl $0x8, %edx
movl %edx, 0x1c(%rsp)
callq 0xdfcc0
movl 0x1c(%rsp), %esi
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x68(%rsp,%rax), %rax
movq %rax, 0x20(%rsp)
movl $0x2, %edi
callq 0xe0e70
movl %eax, 0x2c(%rsp)
jmp 0xf6198
movl 0x2c(%rsp), %edi
movl $0x40, %esi
callq 0xe0e70
movl %eax, 0x18(%rsp)
jmp 0xf61ac
movl 0x18(%rsp), %esi
movq 0x20(%rsp), %rdi
callq 0xda6e0
jmp 0xf61bc
movq 0x390(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0xceae0
jmp 0xf61d0
leaq 0x68(%rsp), %rdi
callq 0xd25a0
jmp 0xf61ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x68(%rsp), %rdi
callq 0xd25a0
jmp 0xf62f5
jmp 0xf6201
jmp 0xf6203
movl 0x37c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x37c(%rsp)
jmp 0xf6006
testb $0x1, 0x383(%rsp)
jne 0xf62e5
movb $0x1, 0x46(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x8(%rsp)
leaq 0x47(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xe0c80
movq 0x10(%rsp), %rdx
leaq 0x91589(%rip), %rsi     # 0x1877df
leaq 0x48(%rsp), %rdi
callq 0xe00a0
jmp 0xf6262
movq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xd1ae0
jmp 0xf6273
movq 0x8(%rsp), %rdi
movb $0x0, 0x46(%rsp)
movq 0xd1c0c(%rip), %rsi     # 0x1c7e90
movq 0xd1945(%rip), %rdx     # 0x1c7bd0
callq 0xe01f0
jmp 0xf6302
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
jmp 0xf62c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xd4550
leaq 0x47(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0x46(%rsp)
jne 0xf62d9
jmp 0xf62e3
movq 0x8(%rsp), %rdi
callq 0xd5400
jmp 0xf62f5
movq 0x388(%rsp), %rax
addq $0x3a8, %rsp            # imm = 0x3A8
retq
movq 0x1f0(%rsp), %rdi
callq 0xe0be0
nopw %cs:(%rax,%rax)