// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rdx, %r14
movq %rdi, %rbx
callq 0x900c
leaq -0x320(%rbp), %rdi
pushq $0x8
popq %rdx
movq %r14, %rsi
callq 0x3380
leaq -0x170(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x8f14
leaq -0x198(%rbp), %r14
andq $0x0, -0x8(%r14)
leaq -0x188(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
movb %cl, 0x10(%rax)
leaq -0x140(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x8f54
leaq -0x110(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x8f54
leaq -0x40(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0x110(%rbp), %rdx
leaq -0x80(%rbp), %rcx
callq 0x8f80
leaq -0x108(%rbp), %rdi
callq 0x3120
leaq -0x138(%rbp), %rdi
callq 0x3120
movq -0x40(%rbp), %rsi
addq $0x20, %rsi
leaq -0x80(%rbp), %rdi
callq 0x32c0
leaq 0x40(%rbx), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3160
movq -0x40(%rbp), %rsi
addq $0x60, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x32c0
leaq 0x60(%rbx), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x3160
movl $0xc0, %r15d
movq -0x40(%rbp), %rdi
addq %r15, %rdi
leaq 0x991e(%rip), %rsi      # 0x12556
callq 0x6261
testb %al, %al
je 0x8c4d
orl $-0x1, 0xa4(%rbx)
jmp 0x8dcc
addq -0x40(%rbp), %r15
leaq 0x9909(%rip), %rsi      # 0x12561
movq %r15, %rdi
callq 0x6261
movl $0xa0, %esi
addq -0x40(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x32c0
movl $0xe0, %esi
addq -0x40(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x32c0
movl $0x120, %edi            # imm = 0x120
addq -0x40(%rbp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x64cc
movl %eax, %r15d
movl $0x140, %edi            # imm = 0x140
addq -0x40(%rbp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x64cc
movl %eax, %r12d
movl $0x160, %edi            # imm = 0x160
addq -0x40(%rbp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x64cc
movl %eax, %r13d
movl $0x180, %esi            # imm = 0x180
addq -0x40(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x32c0
leaq 0x80(%rbx), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3160
pushq $0x48
popq %rax
subl %r12d, %eax
addl $0x48, %r15d
movl %eax, 0x30(%rbx)
movl %r15d, 0x34(%rbx)
cmpl $0x5a, %r13d
je 0x8d22
cmpl $0x10e, %r13d           # imm = 0x10E
je 0x8d1e
cmpl $0xb4, %r13d
jne 0x8d27
pushq $0x2
jmp 0x8d24
pushq $0x3
jmp 0x8d24
pushq $0x1
popq %rax
jmp 0x8d29
xorl %eax, %eax
movl %eax, 0x8(%rbx)
leaq -0xa0(%rbp), %rsi
callq 0x7b20
movl %eax, 0x4(%rbx)
leaq 0x9826(%rip), %rsi      # 0x12568
leaq -0x60(%rbp), %r15
movq %r15, %rdi
callq 0x6261
movb %al, 0xa0(%rbx)
leaq 0x997a(%rip), %rsi      # 0x126d5
movq %r15, %rdi
callq 0x6261
movb %al, 0xa1(%rbx)
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
cmpq $0x1c0, %rax            # imm = 0x1C0
jne 0x8dab
leaq 0x9955(%rip), %rsi      # 0x126d5
leaq -0x60(%rbp), %rdi
callq 0x6261
testb %al, %al
je 0x8dab
movl $0x1a0, %edi            # imm = 0x1A0
addq -0x40(%rbp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x64cc
movl %eax, %esi
callq 0x8266
movq %rax, 0x38(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x3120
leaq -0xa0(%rbp), %rdi
callq 0x3120
leaq -0xc0(%rbp), %rdi
callq 0x3120
leaq -0xe0(%rbp), %rdi
callq 0x3120
leaq -0x80(%rbp), %rdi
callq 0x3120
leaq -0x40(%rbp), %rdi
callq 0x8ee8
movq %r14, %rdi
callq 0x3120
leaq -0x168(%rbp), %rdi
callq 0x3120
leaq -0x320(%rbp), %rdi
callq 0x3130
movq %rbx, %rax
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8e21
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x3120
jmp 0x8e38
jmp 0x8e35
jmp 0x8e35
jmp 0x8e35
movq %rax, %r15
leaq -0xa0(%rbp), %rdi
callq 0x3120
leaq -0xc0(%rbp), %rdi
callq 0x3120
jmp 0x8e5c
movq %rax, %r15
jmp 0x8e44
jmp 0x8e59
movq %rax, %r15
leaq -0xe0(%rbp), %rdi
callq 0x3120
jmp 0x8e6f
jmp 0x8e6c
movq %rax, %r15
leaq -0x80(%rbp), %rdi
callq 0x3120
leaq -0x40(%rbp), %rdi
callq 0x8ee8
jmp 0x8ead
movq %rax, %r15
jmp 0x8e78
movq %rax, %r15
leaq -0x108(%rbp), %rdi
callq 0x3120
jmp 0x8e9c
movq %rax, %r15
leaq -0x138(%rbp), %rdi
callq 0x3120
jmp 0x8ead
movq %rax, %r15
movq %r14, %rdi
callq 0x3120
leaq -0x168(%rbp), %rdi
callq 0x3120
leaq -0x320(%rbp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x6228
movq %r15, %rdi
callq 0x33c0
movq %rax, %r15
jmp 0x8ec1
movq %rax, %r15
jmp 0x8ecd
nop