// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rdi, %r14
xorl %ebx, %ebx
cmpl $0x2, 0x28(%rdi)
setne %bpl
callq 0x5dde
movl 0x54(%r14), %edx
leaq 0xb0(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x5470
leaq 0x29fd(%rip), %rsi      # 0x83b4
movq %r15, %rdi
callq 0x5e13
testb %al, %al
je 0x5a15
callq 0x5dde
movl 0x54(%r14), %esi
movq %rax, %rdi
callq 0x556a
callq 0x381e
movq %rax, %r15
leaq 0x29f6(%rip), %rsi      # 0x83d9
leaq 0x90(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x3c1e
leaq 0x90(%rsp), %rsi
movq %r15, %rdi
callq 0x7060
leaq 0x90(%rsp), %rdi
callq 0x3170
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0x3470
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0xd0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x3b
popq %rdx
callq 0x3500
leaq 0xd0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
pushq $0x3b
popq %rdx
callq 0x3500
movb %bpl, %bl
incl %ebx
movq 0x30(%rsp), %rdi
callq 0x3450
movl %eax, %ebp
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x3450
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 0x4a92
testb %al, %al
je 0x5b45
callq 0x381e
leaq 0x4(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rax, %rdi
movl %ebx, %esi
callq 0x76be
movq 0x48(%r14), %rdi
callq 0x477c
movl 0xc(%rsp), %eax
testl %eax, %eax
setne %cl
cmpl %ebx, %eax
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x5b7a
leaq 0x28f2(%rip), %rsi      # 0x83ee
leaq 0x70(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x3c1e
callq 0x381e
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x33f0
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x7060
leaq 0x50(%rsp), %rdi
callq 0x3170
leaq 0x70(%rsp), %rdi
callq 0x3170
jmp 0x5b7a
callq 0x381e
movq %rax, %rdi
callq 0x7850
callq 0x381e
movq %rax, %rdi
callq 0x7850
movq 0x6472(%rip), %rdi      # 0xbfd8
leaq 0x2894(%rip), %rsi      # 0x8401
callq 0x32c0
movq %rax, %rdi
callq 0x3190
leaq 0x10(%rsp), %rdi
callq 0x3170
leaq 0x30(%rsp), %rdi
callq 0x3170
leaq 0xd0(%rsp), %rdi
callq 0x3210
leaq 0xb0(%rsp), %rdi
callq 0x3170
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3170
jmp 0x5bca
jmp 0x5bf1
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3170
jmp 0x5bf4
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x3170
jmp 0x5c15
jmp 0x5bec
jmp 0x5bec
movq %rax, %rbx
jmp 0x5c15
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3170
leaq 0x30(%rsp), %rdi
callq 0x3170
leaq 0xd0(%rsp), %rdi
callq 0x3210
leaq 0xb0(%rsp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x34d0