// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
leaq 0x10(%rsp), %r12
leaq 0x20(%rsp), %r15
movl %esi, (%rsp)
movl %esi, %eax
subl $0x1, %eax
movl %eax, 0x4(%rsp)
jb 0x8da6
movq (%r14), %rax
movq (%rax), %rbp
movq 0x8(%rax), %r13
cmpq %r13, %rbp
je 0x8ce8
movq (%r14), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
xorl %ecx, %ecx
cmpq %rdx, %rax
je 0x8ca6
movq (%rbp), %rsi
movl 0x58(%rsi), %r8d
incl %r8d
movq (%rax), %rdi
cmpl 0x58(%rdi), %r8d
jne 0x8ca0
movl 0x5c(%rsi), %esi
cmpl 0x5c(%rdi), %esi
sete %sil
orb %sil, %cl
addq $0x8, %rax
jmp 0x8c7a
testb $0x1, %cl
jne 0x8ce2
movq (%rbp), %rax
movslq 0x58(%rax), %rcx
cmpq $0x11, %rcx
je 0x8da6
movq 0x78(%rbx), %rdx
imulq $0x18, %rcx, %rcx
movslq 0x5c(%rax), %rax
imulq $0x90, %rax, %rdi
addq 0x18(%rdx,%rcx), %rdi
callq 0x7fde
testb %al, %al
je 0x8da6
addq $0x8, %rbp
jmp 0x8c69
movq (%r14), %rax
movq (%rax), %rcx
movq (%rcx), %rcx
movl 0x64(%rcx), %edx
movl %edx, 0xc(%rsp)
movl 0x60(%rcx), %ecx
andq $0x0, 0x30(%rsp)
movl %ecx, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq (%rax), %r13
movq 0x8(%rax), %rbp
cmpq %rbp, %r13
je 0x8d58
movq (%r13), %rax
movslq 0x58(%rax), %rcx
movq 0x78(%rbx), %rdx
imulq $0x18, %rcx, %rcx
movslq 0x5c(%rax), %rax
imulq $0x90, %rax, %rax
addq 0x18(%rdx,%rcx), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x999a
movq (%r13), %rdi
callq 0x7e68
addq $0x8, %r13
jmp 0x8d14
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r15, %rcx
callq 0x99d1
movq %r14, %rdi
movq %r12, %rsi
callq 0xa8f4
leaq 0x18(%rsp), %rdi
callq 0x5c18
movq (%r14), %rdi
callq 0x7394
movq %rbx, %rdi
callq 0xda72
movq %r15, %rdi
callq 0x75fe
movl 0x4(%rsp), %eax
movl %eax, (%rsp)
jmp 0x8c52
cmpl $0x0, (%rsp)
sete %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8dc2
jmp 0x8dc2
jmp 0x8dc2
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x75fe
movq %rbx, %rdi
callq 0x54b0
nop