// File: /workspace/github_cpp_makefile_star2_O3/syky27[P]TicTacToe/src/DNRemoteHumanPlayer.cpp
// Function: DNRemoteHumanPlayer::processOponentsTurn()
void DNRemoteHumanPlayer::processOponentsTurn()
{
    
    DNCellState opSymbol, state;
    if (this->symbol == CROSS) opSymbol = CIRCLE;
    else opSymbol = CROSS;

    string op = DNNetworkConnection::getInstance().receiveData(this->clientSocket);
    if (op == "QUIT") {
        //close connection;
        DNNetworkConnection::getInstance().closeConnection(this->clientSocket);
        DNWindow::getInstance().terminateWithErrorMessage("OPPONNET QUITED GAME");
    }

    
    stringstream tmp(op);
    string s_y, s_x;
    int y,x;
    getline(tmp, s_x, ';');
    getline(tmp, s_y, ';');
    y = atoi(s_y.c_str());
    x = atoi(s_x.c_str());


    if (this->game_map->recordMove(opSymbol, x - 0, y - 3, state)) {
        DNWindow::getInstance().drawSymbolBetter(opSymbol, x, y);
        this->game_map->debugToFile();
     if (state != EMPTY) {
            if (state == opSymbol) {
                string op_winner("Opponent is winner");
                DNWindow::getInstance().terminateWithErrorMessage(op_winner);
            }
            
        }
    }
    else {
        DNWindow::getInstance().sound();
        DNWindow::getInstance().sound();
        cout << "FATATTATATATATLLL ERRRROOORRR" <<endl;
        
    }



    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rdi, %r14
xorl %ebx, %ebx
cmpl $0x2, 0x28(%rdi)
setne %bpl
callq 0x6dda
movl 0x54(%r14), %edx
leaq 0xb0(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x60e2
leaq 0x2bf9(%rip), %rsi      # 0x93b4
movq %r15, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x6835
callq 0x6dda
movl 0x54(%r14), %esi
movq %rax, %rdi
callq 0x6234
callq 0x39ee
movq %rax, %r15
leaq 0xa0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2be5(%rip), %rsi      # 0x93d9
leaq 0x2bf2(%rip), %rdx      # 0x93ed
leaq 0x90(%rsp), %rdi
callq 0x404c
leaq 0x90(%rsp), %rsi
movq %r15, %rdi
callq 0x82b0
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x6835
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x32f0
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
movl $0x18, %edx
callq 0x3450
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0xd0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0x3b, %edx
callq 0x34e0
leaq 0xd0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movl $0x3b, %edx
callq 0x34e0
movb %bpl, %bl
incl %ebx
movq 0x70(%rsp), %rdi
callq 0x3430
movl %eax, %ebp
movl %eax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
callq 0x3430
movl %eax, 0x4(%rsp)
movq 0x48(%r14), %rdi
addl $-0x3, %ebp
leaq 0xc(%rsp), %r8
movl %ebx, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0x53ce
testb %al, %al
je 0x69a7
callq 0x39ee
leaq 0x4(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rax, %rdi
movl %ebx, %esi
callq 0x8bd6
movq 0x48(%r14), %rdi
callq 0x4f82
movl 0xc(%rsp), %eax
testl %eax, %eax
setne %cl
cmpl %ebx, %eax
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x6a07
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2abd(%rip), %rsi      # 0x93ee
leaq 0x2ac8(%rip), %rdx      # 0x9400
leaq 0x10(%rsp), %rdi
callq 0x404c
callq 0x39ee
movq %rax, %rbx
leaq 0x40(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x3fb6
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x82b0
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x698e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x6a07
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6a07
callq 0x39ee
movq %rax, %rdi
callq 0x8d9c
callq 0x39ee
movq %rax, %rdi
callq 0x8d9c
movq 0x6610(%rip), %rbx      # 0xcfd8
leaq 0x2a32(%rip), %rsi      # 0x9401
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x3360
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x32c0
movsbl %al, %esi
movq 0x65de(%rip), %rdi      # 0xcfd8
callq 0x3030
movq %rax, %rdi
callq 0x31e0
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x6a1e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x6a38
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x6569(%rip), %rsi      # 0xcfa8
leaq 0xd0(%rsp), %rdi
callq 0x3220
leaq 0x150(%rsp), %rdi
callq 0x3130
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6a7a
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x32f0
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x6ad5
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6ad5
jmp 0x6af5
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x6b4a
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6b4a
jmp 0x6af0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x6af8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6af8
jmp 0x6af0
movq %rax, %rbx
jmp 0x6b4a
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x6b0f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x6b29
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x6478(%rip), %rsi      # 0xcfa8
leaq 0xd0(%rsp), %rdi
callq 0x3220
leaq 0x150(%rsp), %rdi
callq 0x3130
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6b6b
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x34b0
nop