// File: MatthewZMD[P]TetrisDual/game.cc
// Function: Game::drop(std::istream&, int)
void Game::drop(std::istream & in, int n) {
    int numberOfRowsRemoved = 0;
    if (playerTurn == 0) {
        if(n > 1){
            board1->setCountD(n - 1);
        } else if (board1->getCountD() > 0) {
            board1->setCountD(board1->getCountD() - 1);
        }

        numberOfRowsRemoved = board1->drop();

        // special actions
        if (numberOfRowsRemoved >= 2) {
            execAction(in);
        }

        if (board1->isTurnOver()) {
            board1->setTurnOver();
            recover();
            switchTurn();
        }
    }
    else if (playerTurn == 1) {
        if(n > 1){
            board2->setCountD(n - 1);
        } else if (board2->getCountD() > 0){
            board2->setCountD(board2->getCountD() - 1);
        }

        numberOfRowsRemoved = board2->drop();

        // special actions
        if (numberOfRowsRemoved >= 2) {
            execAction(in);
        }

        if (board2->isTurnOver()) {
            board2->setTurnOver();
            recover();
            switchTurn();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x0, 0x44(%rax)
jne 0x1b4e8
cmpl $0x1, -0x14(%rbp)
jle 0x1b42f
movq -0x20(%rbp), %rdi
callq 0xc1e0
movq %rax, %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
movq (%rdi), %rax
callq *0xa0(%rax)
jmp 0x1b47f
movq -0x20(%rbp), %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x98(%rax)
cmpl $0x0, %eax
jle 0x1b47d
movq -0x20(%rbp), %rdi
callq 0xc1e0
movq -0x20(%rbp), %rdi
movq %rax, -0x28(%rbp)
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x98(%rax)
movq -0x28(%rbp), %rdi
movl %eax, %esi
subl $0x1, %esi
movq (%rdi), %rax
callq *0xa0(%rax)
jmp 0x1b47f
movq -0x20(%rbp), %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x2, -0x18(%rbp)
jl 0x1b4a7
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1ae20
movq -0x20(%rbp), %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x70(%rax)
testb $0x1, %al
jne 0x1b4bf
jmp 0x1b4e3
movq -0x20(%rbp), %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x78(%rax)
movq -0x20(%rbp), %rdi
callq 0x1ac70
movq -0x20(%rbp), %rdi
callq 0x1b110
jmp 0x1b5ed
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x1b5eb
cmpl $0x1, -0x14(%rbp)
jle 0x1b51d
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xc1e0
movq %rax, %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
movq (%rdi), %rax
callq *0xa0(%rax)
jmp 0x1b579
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x98(%rax)
cmpl $0x0, %eax
jle 0x1b577
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xc1e0
movq -0x20(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x10, %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x98(%rax)
movq -0x30(%rbp), %rdi
movl %eax, %esi
subl $0x1, %esi
movq (%rdi), %rax
callq *0xa0(%rax)
jmp 0x1b579
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x2, -0x18(%rbp)
jl 0x1b5a5
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1ae20
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x70(%rax)
testb $0x1, %al
jne 0x1b5c1
jmp 0x1b5e9
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xc1e0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x78(%rax)
movq -0x20(%rbp), %rdi
callq 0x1ac70
movq -0x20(%rbp), %rdi
callq 0x1b110
jmp 0x1b5eb
jmp 0x1b5ed
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)