// File: /workspace/github_cpp_makefile_star2_O1/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 0x6e0c
movl 0x54(%r14), %edx
leaq 0xb0(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x60d2
leaq 0x2bc7(%rip), %rsi      # 0x93b4
movq %r15, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x6867
callq 0x6e0c
movl 0x54(%r14), %esi
movq %rax, %rdi
callq 0x6224
callq 0x39ee
movq %rax, %r15
leaq 0xa0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2bb3(%rip), %rsi      # 0x93d9
leaq 0x2bc0(%rip), %rdx      # 0x93ed
leaq 0x90(%rsp), %rdi
callq 0x4048
leaq 0x90(%rsp), %rsi
movq %r15, %rdi
callq 0x82c0
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x6867
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 0x53c6
testb %al, %al
je 0x69d9
callq 0x39ee
leaq 0x4(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rax, %rdi
movl %ebx, %esi
callq 0x8be6
movq 0x48(%r14), %rdi
callq 0x4f8e
movl 0xc(%rsp), %eax
testl %eax, %eax
setne %cl
cmpl %ebx, %eax
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x6a39
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2a8b(%rip), %rsi      # 0x93ee
leaq 0x2a96(%rip), %rdx      # 0x9400
leaq 0x10(%rsp), %rdi
callq 0x4048
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 0x3fb8
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x82c0
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x69c0
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x6a39
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6a39
callq 0x39ee
movq %rax, %rdi
callq 0x8dac
callq 0x39ee
movq %rax, %rdi
callq 0x8dac
movq 0x65de(%rip), %rbx      # 0xcfd8
leaq 0x2a00(%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 0x65ac(%rip), %rdi      # 0xcfd8
callq 0x3030
movq %rax, %rdi
callq 0x31e0
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x6a50
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x6a6a
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x6537(%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 0x6aac
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 0x6b07
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6b07
jmp 0x6b27
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x6b7c
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6b7c
jmp 0x6b22
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x6b2a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32f0
jmp 0x6b2a
jmp 0x6b22
movq %rax, %rbx
jmp 0x6b7c
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x6b41
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x6b5b
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x6446(%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 0x6b9d
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x34b0
nop