// File: Doug0855[P]TigerZone/Adapter.cpp
// Function: Adapter::parseTileStack(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
values_t Adapter::parseTileStack(std::string message)
{
  std::string token, substr;
  std::string delimiter = " "; //delimiter between tiles
  size_t pos = 0;
  std::vector<int> tile_stack;
  int tile_num;
  values_t out;

  substr = message.substr(14,message.find(" TILE")-14); //get first string integer
  out.number_of_tiles = stoi(substr);
  substr = message.erase(0, message.find("[")+1); //get string starting with the first tile to start tokeninzing tiles
  for (int i = 0; i < out.number_of_tiles; i++)
  {
  	pos = substr.find(" ");
  	token = substr.substr(0, pos);
  	substr.erase(0, pos + 1);
  	tile_num = exprToTile(token);
  	tile_stack.push_back(tile_num);
  }
  return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdx, -0x128(%rbp)
movq %rdi, -0x120(%rbp)
movq %rdi, %rax
movq %rax, -0x118(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x33c0
leaq -0x58(%rbp), %rdi
callq 0x33c0
leaq -0x79(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x3500
movq -0x108(%rbp), %rdx
leaq 0x18e41(%rip), %rsi     # 0x295cb
leaq -0x78(%rbp), %rdi
callq 0x33b0
jmp 0x10795
leaq -0x79(%rbp), %rdi
callq 0x32f0
movq $0x0, -0x98(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xa030
movq -0x120(%rbp), %rdi
movb $0x0, -0xb5(%rbp)
callq 0x83e0
jmp 0x107ca
movq -0x128(%rbp), %rdi
leaq 0x18d86(%rip), %rsi     # 0x2955e
xorl %eax, %eax
movl %eax, %edx
callq 0x3540
movq -0x128(%rbp), %rsi
movq %rax, %rcx
addq $-0xe, %rcx
leaq -0xd8(%rbp), %rdi
movl $0xe, %edx
callq 0x32d0
jmp 0x10802
leaq -0x58(%rbp), %rdi
movq %rdi, -0x138(%rbp)
leaq -0xd8(%rbp), %rsi
movq %rsi, -0x140(%rbp)
callq 0x3360
movq -0x140(%rbp), %rdi
callq 0x3210
movq -0x138(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x8ca0
movl %eax, -0x12c(%rbp)
jmp 0x10849
movq -0x128(%rbp), %rdi
movq -0x120(%rbp), %rax
movl -0x12c(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x18cfe(%rip), %rsi     # 0x29564
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x150(%rbp)
callq 0x3540
movq -0x128(%rbp), %rdi
movq -0x150(%rbp), %rsi
movq %rax, %rdx
incq %rdx
callq 0x30a0
movq %rax, -0x148(%rbp)
jmp 0x10898
movq -0x148(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x3040
jmp 0x108aa
movl $0x0, -0xdc(%rbp)
movq -0x120(%rbp), %rcx
movl -0xdc(%rbp), %eax
cmpl (%rcx), %eax
jge 0x109f4
leaq 0x18cfb(%rip), %rsi     # 0x295cb
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x158(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x3540
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rcx
leaq -0x100(%rbp), %rdi
callq 0x32d0
jmp 0x10915
leaq -0x38(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movq %rsi, -0x168(%rbp)
callq 0x3360
movq -0x168(%rbp), %rdi
callq 0x3210
movq -0x98(%rbp), %rdx
incq %rdx
xorl %eax, %eax
movl %eax, %esi
leaq -0x58(%rbp), %rdi
callq 0x30a0
jmp 0x10951
movq -0x110(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xf180
movl %eax, -0x16c(%rbp)
jmp 0x10969
movl -0x16c(%rbp), %eax
movl %eax, -0xb4(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb4(%rbp), %rsi
callq 0x11ac0
jmp 0x1098a
jmp 0x1098c
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x108b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x32f0
jmp 0x10a5c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x10a47
movq -0x120(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
callq 0x8560
jmp 0x10a47
movb $0x1, -0xb5(%rbp)
testb $0x1, -0xb5(%rbp)
jne 0x10a10
movq -0x120(%rbp), %rdi
callq 0x8560
leaq -0xb0(%rbp), %rdi
callq 0x8910
leaq -0x78(%rbp), %rdi
callq 0x3210
leaq -0x58(%rbp), %rdi
callq 0x3210
leaq -0x38(%rbp), %rdi
callq 0x3210
movq -0x118(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0xb0(%rbp), %rdi
callq 0x8910
leaq -0x78(%rbp), %rdi
callq 0x3210
leaq -0x58(%rbp), %rdi
callq 0x3210
leaq -0x38(%rbp), %rdi
callq 0x3210
movq -0x88(%rbp), %rdi
callq 0x34f0
nopw (%rax,%rax)