// File: /workspace/github_cpp_makefile_star2_O3/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 0x982b
movq 0x58(%rbx), %r15
jmp 0x9834
cmpl $0x2, %ebp
jne 0x9834
movq 0x68(%rbx), %r15
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
cmpl 0x4(%rbx), %eax
jle 0x9845
movl %eax, 0x4(%rbx)
movq (%r15), %rax
movq %r15, %rdi
callq *0x58(%rax)
testb %al, %al
je 0x98bf
cmpl $0x1, %ebp
jne 0x987d
movq 0x58(%rbx), %rsi
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x8de2
movaps (%r15), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%r15)
movq 0x60(%rbx), %rdi
movups %xmm0, 0x58(%rbx)
jmp 0x98a6
cmpl $0x2, %ebp
jne 0x98bf
movq 0x68(%rbx), %rsi
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x8de2
movaps (%r15), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%r15)
movq 0x70(%rbx), %rdi
movups %xmm0, 0x68(%rbx)
testq %rdi, %rdi
je 0x98bf
callq 0x63de
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x98bf
callq 0x63de
cmpl $0x2, %r14d
jl 0x9c09
movq 0x116f8(%rip), %r14     # 0x1afc8
leaq 0x9975(%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 0x1169c(%rip), %rdi     # 0x1afd8
movq %r15, %rsi
callq 0x5350
movq %r15, %rdi
leaq 0x9919(%rip), %rsi      # 0x13267
callq 0x50b0
testl %eax, %eax
je 0x99db
movq %r15, %rdi
leaq 0x9908(%rip), %rsi      # 0x1326d
callq 0x50b0
testl %eax, %eax
je 0x9a06
movq %r15, %rdi
leaq 0x98f7(%rip), %rsi      # 0x13273
callq 0x50b0
testl %eax, %eax
je 0x9a95
movl $0x18, %edx
movq 0x11633(%rip), %rdi     # 0x1afc8
leaq 0x98dd(%rip), %rsi      # 0x13279
callq 0x5310
movq 0x11620(%rip), %rcx     # 0x1afc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x5280
movsbl %al, %esi
movq 0x11602(%rip), %rdi     # 0x1afc8
callq 0x5030
movb $0x1, %r12b
movq %rax, %rdi
callq 0x51c0
jmp 0x9b75
cmpl $0x1, %ebp
jne 0x9a65
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq %r13, %rcx
callq 0xa4a6
jmp 0x9a2f
cmpl $0x1, %ebp
jne 0x9b0a
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq %r13, %rcx
callq 0xa35e
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x70(%rbx), %rdi
movups %xmm0, 0x68(%rbx)
testq %rdi, %rdi
je 0x9a5d
callq 0x63de
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9a5d
callq 0x63de
movq %r13, %rax
jmp 0x9b64
cmpl $0x2, %ebp
jne 0x9b72
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0xa4a6
jmp 0x9b31
movq 0x1153c(%rip), %rdi     # 0x1afd8
leaq 0xf(%rsp), %rsi
callq 0x5360
cmpl $0x1, %ebp
jne 0x9b97
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq %r13, %rcx
leaq 0xf(%rsp), %r8
callq 0xa5ee
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x70(%rbx), %rdi
movups %xmm0, 0x68(%rbx)
testq %rdi, %rdi
je 0x9b02
callq 0x63de
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9b02
callq 0x63de
movq %r13, %rax
jmp 0x9bf6
cmpl $0x2, %ebp
jne 0x9b72
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0xa35e
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x60(%rbx), %rdi
movups %xmm0, 0x58(%rbx)
testq %rdi, %rdi
je 0x9b5f
callq 0x63de
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9b5f
callq 0x63de
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 0x9b8c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x52c0
testb %r12b, %r12b
jne 0x9922
jmp 0x9c09
cmpl $0x2, %ebp
jne 0x9b72
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 0xa5ee
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x60(%rbx), %rdi
movups %xmm0, 0x58(%rbx)
testq %rdi, %rdi
je 0x9bf1
callq 0x63de
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9bf1
callq 0x63de
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x60(%rax)
jmp 0x9b72
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 0x9c62
movq 0x68(%rbx), %rdi
movq (%rdi), %rax
callq *0x80(%rax)
testb %al, %al
je 0x9c62
movl $0x4, %edi
callq 0x5140
movl $0x1, (%rax)
movq 0x11340(%rip), %rsi     # 0x1af98
movq %rax, %rdi
xorl %edx, %edx
callq 0x5470
movq %rbx, %rdi
callq 0x974c
jmp 0x9c78
jmp 0x9c78
jmp 0x9c78
jmp 0x9c78
jmp 0x9c78
jmp 0x9c78
jmp 0x9c78
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x9c92
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %rbx, %rdi
callq 0x5480