// File: /workspace/github_cpp_makefile_star2_O3/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
movq %rdi, %rbx
testl %esi, %esi
je 0x8f70
movl %esi, %ebp
leaq 0x10(%rsp), %r15
leaq 0x20(%rsp), %r12
movq 0x48(%rbx), %rax
movq (%rax), %r13
movq 0x8(%rax), %r14
cmpq %r14, %r13
je 0x8e77
movl %ebp, 0x4(%rsp)
movb $0x1, %bpl
movq 0x48(%rbx), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rsi
movq (%r13), %rcx
movslq 0x5c(%rcx), %rax
cmpq %rsi, %rdx
je 0x8e29
leal 0x1(%rax), %r8d
xorl %edi, %edi
movq (%rdx), %r9
cmpl 0x5c(%r9), %r8d
jne 0x8e1a
movl 0x58(%rcx), %r10d
cmpl 0x58(%r9), %r10d
sete %r9b
orb %r9b, %dil
addq $0x8, %rdx
cmpq %rsi, %rdx
jne 0x8e02
testb $0x1, %dil
jne 0x8e5c
cmpl $0xa, %eax
je 0x8e5a
movslq 0x58(%rcx), %rcx
movq 0x78(%rbx), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rcx
leaq (%rax,%rax,8), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $0x90, %rdi
callq 0x8760
testb %al, %al
jne 0x8e5c
xorl %ebp, %ebp
addq $0x8, %r13
cmpq %r14, %r13
jne 0x8de4
testb $0x1, %bpl
movl 0x4(%rsp), %ebp
je 0x8f70
movq 0x48(%rbx), %rax
movq (%rax), %rcx
movq (%rcx), %rcx
movl 0x64(%rcx), %edx
movl %edx, 0xc(%rsp)
movl 0x60(%rcx), %ecx
movl %ecx, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq (%rax), %r14
movq 0x8(%rax), %r13
cmpq %r13, %r14
je 0x8ef2
movq (%r14), %rax
movslq 0x58(%rax), %rcx
movq 0x78(%rbx), %rdx
leaq (%rcx,%rcx,2), %rcx
movslq 0x5c(%rax), %rax
movq (%rdx,%rcx,8), %rcx
leaq (%rax,%rax,8), %rax
shlq $0x4, %rax
addq %rcx, %rax
addq $0x90, %rax
movq %rax, 0x10(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0xaca0
movq (%r14), %rdi
callq 0x85bc
addq $0x8, %r14
jmp 0x8ea7
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
leaq 0x3(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r12, %r9
callq 0xb9d4
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x50(%rbx), %rdi
movups %xmm0, 0x48(%rbx)
testq %rdi, %rdi
je 0x8f48
callq 0x5f5e
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x8f48
callq 0x5f5e
movq 0x48(%rbx), %rdi
callq 0x7ad0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8f68
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x52e0
decl %ebp
jne 0x8dc9
movq 0x60(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
testl %eax, %eax
je 0x8f8c
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x1, %esi
callq *0x20(%rax)
movq %rbx, %rdi
callq 0xeb4e
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8fab
jmp 0x8fab
jmp 0x8fab
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8fc5
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x52e0
movq %rbx, %rdi
callq 0x54e0
nop