// File: syky27[P]TicTacToe/src/DNWindow.cpp
// Function: DNWindow::startLocalGameTwoHumans(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool DNWindow::startLocalGameTwoHumans(string & nameOfPlayerOne, string & nameOfPlayerTwo)
{
    struct winsize w;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
    clearScreen();
    drawHeader();
    middleString("Please enter name of first player: ", w.ws_row / 2);
    
    while(true){
        inputString(nameOfPlayerOne);
        if(nameOfPlayerOne.size() == 0){ clearScreen();  middleString("Name cannot be empty, try again: ", w.ws_row / 2); drawHeader();}
        else{
            DNWindow::getInstance().clearScreen();
            DNWindow::getInstance().drawHeader();
            middleString("Please enter name of second player: ", w.ws_row / 2);
            while(true){    
                inputString(nameOfPlayerTwo);
                if(nameOfPlayerTwo.size() == 0) {clearScreen(); middleString("Name cannot be empty, try again: ", w.ws_row / 2); drawHeader(); }
                else break;
            }
            break;
            
        }
    }
    
   
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
xorl %eax, %eax
movl $0x1, %edi
movl $0x5413, %esi           # imm = 0x5413
leaq -0x20(%rbp), %rdx
callq 0x34f0
movq -0xe0(%rbp), %rdi
callq 0xaf40
movq -0xe0(%rbp), %rdi
callq 0x9b30
leaq -0x41(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x35e0
movq -0xd8(%rbp), %rdx
leaq 0x1437(%rip), %rsi      # 0xc5a4
leaq -0x40(%rbp), %rdi
callq 0x42f0
jmp 0xb178
movq -0xe0(%rbp), %rdi
movzwl -0x20(%rbp), %edx
shrl %edx
leaq -0x40(%rbp), %rsi
callq 0xa260
jmp 0xb190
leaq -0x40(%rbp), %rdi
callq 0x3200
leaq -0x41(%rbp), %rdi
callq 0x3400
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xa7b0
movq -0x10(%rbp), %rdi
callq 0x3250
cmpq $0x0, %rax
jne 0xb297
movq -0xe0(%rbp), %rdi
callq 0xaf40
leaq -0x79(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x35e0
movq -0xe8(%rbp), %rdx
leaq 0x13d9(%rip), %rsi      # 0xc5c8
leaq -0x78(%rbp), %rdi
callq 0x42f0
jmp 0xb1fa
movq -0xe0(%rbp), %rdi
movzwl -0x20(%rbp), %edx
shrl %edx
leaq -0x78(%rbp), %rsi
callq 0xa260
jmp 0xb212
leaq -0x78(%rbp), %rdi
callq 0x3200
leaq -0x79(%rbp), %rdi
callq 0x3400
movq -0xe0(%rbp), %rdi
callq 0x9b30
jmp 0xb423
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xb258
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3200
leaq -0x41(%rbp), %rdi
callq 0x3400
jmp 0xb435
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xb289
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3200
leaq -0x79(%rbp), %rdi
callq 0x3400
jmp 0xb435
callq 0x3a90
movq %rax, %rdi
callq 0xaf40
callq 0x3a90
movq %rax, %rdi
callq 0x9b30
leaq -0xa1(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x35e0
movq -0xf0(%rbp), %rdx
leaq 0x1318(%rip), %rsi      # 0xc5ea
leaq -0xa0(%rbp), %rdi
callq 0x42f0
jmp 0xb2e0
movq -0xe0(%rbp), %rdi
movzwl -0x20(%rbp), %edx
shrl %edx
leaq -0xa0(%rbp), %rsi
callq 0xa260
jmp 0xb2fb
leaq -0xa0(%rbp), %rdi
callq 0x3200
leaq -0xa1(%rbp), %rdi
callq 0x3400
movq -0xe0(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xa7b0
movq -0x18(%rbp), %rdi
callq 0x3250
cmpq $0x0, %rax
jne 0xb41a
movq -0xe0(%rbp), %rdi
callq 0xaf40
leaq -0xc9(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x35e0
movq -0xf8(%rbp), %rdx
leaq 0x1265(%rip), %rsi      # 0xc5c8
leaq -0xc8(%rbp), %rdi
callq 0x42f0
jmp 0xb371
movq -0xe0(%rbp), %rdi
movzwl -0x20(%rbp), %edx
shrl %edx
leaq -0xc8(%rbp), %rsi
callq 0xa260
jmp 0xb38c
leaq -0xc8(%rbp), %rdi
callq 0x3200
leaq -0xc9(%rbp), %rdi
callq 0x3400
movq -0xe0(%rbp), %rdi
callq 0x9b30
jmp 0xb41c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xb3d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x3200
leaq -0xa1(%rbp), %rdi
callq 0x3400
jmp 0xb435
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xb40c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3200
leaq -0xc9(%rbp), %rdi
callq 0x3400
jmp 0xb435
jmp 0xb421
jmp 0xb313
jmp 0xb428
jmp 0xb1a2
xorl %eax, %eax
andb $0x1, %al
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x35d0
nop