// File: /workspace/github_cpp_makefile_star2_O1/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 0x4efc
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %rax
movq %rax, -0x50(%rbp)
leaq 0x78(%rdi), %rax
movq %rax, -0x48(%rbp)
movabsq $0x100000002, %r13      # imm = 0x100000002
leaq -0x40(%rbp), %r15
callq 0x3c94
testb %al, %al
je 0x4d45
movq %r13, %r14
callq 0x3d5f
movl %eax, %r13d
movl %eax, %r12d
cmpl $0xe0, %eax
jne 0x4c82
callq 0x3d5f
movl %eax, %r12d
cmpl $0xe0, %r13d
je 0x4ce2
movq 0x20(%rbx), %rdi
cmpl $0x0, 0x68(%rdi)
jne 0x4ce2
cmpl $0x66, %r12d
jg 0x4cc3
cmpl $0x64, %r12d
je 0x4cd6
cmpl $0x66, %r12d
jne 0x4ce2
cmpl $0x0, 0x98(%rdi)
jne 0x4ce2
movl $0x1, 0x98(%rdi)
addl $0x28, 0x80(%rdi)
jmp 0x4ce2
cmpl $0x67, %r12d
je 0x4cdd
cmpl $0x7a, %r12d
jne 0x4ce2
callq 0x7098
jmp 0x4ce2
callq 0x6f78
jmp 0x4ce2
callq 0x700a
cmpl $0xe0, %r13d
movq %r14, %r13
je 0x4d45
movq 0x60(%rbx), %rdi
cmpl $0x0, 0x68(%rdi)
jne 0x4d45
cmpl $0x6b, %r12d
jg 0x4d26
cmpl $0x27, %r12d
je 0x4d39
cmpl $0x3b, %r12d
jne 0x4d45
cmpl $0x0, 0x98(%rdi)
jne 0x4d45
movl $0x1, 0x98(%rdi)
addl $0x28, 0x80(%rdi)
jmp 0x4d45
cmpl $0x6d, %r12d
je 0x4d40
cmpl $0x6c, %r12d
jne 0x4d45
callq 0x6f78
jmp 0x4d45
callq 0x700a
jmp 0x4d45
callq 0x7098
movq 0x20(%rbx), %rdi
callq 0x7228
movq 0x20(%rbx), %r12
movl 0x6c(%r12), %eax
addl %eax, 0x40(%rbx)
movl $0x0, 0x6c(%r12)
movl 0x70(%r12), %eax
movl %eax, 0x44(%rbx)
cmpl %eax, 0x48(%rbx)
jge 0x4d73
movl %eax, 0x48(%rbx)
movl 0x74(%r12), %eax
movl %eax, 0x4c(%rbx)
cmpl $0x4, 0x68(%r12)
jne 0x4ddf
movq 0x30(%rbx), %rax
movq %rax, 0x50(%r12)
leaq 0x58(%r12), %rdi
movq -0x50(%rbp), %rsi
callq 0x8026
movq %r13, 0x60(%r12)
movl $0x0, 0x68(%r12)
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x6ef2
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq 0x38(%rbx), %rdi
movups %xmm0, 0x30(%rbx)
testq %rdi, %rdi
je 0x4dd1
callq 0x7fac
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x4ddf
callq 0x7fac
movq 0x20(%rbx), %rcx
movq 0x60(%rbx), %rdi
xorl %eax, %eax
cmpl $0x0, 0x68(%rcx)
jne 0x4df9
movl 0x78(%rcx), %eax
movl $0x0, 0x78(%rcx)
addl %eax, 0x74(%rdi)
callq 0x7228
movq 0x60(%rbx), %r12
movl 0x6c(%r12), %eax
addl %eax, 0x80(%rbx)
movl $0x0, 0x6c(%r12)
movl 0x70(%r12), %eax
movl %eax, 0x84(%rbx)
cmpl %eax, 0x88(%rbx)
jge 0x4e32
movl %eax, 0x88(%rbx)
movl 0x74(%r12), %eax
movl %eax, 0x8c(%rbx)
cmpl $0x4, 0x68(%r12)
jne 0x4ea1
movq 0x70(%rbx), %rax
movq %rax, 0x50(%r12)
leaq 0x58(%r12), %rdi
movq -0x48(%rbp), %rsi
callq 0x8026
movq %r13, 0x60(%r12)
movl $0x0, 0x68(%r12)
movq 0x50(%rbx), %rsi
movq %r15, %rdi
callq 0x6ef2
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq 0x78(%rbx), %rdi
movups %xmm0, 0x70(%rbx)
testq %rdi, %rdi
je 0x4e93
callq 0x7fac
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x4ea1
callq 0x7fac
movq 0x20(%rbx), %rax
movq 0x60(%rbx), %rsi
movl 0x68(%rsi), %ecx
xorl %edx, %edx
testl %ecx, %ecx
jne 0x4ebc
movl 0x78(%rsi), %edx
movl $0x0, 0x78(%rsi)
addl %edx, 0x74(%rax)
cmpl $0x6, 0x68(%rax)
sete %al
cmpl $0x6, %ecx
sete %cl
orb %al, %cl
movb %cl, 0x8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movl $0x10, %edi
callq 0x3dd0
cmpb $0x1, 0x8(%rbx)
jne 0x4c58
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop