// File: /workspace/github_cpp_makefile_star2_O3/Leeingnyo[P]newPuyoC/game.cpp
// Function: VSGame::GameLoop()
void VSGame::GameLoop() {
    while (!gameover) {
        if (kbhit()) {
            int input = getch();
            bool special = false;
            if (input == 224) {
                input = getch();
                special = true;
            }

            if (!my_board->IsBusy()) {
                if (special) { }
                else {
                    if (input == 'd') {
                        my_board->MoveLeft();
                    }
                    if (input == 'g') {
                        my_board->MoveRight();
                    }
                    if (input == 'f') {
                        my_board->MoveDown();
                    }
                    if (input == 'z') { // rotate
                        my_board->RotateCCW();
                    }
                }
            }
            if (!other_board->IsBusy()) {
                if (special) { }
                else {
                    if (input == 'l') {
                        other_board->MoveLeft();
                    }
                    if (input == '\'') {
                        other_board->MoveRight();
                    }
                    if (input == ';') {
                        other_board->MoveDown();
                    }
                    if (input == 'm') {
                        other_board->RotateCCW();
                    }
                }
            }
        }
        // input
        
        my_board->Update();
        my_board->UpdatePlayerInformation(my_info);
        if (my_board->IsNeedNext()) {
            my_board->SetNextBiPuyo(my_next_bipuyo);
            my_next_bipuyo = my_bipuyo_generator->GenerateBipuyo();
        }
        other_board->TakeObstacles(my_board->SendObstacles());
        // effect please
        other_board->Update();
        other_board->UpdatePlayerInformation(other_info);
        if (other_board->IsNeedNext()) {
            other_board->SetNextBiPuyo(other_next_bipuyo);
            other_next_bipuyo = other_bipuyo_generator->GenerateBipuyo();
        }
        my_board->TakeObstacles(other_board->SendObstacles());
        gameover = my_board->IsGameOver() || other_board->IsGameOver();
        // process
        
        Draw();
        Console::Sleep(16);
    }
}

// Assembly:
cmpb $0x0, 0x8(%rdi)
jne 0x4eae
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
leaq 0x78(%rdi), %r15
leaq -0x40(%rbp), %r12
callq 0x3c8c
testb %al, %al
je 0x4c15
callq 0x3d57
cmpl $0xe0, %eax
jne 0x4bf6
callq 0x3d57
jmp 0x4c15
movl %eax, %r13d
movq 0x20(%rbx), %rdi
cmpl $0x0, 0x68(%rdi)
je 0x4dce
movq 0x60(%rbx), %rdi
cmpl $0x0, 0x68(%rdi)
je 0x4e0b
movq 0x20(%rbx), %rdi
callq 0x71c0
movq 0x20(%rbx), %r13
movl 0x6c(%r13), %eax
addl %eax, 0x40(%rbx)
movl $0x0, 0x6c(%r13)
movl 0x70(%r13), %eax
movl %eax, 0x44(%rbx)
cmpl %eax, 0x48(%rbx)
jge 0x4c40
movl %eax, 0x48(%rbx)
movl 0x74(%r13), %eax
movl %eax, 0x4c(%rbx)
movl 0x68(%r13), %eax
cmpl $0x4, %eax
jne 0x4cb9
movq 0x30(%rbx), %rax
movq %rax, 0x50(%r13)
leaq 0x58(%r13), %rdi
movq %r14, %rsi
callq 0x7fc8
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x60(%r13)
movl $0x0, 0x68(%r13)
movq 0x10(%rbx), %rsi
movq %r12, %rdi
callq 0x6ee8
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq 0x38(%rbx), %rdi
movups %xmm0, 0x30(%rbx)
testq %rdi, %rdi
je 0x4cb1
callq 0x7f4e
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x4cb1
callq 0x7f4e
movq 0x20(%rbx), %r13
movl 0x68(%r13), %eax
movq 0x60(%rbx), %rdi
xorl %ecx, %ecx
testl %eax, %eax
jne 0x4ccf
movl 0x78(%r13), %ecx
movl $0x0, 0x78(%r13)
addl %ecx, 0x74(%rdi)
callq 0x71c0
movq 0x60(%rbx), %r13
movl 0x6c(%r13), %eax
addl %eax, 0x80(%rbx)
movl $0x0, 0x6c(%r13)
movl 0x70(%r13), %eax
movl %eax, 0x84(%rbx)
cmpl %eax, 0x88(%rbx)
jge 0x4d05
movl %eax, 0x88(%rbx)
movl 0x74(%r13), %eax
movl %eax, 0x8c(%rbx)
movl 0x68(%r13), %eax
cmpl $0x4, %eax
jne 0x4d81
movq 0x70(%rbx), %rax
movq %rax, 0x50(%r13)
leaq 0x58(%r13), %rdi
movq %r15, %rsi
callq 0x7fc8
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x60(%r13)
movl $0x0, 0x68(%r13)
movq 0x50(%rbx), %rsi
movq %r12, %rdi
callq 0x6ee8
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq 0x78(%rbx), %rdi
movups %xmm0, 0x70(%rbx)
testq %rdi, %rdi
je 0x4d79
callq 0x7f4e
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x4d79
callq 0x7f4e
movq 0x60(%rbx), %r13
movl 0x68(%r13), %eax
movq 0x20(%rbx), %rcx
xorl %edx, %edx
testl %eax, %eax
jne 0x4d97
movl 0x78(%r13), %edx
movl $0x0, 0x78(%r13)
addl %edx, 0x74(%rcx)
cmpl $0x6, 0x68(%rcx)
sete %cl
cmpl $0x6, %eax
sete %al
orb %cl, %al
movb %al, 0x8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movl $0x10, %edi
callq 0x3dc8
cmpb $0x1, 0x8(%rbx)
jne 0x4bda
jmp 0x4ea0
cmpl $0x66, %r13d
jg 0x4e44
cmpl $0x64, %r13d
je 0x4e78
cmpl $0x66, %r13d
jne 0x4c07
cmpl $0x0, 0x98(%rdi)
jne 0x4c07
movl $0x1, 0x98(%rdi)
addl $0x28, 0x80(%rdi)
jmp 0x4c07
cmpl $0x6b, %r13d
jg 0x4e5e
cmpl $0x27, %r13d
je 0x4e82
cmpl $0x3b, %r13d
jne 0x4c15
cmpl $0x0, 0x98(%rdi)
jne 0x4c15
movl $0x1, 0x98(%rdi)
addl $0x28, 0x80(%rdi)
jmp 0x4c15
cmpl $0x67, %r13d
je 0x4e8c
cmpl $0x7a, %r13d
jne 0x4c07
callq 0x7086
jmp 0x4c07
cmpl $0x6d, %r13d
je 0x4e96
cmpl $0x6c, %r13d
jne 0x4c15
callq 0x6f66
jmp 0x4c15
callq 0x6f66
jmp 0x4c07
callq 0x6ff8
jmp 0x4c15
callq 0x6ff8
jmp 0x4c07
callq 0x7086
jmp 0x4c15
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop