// File: /workspace/github_cpp_makefile_star2_O2/MatthewZMD[P]TetrisDual/concreteboard.cc
// Function: ConcreteBoard::right(int)
int ConcreteBoard::right(int time){
    bool exist = false;
    bool isValidMove = true;
    while (time != 0){
        for (auto &i : thisBlock->cells){
            for (auto &j : thisBlock->cells){
                if (i->pos.col + 1 == j->pos.col && i->pos.row == j->pos.row){
                    exist = true;
                }
            }
            if (!exist){
                if (i->pos.col == 10 || !allCells[i->pos.row][i->pos.col + 1].isEmpty()){
                    isValidMove = false;
                }
            }
            exist = false;
        }
        if (isValidMove) {
            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][i->pos.col + 1]));
                i->restore();
            }
            thisBlock = std::make_shared<Block>(curType, curLevel, temp);
            thisBlock->recaliBtmLft();
            --time;
        } else {
            break;
        }
    }
    if (level->heavyOffset()){
        down(1);
    }
    notifyObservers();
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
movl $0x90, %r15d
subl $0x1, %ebp
jb 0x8665
movl %ebp, 0x4(%rsp)
movq (%r14), %rax
movq (%rax), %rbp
movq 0x8(%rax), %r12
movb $0x1, %r13b
cmpq %r12, %rbp
je 0x8599
movq (%r14), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
xorl %ecx, %ecx
cmpq %rdx, %rax
je 0x855a
movq (%rbp), %rsi
movl 0x5c(%rsi), %r8d
incl %r8d
movq (%rax), %rdi
cmpl 0x5c(%rdi), %r8d
jne 0x8554
movl 0x58(%rsi), %esi
cmpl 0x58(%rdi), %esi
sete %sil
orb %sil, %cl
addq $0x8, %rax
jmp 0x852e
testb $0x1, %cl
jne 0x8593
movq (%rbp), %rcx
movslq 0x5c(%rcx), %rax
cmpq $0xa, %rax
je 0x8590
movslq 0x58(%rcx), %rcx
movq 0x78(%rbx), %rdx
imulq $0x18, %rcx, %rcx
imulq $0x90, %rax, %rdi
addq (%rdx,%rcx), %rdi
addq %r15, %rdi
callq 0x7fde
testb %al, %al
jne 0x8593
xorl %r13d, %r13d
addq $0x8, %rbp
jmp 0x851d
testb $0x1, %r13b
movl 0x4(%rsp), %ebp
je 0x8665
movq (%r14), %rax
movq (%rax), %rcx
movq (%rcx), %rcx
movl 0x64(%rcx), %edx
movl %edx, 0xc(%rsp)
movl 0x60(%rcx), %ecx
andq $0x0, 0x20(%rsp)
movl %ecx, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq (%rax), %r12
movq 0x8(%rax), %r13
cmpq %r13, %r12
je 0x861d
movq (%r12), %rax
movslq 0x58(%rax), %rcx
movq 0x78(%rbx), %rdx
imulq $0x18, %rcx, %rcx
movslq 0x5c(%rax), %rax
imulq $0x90, %rax, %rax
addq (%rdx,%rcx), %rax
addq %r15, %rax
movq %rax, 0x28(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x999a
movq (%r12), %rdi
callq 0x7e68
addq $0x8, %r12
jmp 0x85d3
leaq 0x28(%rsp), %r12
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x99d1
movq %r14, %rdi
movq %r12, %rsi
callq 0xa8f4
leaq 0x30(%rsp), %rdi
callq 0x5c18
movq (%r14), %rdi
callq 0x7394
leaq 0x10(%rsp), %rdi
callq 0x75fe
jmp 0x8503
movq 0x60(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
testl %eax, %eax
je 0x867f
movq (%rbx), %rax
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq *0x20(%rax)
movq %rbx, %rdi
callq 0xda72
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x869e
jmp 0x869e
jmp 0x869e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x75fe
movq %rbx, %rdi
callq 0x54b0
nop