// File: 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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movb $0x0, -0xd(%rbp)
movb $0x1, -0xe(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x1128d
movq -0xc0(%rbp), %rdi
addq $0x48, %rdi
callq 0x13e70
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd190
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd1c0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xd1f0
testb $0x1, %al
jne 0x10fc3
jmp 0x110c8
leaq -0x20(%rbp), %rdi
callq 0xd230
movq -0xc0(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x48, %rdi
callq 0x13e70
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0xd190
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0xd1c0
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xd1f0
testb $0x1, %al
jne 0x11011
jmp 0x1105e
leaq -0x40(%rbp), %rdi
callq 0xd230
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl 0x5c(%rax), %eax
addl $0x1, %eax
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x5c(%rcx), %eax
jne 0x11051
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl 0x58(%rax), %eax
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x58(%rcx), %eax
jne 0x11051
movb $0x1, -0xd(%rbp)
jmp 0x11053
leaq -0x40(%rbp), %rdi
callq 0xd2d0
jmp 0x10ffe
testb $0x1, -0xd(%rbp)
jne 0x110b6
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpl $0xa, 0x5c(%rax)
je 0x110b0
movq -0xc0(%rbp), %rdi
addq $0x78, %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq 0x58(%rax), %rsi
callq 0x13d50
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl 0x5c(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x13d70
movq %rax, %rdi
callq 0xffc0
testb $0x1, %al
jne 0x110b4
movb $0x0, -0xe(%rbp)
jmp 0x110b6
movb $0x0, -0xd(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xd2d0
jmp 0x10fad
testb $0x1, -0xe(%rbp)
je 0x11286
movq -0xc0(%rbp), %rdi
addq $0x48, %rdi
callq 0x13e70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xd480
movq -0xc0(%rbp), %rdi
movq (%rax), %rax
movl 0x64(%rax), %eax
movl %eax, -0x54(%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, -0x58(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xd170
movq -0xc0(%rbp), %rdi
addq $0x48, %rdi
callq 0x13e70
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0xd190
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
callq 0xd1c0
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xd1f0
testb $0x1, %al
jne 0x1116f
jmp 0x11211
leaq -0x80(%rbp), %rdi
callq 0xd230
movq -0xc0(%rbp), %rdi
movq %rax, -0x90(%rbp)
addq $0x78, %rdi
movq -0x90(%rbp), %rax
movq (%rax), %rax
movslq 0x58(%rax), %rsi
callq 0x13d50
movq %rax, %rdi
movq -0x90(%rbp), %rax
movq (%rax), %rax
movl 0x5c(%rax), %eax
incl %eax
movslq %eax, %rsi
callq 0x13d70
movq %rax, -0x98(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x13e90
jmp 0x111d0
movq -0x90(%rbp), %rax
movq (%rax), %rdi
callq 0xfce0
jmp 0x111e1
jmp 0x111e3
leaq -0x80(%rbp), %rdi
callq 0xd2d0
jmp 0x11156
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xd2f0
jmp 0x112d4
leaq -0xb8(%rbp), %rdi
leaq -0x54(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x70(%rbp), %rcx
callq 0x13f10
jmp 0x1122b
movq -0xc0(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0xc8(%rbp)
leaq -0xb8(%rbp), %rsi
movq %rsi, -0xd0(%rbp)
callq 0x13f90
movq -0xd0(%rbp), %rdi
callq 0x13e50
movq -0xc8(%rbp), %rdi
callq 0x13e70
movq %rax, %rdi
callq 0xcd40
jmp 0x11272
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xd2f0
jmp 0x11288
jmp 0x1128d
jmp 0x10f75
movq -0xc0(%rbp), %rdi
addq $0x60, %rdi
callq 0x13b10
movq %rax, %rdi
movq (%rdi), %rax
callq *0x18(%rax)
cmpl $0x0, %eax
je 0x112bd
movq -0xc0(%rbp), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x20(%rax)
movq -0xc0(%rbp), %rdi
callq 0x25430
xorl %eax, %eax
addq $0xd0, %rsp
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x6630