// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x40(%rdi), %r15
leaq 0x30(%rdi), %rax
movq %rax, -0x38(%rbp)
leaq 0x80(%rdi), %r13
leaq 0x70(%rdi), %rax
movq %rax, -0x30(%rbp)
leaq -0x48(%rbp), %r12
cmpb $0x0, 0x8(%rbx)
jne 0x4853
callq 0x3a7c
testb %al, %al
je 0x475c
movq %r13, %r12
movq %r15, %r13
callq 0x3b49
movl %eax, %r15d
movl %eax, %r14d
cmpl $0xe0, %eax
jne 0x469e
callq 0x3b49
movl %eax, %r14d
cmpl $0xe0, %r15d
je 0x46f8
movq 0x20(%rbx), %rdi
cmpl $0x0, 0x68(%rdi)
jne 0x46f8
cmpl $0x7a, %r14d
je 0x46f3
cmpl $0x66, %r14d
je 0x46d0
cmpl $0x67, %r14d
je 0x46ec
cmpl $0x64, %r14d
jne 0x46f8
callq 0x5d4e
jmp 0x46f8
cmpl $0x0, 0x98(%rdi)
jne 0x46f8
movl $0x1, 0x98(%rdi)
addl $0x28, 0x80(%rdi)
jmp 0x46f8
callq 0x5de0
jmp 0x46f8
callq 0x5e6e
cmpl $0xe0, %r15d
movq %r13, %r15
movq %r12, %r13
leaq -0x48(%rbp), %r12
je 0x475c
movq 0x60(%rbx), %rdi
cmpl $0x0, 0x68(%rdi)
jne 0x475c
cmpl $0x27, %r14d
je 0x4757
cmpl $0x3b, %r14d
je 0x4734
cmpl $0x6d, %r14d
je 0x4750
cmpl $0x6c, %r14d
jne 0x475c
callq 0x5d4e
jmp 0x475c
cmpl $0x0, 0x98(%rdi)
jne 0x475c
movl $0x1, 0x98(%rdi)
addl $0x28, 0x80(%rdi)
jmp 0x475c
callq 0x5e6e
jmp 0x475c
callq 0x5de0
movq 0x20(%rbx), %rdi
callq 0x5f58
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x5f96
movq 0x20(%rbx), %rdi
movl 0x68(%rdi), %ecx
cmpl $0x4, %ecx
jne 0x47b0
movq -0x38(%rbp), %r14
movq %r14, %rsi
callq 0x5cd4
movq 0x10(%rbx), %rsi
movq %r12, %rdi
callq 0x5d00
movq %r14, %rdi
movq %r12, %rsi
callq 0x81ec
leaq -0x40(%rbp), %rdi
callq 0x6896
movq 0x20(%rbx), %rdi
movl 0x68(%rdi), %ecx
movq 0x60(%rbx), %rax
xorl %edx, %edx
testl %ecx, %ecx
jne 0x47c1
movl 0x78(%rdi), %edx
andl $0x0, 0x78(%rdi)
addl %edx, 0x74(%rax)
movq %rax, %rdi
callq 0x5f58
movq 0x60(%rbx), %rdi
movq %r13, %rsi
callq 0x5f96
movq 0x60(%rbx), %rdi
movl 0x68(%rdi), %eax
cmpl $0x4, %eax
jne 0x4817
movq -0x30(%rbp), %r14
movq %r14, %rsi
callq 0x5cd4
movq 0x50(%rbx), %rsi
movq %r12, %rdi
callq 0x5d00
movq %r14, %rdi
movq %r12, %rsi
callq 0x81ec
leaq -0x40(%rbp), %rdi
callq 0x6896
movq 0x60(%rbx), %rdi
movl 0x68(%rdi), %eax
movq 0x20(%rbx), %rcx
xorl %edx, %edx
testl %eax, %eax
jne 0x4828
movl 0x78(%rdi), %edx
andl $0x0, 0x78(%rdi)
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)
pushq $0x10
popq %rdi
callq 0x3bba
jmp 0x4667
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq