// File: jstaursky[P]hutch/src/Sleigh/space.cc
// Function: AddrSpace::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int&) const
uintb AddrSpace::read(const string &s,int4 &size) const

{
  const char *enddata;
  char *tmpdata;
  int4 expsize;
  string::size_type append;
  string frontpart;
  uintb offset;
  
  append = s.find_first_of(":+");
  try {
    if (append == string::npos) {
      const VarnodeData &point(trans->getRegister(s));
      offset = point.offset;
      size = point.size;
    }
    else {
      frontpart = s.substr(0,append);
      const VarnodeData &point(trans->getRegister(frontpart));
      offset = point.offset;
      size = point.size;
    }
  }
  catch(LowlevelError &err) {	// Name doesn't exist
    offset = strtoul(s.c_str(),&tmpdata,0);
    offset = addressToByte(offset,wordsize);
    enddata = (const char *) tmpdata;
    if (enddata - s.c_str() == s.size()) { // If no size or offset override
      size = manage->getDefaultSize();	// Return "natural" size
      return offset;
    }
    size = manage->getDefaultSize();
  }
  if (append != string::npos) {
    enddata = s.c_str()+append;
    expsize = get_offset_size( enddata, offset );
    if (expsize!=-1) {
      size = expsize;
      return offset;
    }
  }
  return offset;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0xf8(%rsp)
movq %rsi, 0xf0(%rsp)
movq %rdx, 0xe8(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xdc610
movq 0xf0(%rsp), %rdi
leaq 0x91351(%rip), %rsi     # 0x1877f9
xorl %eax, %eax
movl %eax, %edx
callq 0xd2e50
movq %rax, 0xc8(%rsp)
cmpq $-0x1, 0xc8(%rsp)
jne 0xf6648
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0xf0(%rsp), %rsi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
movq %rax, 0x40(%rsp)
jmp 0xf64e9
movq 0x40(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movl 0x10(%rax), %ecx
movq 0xe8(%rsp), %rax
movl %ecx, (%rax)
jmp 0xf66d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
movl 0x8c(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xf6811
movq 0x90(%rsp), %rdi
callq 0xd1d20
movq %rax, 0x58(%rsp)
movq 0xf0(%rsp), %rdi
callq 0xd1d80
movq %rax, %rdi
leaq 0xd8(%rsp), %rsi
xorl %edx, %edx
callq 0xd0fb0
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
movl 0x5c(%rax), %esi
callq 0xe2550
movq %rax, 0x38(%rsp)
jmp 0xf65a4
movq 0x38(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xf0(%rsp), %rdi
callq 0xd1d80
movq %rax, %rcx
movq 0x28(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0xf0(%rsp), %rdi
callq 0xd5290
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jne 0xf66f9
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0xde380
movl %eax, 0x24(%rsp)
jmp 0xf661d
movl 0x24(%rsp), %ecx
movq 0xe8(%rsp), %rax
movl %ecx, (%rax)
movq 0xa0(%rsp), %rax
movq %rax, 0x100(%rsp)
movl $0x1, 0x54(%rsp)
jmp 0xf6723
movq 0xf0(%rsp), %rsi
movq 0xc8(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0x68(%rsp), %rdi
callq 0xd8920
jmp 0xf6668
leaq 0xa8(%rsp), %rdi
movq %rdi, 0x10(%rsp)
leaq 0x68(%rsp), %rsi
movq %rsi, 0x8(%rsp)
callq 0xda960
movq 0x8(%rsp), %rdi
callq 0xd4550
movq 0x48(%rsp), %rax
movq 0x10(%rsp), %rsi
movq 0x18(%rax), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
movq %rax, 0x18(%rsp)
jmp 0xf66ac
movq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0x60(%rsp), %rax
movl 0x10(%rax), %ecx
movq 0xe8(%rsp), %rax
movl %ecx, (%rax)
jmp 0xf673a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
callq 0xdf2c0
jmp 0xf67d8
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0xde380
movl %eax, 0x4(%rsp)
jmp 0xf670d
movl 0x4(%rsp), %ecx
movq 0xe8(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x54(%rsp)
callq 0xdf2c0
jmp 0xf672a
movl 0x54(%rsp), %eax
testl %eax, %eax
jne 0xf67f4
jmp 0xf6738
jmp 0xf673a
cmpq $-0x1, 0xc8(%rsp)
je 0xf67dc
movq 0xf0(%rsp), %rdi
callq 0xd1d80
movq 0xc8(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xf6840
movl %eax, (%rsp)
jmp 0xf6783
movl (%rsp), %eax
movl %eax, 0xd4(%rsp)
cmpl $-0x1, 0xd4(%rsp)
je 0xf67da
movl 0xd4(%rsp), %ecx
movq 0xe8(%rsp), %rax
movl %ecx, (%rax)
movq 0xa0(%rsp), %rax
movq %rax, 0x100(%rsp)
movl $0x1, 0x54(%rsp)
jmp 0xf67f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
jmp 0xf6811
jmp 0xf6811
jmp 0xf67dc
movq 0xa0(%rsp), %rax
movq %rax, 0x100(%rsp)
movl $0x1, 0x54(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xd4550
movq 0x100(%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
retq
leaq 0xa8(%rsp), %rdi
callq 0xd4550
movq 0x90(%rsp), %rdi
callq 0xe0be0
movq %rax, %rdi
callq 0xe7140
nopw %cs:(%rax,%rax)