// File: /workspace/github_cpp_makefile_star2_O1/EstherJin[P]TetrisRemake/game.cc
// Function: Game::processDropCmd(int, int)
void Game::processDropCmd(int linesCleared, int board) {
	Board *tmp;
	Board *tmp2;
	if (board == 1) {
		tmp = brd1.get();
		tmp2 = brd2.get();
		//++brd1LastCleared;
	}
	else if (board == 2) {
		tmp = brd2.get();
		tmp2 = brd1.get();
		//++brd2LastCleared;
	}

	int score = tmp->getScore();
	if (score > highscore) highscore = score;

	// remove special effects from current board if there are any
	if (tmp->inSpecialEffect()) {
		if (board == 1) {
			Decorator *temp = static_cast <Decorator *>(brd1.get());
			brd1 = temp->removeDecorator();
		} else if (board == 2) {
			Decorator *temp = static_cast <Decorator *>(brd2.get());
			brd2 = temp->removeDecorator();
		}
	}
/*
	// update lines cleared
	if (linesCleared > 0) {
		if (board == 1) brd1LastCleared = 0;
		else brd2LastCleared = 0;
	}

	// add dot
	int lastCleared = board == 1 ? brd1LastCleared : brd2LastCleared;
	if (tmp->getLevel() == 4 && lastCleared % 5 == 0) {
		if (board == 1) {
			brd1 = make_shared<Force> (brd1, '.');
			brd1->setSpecialEffect();
		} else if (board == 2) {
			brd2 = make_shared<Force> (brd2, '.');
			brd2->setSpecialEffect();
		}
	}
	*/

	// activate special effects if lines are cleared
	if (linesCleared > 1) {
		cout << "Choose your special action" << endl;
		while (true) {
			string action;
			cin >> action;
			if (action == "blind") {
				if (board == 1) {
					brd2 = make_shared<Blind> (brd2);
					brd2->setSpecialEffect();
				} else if (board == 2) {
					brd1 = make_shared<Blind> (brd1);
					brd1->setSpecialEffect();
				}
				break;
			}
			else if (action == "heavy") {
				if (board == 1) {
					brd2 = make_shared<Heavy> (brd2);
					brd2->setSpecialEffect();
				} else if (board == 2) {
					brd1 = make_shared<Heavy> (brd1);
					brd1->setSpecialEffect();
				}
				break;
			}
			else if (action == "force") {
				char type;
				cin >> type;
				if (board == 1) {
					brd2 = make_shared<Force> (brd2, type);
					brd2->setSpecialEffect();
				} else if (board == 2) {
					brd1 = make_shared<Force> (brd1, type);
					brd1->setSpecialEffect();
				}
				break;
			}
			else cout << "Invalid input, try again" << endl;
		}
	}
	if (board == 1) brd2->getNextBlock();
	else brd1->getNextBlock();

	// check game over
	if (!brd1->validStartPos() || !brd2->validStartPos()) processWinner();

	throw 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x1, %edx
jne 0x9779
movq 0x58(%rbx), %r15
jmp 0x9782
cmpl $0x2, %ebp
jne 0x9782
movq 0x68(%rbx), %r15
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
cmpl 0x4(%rbx), %eax
jle 0x9793
movl %eax, 0x4(%rbx)
movq (%r15), %rax
movq %r15, %rdi
callq *0x58(%rax)
testb %al, %al
je 0x980d
cmpl $0x1, %ebp
jne 0x97cb
movq 0x58(%rbx), %rsi
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x8d3a
movaps (%r15), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%r15)
movq 0x60(%rbx), %rdi
movups %xmm0, 0x58(%rbx)
jmp 0x97f4
cmpl $0x2, %ebp
jne 0x980d
movq 0x68(%rbx), %rsi
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x8d3a
movaps (%r15), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%r15)
movq 0x70(%rbx), %rdi
movups %xmm0, 0x68(%rbx)
testq %rdi, %rdi
je 0x97fe
callq 0x63c0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x980d
callq 0x63c0
cmpl $0x2, %r14d
jl 0x9b57
movq 0x117aa(%rip), %r14     # 0x1afc8
leaq 0x9a27(%rip), %rsi      # 0x1324c
movl $0x1a, %edx
movq %r14, %rdi
callq 0x5310
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5280
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x51c0
leaq 0x40(%rsp), %r14
leaq 0x58(%rbx), %rax
movq %rax, 0x28(%rsp)
leaq 0x68(%rbx), %r13
leaq 0x30(%rsp), %r15
movq %r14, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
movq 0x1174e(%rip), %rdi     # 0x1afd8
movq %r15, %rsi
callq 0x5350
movq %r15, %rdi
leaq 0x99cb(%rip), %rsi      # 0x13267
callq 0x50b0
testl %eax, %eax
je 0x9929
movq %r15, %rdi
leaq 0x99ba(%rip), %rsi      # 0x1326d
callq 0x50b0
testl %eax, %eax
je 0x9954
movq %r15, %rdi
leaq 0x99a9(%rip), %rsi      # 0x13273
callq 0x50b0
testl %eax, %eax
je 0x99e3
movl $0x18, %edx
movq 0x116e5(%rip), %rdi     # 0x1afc8
leaq 0x998f(%rip), %rsi      # 0x13279
callq 0x5310
movq 0x116d2(%rip), %rcx     # 0x1afc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x5280
movsbl %al, %esi
movq 0x116b4(%rip), %rdi     # 0x1afc8
callq 0x5030
movb $0x1, %r12b
movq %rax, %rdi
callq 0x51c0
jmp 0x9ac3
cmpl $0x1, %ebp
jne 0x99b3
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq %r13, %rcx
callq 0xa404
jmp 0x997d
cmpl $0x1, %ebp
jne 0x9a58
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq %r13, %rcx
callq 0xa2b6
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x70(%rbx), %rdi
movups %xmm0, 0x68(%rbx)
testq %rdi, %rdi
je 0x999c
callq 0x63c0
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x99ab
callq 0x63c0
movq %r13, %rax
jmp 0x9ab2
cmpl $0x2, %ebp
jne 0x9ac0
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0xa404
jmp 0x9a7f
movq 0x115ee(%rip), %rdi     # 0x1afd8
leaq 0xf(%rsp), %rsi
callq 0x5360
cmpl $0x1, %ebp
jne 0x9ae5
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq %r13, %rcx
leaq 0xf(%rsp), %r8
callq 0xa552
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x70(%rbx), %rdi
movups %xmm0, 0x68(%rbx)
testq %rdi, %rdi
je 0x9a41
callq 0x63c0
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9a50
callq 0x63c0
movq %r13, %rax
jmp 0x9b44
cmpl $0x2, %ebp
jne 0x9ac0
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0xa2b6
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x60(%rbx), %rdi
movups %xmm0, 0x58(%rbx)
testq %rdi, %rdi
je 0x9a9e
callq 0x63c0
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9aad
callq 0x63c0
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x60(%rax)
xorl %r12d, %r12d
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x9ada
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x52c0
testb %r12b, %r12b
jne 0x9870
jmp 0x9b57
cmpl $0x2, %ebp
jne 0x9ac0
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq 0x28(%rsp), %rcx
leaq 0xf(%rsp), %r8
callq 0xa552
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x60(%rbx), %rdi
movups %xmm0, 0x58(%rbx)
testq %rdi, %rdi
je 0x9b30
callq 0x63c0
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9b3f
callq 0x63c0
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x60(%rax)
jmp 0x9ac0
xorl %eax, %eax
cmpl $0x1, %ebp
sete %al
shll $0x4, %eax
movq 0x58(%rax,%rbx), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movq 0x58(%rbx), %rdi
movq (%rdi), %rax
callq *0x80(%rax)
testb %al, %al
je 0x9bb0
movq 0x68(%rbx), %rdi
movq (%rdi), %rax
callq *0x80(%rax)
testb %al, %al
je 0x9bb0
movl $0x4, %edi
callq 0x5140
movl $0x1, (%rax)
movq 0x113f2(%rip), %rsi     # 0x1af98
movq %rax, %rdi
xorl %edx, %edx
callq 0x5470
movq %rbx, %rdi
callq 0x969a
jmp 0x9bc6
jmp 0x9bc6
jmp 0x9bc6
jmp 0x9bc6
jmp 0x9bc6
jmp 0x9bc6
jmp 0x9bc6
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x9be0
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %rbx, %rdi
callq 0x5480