// File: Doug0855[P]TigerZone/Adapter.cpp
// Function: Adapter::parseGameMove(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
values_t Adapter::parseGameMove(std::string message)
{
  values_t out;

  std::istringstream buffer(message);
  std::istream_iterator<std::string> beg(buffer), end;

  std::vector<std::string> messageWords(beg,end);   //Put all the words from the message into a vector

  std::string gameId = messageWords[1];
  out.gameId = gameId;
  std::string temp = messageWords[3];
  out.moveNumber = temp;

  if(messageWords[6] == "FORFEITED:")  //Check to see if the other player forfeited
  {
    out.forfeit = -1;
    return out;
  }
  else if(messageWords[6] == "PLACED")  //Check to see if the other player forfeited
  {
	std::string playerId = messageWords[5];
    std::string tileType = messageWords[7];
    int xCoord = stoi(messageWords[9]);
    int yCoord = stoi(messageWords[10]);
    int rotation = stoi(messageWords[11]);
    std::string animalType = messageWords[12];

	out.playerId = playerId;

	out.coordinates = convertCoordinates(xCoord, yCoord);
	out.rotation = numRotations(rotation);
	out.tile_num = exprToTile(tileType);
	if (animalType == "CROCODILE")
		out.croc = true;
	else
		out.croc = false;
	if (animalType == "TIGER")
		out.tiger = true;
	else
		out.tiger = false;


    if(messageWords.size() == 14 && animalType == "TIGER"){
      int tigerZone = stoi(messageWords[13]);
      out.tiger_spot = convertZone(tigerZone);   //Set the zone where the meeple is placed in the tile
    }

    return out;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3c0, %rsp            # imm = 0x3C0
movq %rdx, -0x368(%rbp)
movq %rdi, -0x380(%rbp)
movq %rdi, %rax
movq %rax, -0x378(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x370(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x83e0
movq -0x368(%rbp), %rsi
leaq -0x1a0(%rbp), %rdi
movl $0x8, %edx
callq 0x34a0
jmp 0x10f2d
leaq -0x1e0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11730
jmp 0x10f42
leaq -0x210(%rbp), %rdi
callq 0x11790
jmp 0x10f50
leaq -0x258(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x117d0
jmp 0x10f65
leaq -0x288(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x117d0
jmp 0x10f7a
leaq -0x289(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x11820
movq -0x388(%rbp), %rcx
leaq -0x228(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x288(%rbp), %rdx
callq 0x11840
jmp 0x10fb0
leaq -0x289(%rbp), %rdi
callq 0x11940
leaq -0x288(%rbp), %rdi
callq 0x11960
leaq -0x258(%rbp), %rdi
callq 0x11960
leaq -0x228(%rbp), %rdi
movl $0x1, %esi
callq 0x119a0
movq %rax, %rsi
leaq -0x2b0(%rbp), %rdi
callq 0x3160
jmp 0x10ff6
movq -0x380(%rbp), %rdi
addq $0x40, %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x3040
jmp 0x1100f
leaq -0x228(%rbp), %rdi
movl $0x3, %esi
callq 0x119a0
movq %rax, %rsi
leaq -0x2d0(%rbp), %rdi
callq 0x3160
jmp 0x11031
movq -0x380(%rbp), %rdi
addq $0x60, %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x3040
jmp 0x1104a
leaq -0x228(%rbp), %rdi
movl $0x6, %esi
callq 0x119a0
movq %rax, %rdi
leaq 0x18501(%rip), %rsi     # 0x29566
callq 0x85b0
movb %al, -0x389(%rbp)
jmp 0x11072
movb -0x389(%rbp), %al
testb $0x1, %al
jne 0x11081
jmp 0x11195
movq -0x380(%rbp), %rax
movl $0xffffffff, 0xa4(%rax) # imm = 0xFFFFFFFF
movb $0x1, -0x19(%rbp)
movl $0x1, -0x2d4(%rbp)
jmp 0x1155c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x11612
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x115e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x115dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x115d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x1113f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x289(%rbp), %rdi
callq 0x11940
leaq -0x288(%rbp), %rdi
callq 0x11960
leaq -0x258(%rbp), %rdi
callq 0x11960
jmp 0x115d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x115c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x115b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x115ac
leaq -0x228(%rbp), %rdi
movl $0x6, %esi
callq 0x119a0
movq %rax, %rdi
leaq 0x183c1(%rip), %rsi     # 0x29571
callq 0x85b0
movb %al, -0x38a(%rbp)
jmp 0x111bd
movb -0x38a(%rbp), %al
testb $0x1, %al
jne 0x111cc
jmp 0x11558
leaq -0x228(%rbp), %rdi
movl $0x5, %esi
callq 0x119a0
movq %rax, %rsi
leaq -0x2f8(%rbp), %rdi
callq 0x3160
jmp 0x111ee
leaq -0x228(%rbp), %rdi
movl $0x7, %esi
callq 0x119a0
movq %rax, %rsi
leaq -0x318(%rbp), %rdi
callq 0x3160
jmp 0x11210
leaq -0x228(%rbp), %rdi
movl $0x9, %esi
callq 0x119a0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x8ca0
movl %eax, -0x390(%rbp)
jmp 0x1123a
movl -0x390(%rbp), %eax
movl %eax, -0x31c(%rbp)
leaq -0x228(%rbp), %rdi
movl $0xa, %esi
callq 0x119a0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x8ca0
movl %eax, -0x394(%rbp)
jmp 0x11270
movl -0x394(%rbp), %eax
movl %eax, -0x320(%rbp)
leaq -0x228(%rbp), %rdi
movl $0xb, %esi
callq 0x119a0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x8ca0
movl %eax, -0x398(%rbp)
jmp 0x112a6
movl -0x398(%rbp), %eax
movl %eax, -0x324(%rbp)
leaq -0x228(%rbp), %rdi
movl $0xc, %esi
callq 0x119a0
movq %rax, %rsi
leaq -0x348(%rbp), %rdi
callq 0x3160
jmp 0x112d4
movq -0x380(%rbp), %rdi
subq $-0x80, %rdi
leaq -0x2f8(%rbp), %rsi
callq 0x3040
jmp 0x112ed
movq -0x370(%rbp), %rdi
movl -0x31c(%rbp), %esi
movl -0x320(%rbp), %edx
callq 0xfbf0
movq %rax, -0x3a0(%rbp)
jmp 0x1130e
movq -0x380(%rbp), %rdi
movq -0x3a0(%rbp), %rax
movq %rax, -0x350(%rbp)
addq $0x30, %rdi
leaq -0x350(%rbp), %rsi
callq 0xa120
movq -0x370(%rbp), %rdi
movl -0x324(%rbp), %esi
callq 0xf590
movq -0x370(%rbp), %rdi
movl %eax, %ecx
movq -0x380(%rbp), %rax
movl %ecx, 0x8(%rax)
leaq -0x318(%rbp), %rsi
callq 0xf180
movl %eax, -0x3a4(%rbp)
jmp 0x1136c
movq -0x380(%rbp), %rax
movl -0x3a4(%rbp), %ecx
movl %ecx, 0x4(%rax)
leaq 0x181f5(%rip), %rsi     # 0x29578
leaq -0x348(%rbp), %rdi
callq 0x85b0
movb %al, -0x3a5(%rbp)
jmp 0x11397
movb -0x3a5(%rbp), %al
testb $0x1, %al
jne 0x113a3
jmp 0x11404
movq -0x380(%rbp), %rax
movb $0x1, 0xa0(%rax)
jmp 0x11412
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x1154a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x1153e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x3210
jmp 0x1153e
movq -0x380(%rbp), %rax
movb $0x0, 0xa0(%rax)
leaq 0x18238(%rip), %rsi     # 0x29651
leaq -0x348(%rbp), %rdi
callq 0x85b0
movb %al, -0x3a6(%rbp)
jmp 0x1142d
movb -0x3a6(%rbp), %al
testb $0x1, %al
jne 0x11439
jmp 0x11449
movq -0x380(%rbp), %rax
movb $0x1, 0xa1(%rax)
jmp 0x11457
movq -0x380(%rbp), %rax
movb $0x0, 0xa1(%rax)
leaq -0x228(%rbp), %rdi
callq 0x11980
cmpq $0xe, %rax
jne 0x1150a
leaq 0x181dd(%rip), %rsi     # 0x29651
leaq -0x348(%rbp), %rdi
callq 0x85b0
movb %al, -0x3a7(%rbp)
jmp 0x11488
movb -0x3a7(%rbp), %al
testb $0x1, %al
jne 0x11494
jmp 0x1150a
leaq -0x228(%rbp), %rdi
movl $0xd, %esi
callq 0x119a0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x8ca0
movl %eax, -0x3ac(%rbp)
jmp 0x114be
movq -0x370(%rbp), %rdi
movl -0x3ac(%rbp), %eax
movl %eax, -0x354(%rbp)
movl -0x354(%rbp), %esi
callq 0xfd60
movq %rax, -0x3b8(%rbp)
jmp 0x114e5
movq -0x380(%rbp), %rdi
movq -0x3b8(%rbp), %rax
movq %rax, -0x35c(%rbp)
addq $0x38, %rdi
leaq -0x35c(%rbp), %rsi
callq 0xa120
movb $0x1, -0x19(%rbp)
movl $0x1, -0x2d4(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x3210
leaq -0x318(%rbp), %rdi
callq 0x3210
leaq -0x2f8(%rbp), %rdi
callq 0x3210
jmp 0x1155c
leaq -0x318(%rbp), %rdi
callq 0x3210
leaq -0x2f8(%rbp), %rdi
callq 0x3210
jmp 0x115ac
jmp 0x1155a
ud2
leaq -0x2d0(%rbp), %rdi
callq 0x3210
leaq -0x2b0(%rbp), %rdi
callq 0x3210
leaq -0x228(%rbp), %rdi
callq 0x11650
leaq -0x210(%rbp), %rdi
callq 0x11960
leaq -0x1e0(%rbp), %rdi
callq 0x11960
leaq -0x1a0(%rbp), %rdi
callq 0x31a0
testb $0x1, -0x19(%rbp)
jne 0x11602
jmp 0x115f6
leaq -0x2d0(%rbp), %rdi
callq 0x3210
leaq -0x2b0(%rbp), %rdi
callq 0x3210
leaq -0x228(%rbp), %rdi
callq 0x11650
leaq -0x210(%rbp), %rdi
callq 0x11960
leaq -0x1e0(%rbp), %rdi
callq 0x11960
leaq -0x1a0(%rbp), %rdi
callq 0x31a0
jmp 0x11612
movq -0x380(%rbp), %rdi
callq 0x8560
movq -0x378(%rbp), %rax
addq $0x3c0, %rsp            # imm = 0x3C0
popq %rbp
retq
movq -0x380(%rbp), %rdi
callq 0x8560
movq -0x1a8(%rbp), %rdi
callq 0x34f0
nopw (%rax,%rax)