// File: MatthewZMD[P]TetrisDual/concreteboard.cc
// Function: ConcreteBoard::down(int)
bool ConcreteBoard::down(int time){
    while (time != 0) {
        bool exist = false;
        for (auto &i : thisBlock->cells){
            for (auto &j : thisBlock->cells){
                if (i->pos.row + 1 == j->pos.row && i->pos.col == j->pos.col)
                    {
                        exist = true;
                    }
            }
            if (!exist){
                if (i->pos.row == 17 || !allCells[i->pos.row + 1][i->pos.col].isEmpty())
                    {
                        return false;
                    }
            }
            exist = false;
        }
        CellType curType = thisBlock->cells[0]->type;
        int curLevel = thisBlock->cells[0]->blockLevel;
        std::vector<Cell*> temp;
        for (auto &i : thisBlock->cells){
            temp.emplace_back(&(allCells[i->pos.row + 1][i->pos.col]));
            i->restore();
        }
        thisBlock = std::make_shared<Block>(curType, curLevel, temp);
        thisBlock->recaliBtmLft();
        --time;
        notifyObservers();
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x12469
movq -0xc8(%rbp), %rdi
movb $0x0, -0x15(%rbp)
addq $0x48, %rdi
callq 0x13e70
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd190
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd1c0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xd1f0
testb $0x1, %al
jne 0x1218f
jmp 0x12299
leaq -0x28(%rbp), %rdi
callq 0xd230
movq -0xc8(%rbp), %rdi
movq %rax, -0x38(%rbp)
addq $0x48, %rdi
callq 0x13e70
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0xd190
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0xd1c0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xd1f0
testb $0x1, %al
jne 0x121dd
jmp 0x1222a
leaq -0x48(%rbp), %rdi
callq 0xd230
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl 0x58(%rax), %eax
addl $0x1, %eax
movq -0x58(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x58(%rcx), %eax
jne 0x1221d
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl 0x5c(%rax), %eax
movq -0x58(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x5c(%rcx), %eax
jne 0x1221d
movb $0x1, -0x15(%rbp)
jmp 0x1221f
leaq -0x48(%rbp), %rdi
callq 0xd2d0
jmp 0x121ca
testb $0x1, -0x15(%rbp)
jne 0x12287
movq -0x38(%rbp), %rax
movq (%rax), %rax
cmpl $0x11, 0x58(%rax)
je 0x1227c
movq -0xc8(%rbp), %rdi
addq $0x78, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl 0x58(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x13d50
movq %rax, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq 0x5c(%rax), %rsi
callq 0x13d70
movq %rax, %rdi
callq 0xffc0
testb $0x1, %al
jne 0x12285
movb $0x0, -0x1(%rbp)
jmp 0x1246d
jmp 0x12287
movb $0x0, -0x15(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xd2d0
jmp 0x12179
movq -0xc8(%rbp), %rdi
addq $0x48, %rdi
callq 0x13e70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xd480
movq -0xc8(%rbp), %rdi
movq (%rax), %rax
movl 0x64(%rax), %eax
movl %eax, -0x5c(%rbp)
addq $0x48, %rdi
callq 0x13e70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xd480
movq (%rax), %rax
movl 0x60(%rax), %eax
movl %eax, -0x60(%rbp)
leaq -0x78(%rbp), %rdi
callq 0xd170
movq -0xc8(%rbp), %rdi
addq $0x48, %rdi
callq 0x13e70
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0xd190
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
callq 0xd1c0
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xd1f0
testb $0x1, %al
jne 0x1233c
jmp 0x123e4
leaq -0x88(%rbp), %rdi
callq 0xd230
movq -0xc8(%rbp), %rdi
movq %rax, -0x98(%rbp)
addq $0x78, %rdi
movq -0x98(%rbp), %rax
movq (%rax), %rax
movl 0x58(%rax), %eax
incl %eax
movslq %eax, %rsi
callq 0x13d50
movq %rax, %rdi
movq -0x98(%rbp), %rax
movq (%rax), %rax
movslq 0x5c(%rax), %rsi
callq 0x13d70
movq %rax, -0xa0(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x13e90
jmp 0x123a0
movq -0x98(%rbp), %rax
movq (%rax), %rdi
callq 0xfce0
jmp 0x123b1
jmp 0x123b3
leaq -0x88(%rbp), %rdi
callq 0xd2d0
jmp 0x12320
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x78(%rbp), %rdi
callq 0xd2f0
jmp 0x1247b
leaq -0xc0(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x78(%rbp), %rcx
callq 0x13f10
jmp 0x123fe
movq -0xc8(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0xd0(%rbp)
leaq -0xc0(%rbp), %rsi
movq %rsi, -0xd8(%rbp)
callq 0x13f90
movq -0xd8(%rbp), %rdi
callq 0x13e50
movq -0xd0(%rbp), %rdi
callq 0x13e70
movq %rax, %rdi
callq 0xcd40
jmp 0x12445
movq -0xc8(%rbp), %rdi
movl -0x14(%rbp), %eax
decl %eax
movl %eax, -0x14(%rbp)
callq 0x25430
jmp 0x1245b
leaq -0x78(%rbp), %rdi
callq 0xd2f0
jmp 0x1213d
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x6630
nopw (%rax,%rax)