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

{
  vector<VarnodeData> pieces;
  int4 szsum = 0;
  int4 i=0;
  while(i < s.size()) {
    pieces.push_back(VarnodeData()); // Prepare to read next VarnodeData
    string token;
    while((i<s.size())&&(s[i]!=',')) {
      token += s[i];
      i += 1;
    }
    i += 1;			// Skip the comma
    try {
      pieces.back() = getTrans()->getRegister(token);
    }
    catch(LowlevelError &err) {	// Name doesn't exist
      char shortcut = token[0];
      AddrSpace *spc = getManager()->getSpaceByShortcut(shortcut);
      if (spc == (AddrSpace *)0)
	throw LowlevelError("Could not parse join string");

      int4 subsize;
      pieces.back().space = spc;
      pieces.back().offset = spc->read(token.substr(1),subsize);
      pieces.back().size = subsize;
    }
    szsum += pieces.back().size;
  }
  JoinRecord *rec = getManager()->findAddJoin(pieces,0);
  size = szsum;
  return rec->getUnified().offset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, 0x50(%rsp)
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r12
movaps %xmm0, (%r12)
andq $0x0, 0x10(%r12)
xorl %ebx, %ebx
leaq 0x30(%rsp), %r13
xorl %ebp, %ebp
movslq %ebx, %rbx
cmpq %rbx, 0x8(%r15)
jbe 0x59101
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x4d0e0
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
cmpq %rbx, 0x8(%r15)
jbe 0x59036
movq (%r15), %rax
movb (%rax,%rbx), %al
cmpb $0x2c, %al
je 0x59036
movsbl %al, %esi
movq %r13, %rdi
callq 0x4f090
incq %rbx
jmp 0x59016
movq 0x18(%r14), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x38(%rax)
movq 0x18(%rsp), %rcx
movq 0x10(%rax), %rdx
movq %rdx, -0x8(%rcx)
movups (%rax), %xmm0
movups %xmm0, -0x18(%rcx)
incq %rbx
movq 0x18(%rsp), %rax
addl -0x8(%rax), %ebp
movq %r13, %rdi
callq 0x4e020
jmp 0x58fdb
cmpl $0x1, %edx
jne 0x591ce
movq %rax, %rdi
callq 0x4de70
movq 0x30(%rsp), %rax
movsbl (%rax), %esi
movq 0x10(%r14), %rdi
callq 0x50b70
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x59138
movq 0x18(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, -0x18(%rax)
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
callq 0x4f700
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
leaq 0x58(%rsp), %rsi
leaq 0x4(%rsp), %rdx
callq *0x58(%rax)
movq 0x18(%rsp), %rcx
movq %rax, -0x10(%rcx)
leaq 0x58(%rsp), %rdi
callq 0x4e020
movl 0x4(%rsp), %eax
movq 0x18(%rsp), %rcx
movl %eax, -0x8(%rcx)
callq 0x51210
jmp 0x59057
movq 0x10(%r14), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x50400
movq 0x50(%rsp), %rcx
movl %ebp, (%rcx)
movq 0x20(%rax), %rbx
leaq 0x10(%rsp), %rdi
callq 0x4f8c0
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x20
popq %rdi
callq 0x4e180
movq %rax, %rbx
leaq 0x2d72b(%rip), %rsi     # 0x86875
leaq 0x58(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x515e0
movb $0x1, %bpl
leaq 0x58(%rsp), %rsi
movq %rbx, %rdi
callq 0x4ddf0
xorl %ebp, %ebp
movq 0x55d2e(%rip), %rsi     # 0xaeea0
movq 0x55abf(%rip), %rdx     # 0xaec38
movq %rbx, %rdi
callq 0x51630
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x4e020
testb %bpl, %bpl
jne 0x59198
jmp 0x591b8
movq %rax, %r14
movq %rbx, %rdi
callq 0x4ea60
jmp 0x591b8
jmp 0x591ce
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x4e020
jmp 0x591b8
jmp 0x591b5
movq %rax, %r14
callq 0x51210
jmp 0x591d1
movq %rax, %rdi
callq 0x55fd2
jmp 0x591c9
movq %rax, %r14
jmp 0x591db
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x4e020
leaq 0x10(%rsp), %rdi
callq 0x4f8c0
movq %r14, %rdi
callq 0x518c0
nop