// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rdx, 0x60(%rsp)
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x8(%rsi)
je 0x4b5a9
movq %rsi, %r15
xorl %ebx, %ebx
leaq 0x20(%rsp), %r13
xorl %r12d, %r12d
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x4b460
movups %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x4b46b
movq %rsp, %rdi
movq %r13, %rdx
callq 0x41470
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movslq %r12d, %rbp
cmpq %rbp, 0x8(%r15)
jbe 0x4b4ad
movq (%r15), %rax
movb (%rax,%rbp), %al
cmpb $0x2c, %al
je 0x4b4aa
movsbl %al, %esi
movq %r13, %rdi
callq 0x40490
incq %rbp
cmpq %rbp, 0x8(%r15)
ja 0x4b48c
movl %ebp, %r12d
movq 0x18(%r14), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x38(%rax)
movq 0x8(%rsp), %rcx
movq 0x10(%rax), %rdx
movq %rdx, -0x8(%rcx)
movups (%rax), %xmm0
movups %xmm0, -0x18(%rcx)
movq 0x8(%rsp), %rax
addl -0x8(%rax), %ebx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x4b4f2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x40880
incl %r12d
movslq %r12d, %rax
cmpq %rax, 0x8(%r15)
ja 0x4b430
jmp 0x4b5ab
movq %rax, %rbp
cmpl $0x1, %edx
jne 0x4b6b6
movq %rbp, %rdi
callq 0x3f910
movq 0x20(%rsp), %rax
movsbl (%rax), %esi
movq 0x10(%r14), %rdi
callq 0x415f0
movq %rax, %rbp
testq %rax, %rax
je 0x4b5ec
movq 0x8(%rsp), %rax
movq %rbp, -0x18(%rax)
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x408d0
movq (%rbp), %rax
movq %rbp, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
callq *0x58(%rax)
movq 0x8(%rsp), %rcx
movq %rax, -0x10(%rcx)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x4b593
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x40880
movl 0x1c(%rsp), %eax
movq 0x8(%rsp), %rcx
movl %eax, -0x8(%rcx)
callq 0x41aa0
jmp 0x4b4ce
xorl %ebx, %ebx
movq 0x10(%r14), %rdi
movq %rsp, %rsi
xorl %edx, %edx
callq 0x410b0
movq 0x60(%rsp), %rcx
movl %ebx, (%rcx)
movq 0x20(%rax), %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4b5da
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x40880
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
movq %rax, (%rdi)
leaq 0x34268(%rip), %rsi     # 0x7f875
leaq 0x3427c(%rip), %rdx     # 0x7f890
callq 0x3f8a0
movb $0x1, %r14b
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f890
xorl %r14d, %r14d
movq 0x57875(%rip), %rsi     # 0xa2ea8
movq 0x575fe(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d70
movq %rax, %rbp
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x4b661
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x40880
testb %r14b, %r14b
jne 0x4b66b
jmp 0x4b69d
movq %rax, %rbp
movq %rbx, %rdi
callq 0x40090
jmp 0x4b69d
jmp 0x4b6b3
movq %rax, %rbp
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x4b69d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x40880
jmp 0x4b69d
jmp 0x4b69a
movq %rax, %rbp
callq 0x41aa0
jmp 0x4b6b6
movq %rax, %rdi
callq 0x47736
jmp 0x4b6ae
movq %rax, %rbp
jmp 0x4b6d2
movq %rax, %rbp
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x4b6d2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x40880
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4b6e8
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x40880
movq %rbp, %rdi
callq 0x41f10