// File: EstherJin[P]TetrisRemake/basicboard.cc
// Function: BasicBoard::BasicBoard(int, bool, int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
BasicBoard::BasicBoard(int player, bool random, int level, bool textOnly, string script, unsigned seed): player{player}, random{random}, textOnly{textOnly}, seed{seed} {
	for (int r = 0; r < gridRows; ++r) {
		Row row{r, &sg, &gd};
		grid.emplace_back(row);
	}

	if (level == 1) lvl = make_unique<Level1> (seed);
	else if (level == 2) lvl = make_unique<Level2> (seed);
	else if (level == 3) lvl = make_unique<Level3> (seed);
	else if (level == 4) lvl = make_unique<Level4> (seed);
	else lvl = make_unique<NonRandom> (script, level);

	if (!textOnly) {
		gd.printLevel(level);
		gd.printScore(score);
	}

	getNextBlock();
	currentBlock = nullptr;
	std::swap(currentBlock, nextBlock);
	if (!textOnly) gd.printNext(' ');
	currentBlock->attach(&sg);
	if (!textOnly) currentBlock->attach(&gd);
	currentBlock->notifCurrPos();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %r9, -0x90(%rbp)
movb %r8b, %al
movl 0x10(%rbp), %r8d
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %dl
movb %dl, -0xd(%rbp)
movl %ecx, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movq %r9, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x13fd0
movq -0x88(%rbp), %rdi
leaq 0x38fc8(%rip), %rax     # 0x41158
movq %rax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0x80(%rbp)
callq 0x25610
jmp 0x81a2
movq -0x88(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0x98(%rbp)
callq 0x2b0d0
jmp 0x81bb
movq -0x88(%rbp), %rdi
addq $0x58, %rdi
movq %rdi, -0xc0(%rbp)
callq 0x9d30
movq -0x88(%rbp), %rdi
addq $0x70, %rdi
movq %rdi, -0xb8(%rbp)
callq 0x9d50
movq -0x88(%rbp), %rdi
movl $0x0, 0x88(%rdi)
addq $0x90, %rdi
movq %rdi, -0xb0(%rbp)
callq 0x9d70
movq -0x88(%rbp), %rdi
addq $0x98, %rdi
movq %rdi, -0xa8(%rbp)
callq 0x9da0
movq -0x88(%rbp), %rdi
movb -0xd(%rbp), %al
andb $0x1, %al
movb %al, 0xa0(%rdi)
movl -0xc(%rbp), %eax
movl %eax, 0xa4(%rdi)
movb -0x15(%rbp), %al
andb $0x1, %al
movb %al, 0xa8(%rdi)
movl 0x10(%rbp), %eax
movl %eax, 0xac(%rdi)
movl $0x4, 0xb0(%rdi)
addq $0xb8, %rdi
movq %rdi, -0xa0(%rbp)
callq 0x9da0
movq -0x88(%rbp), %rax
movl $0x12, 0xc0(%rax)
movb $0x0, 0xc4(%rax)
movl $0x0, -0x30(%rbp)
movq -0x88(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl 0xc0(%rcx), %eax
jge 0x833f
movq -0x88(%rbp), %rcx
movl -0x30(%rbp), %esi
movq %rcx, %rdx
addq $0x8, %rdx
addq $0x30, %rcx
leaq -0x50(%rbp), %rdi
callq 0x24060
jmp 0x82c8
movq -0x88(%rbp), %rdi
addq $0x70, %rdi
leaq -0x50(%rbp), %rsi
callq 0x9dd0
jmp 0x82de
leaq -0x50(%rbp), %rdi
callq 0x9e50
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x8292
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x85d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x85cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x8584
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x9e50
jmp 0x8584
cmpl $0x1, -0x14(%rbp)
jne 0x8379
leaq -0x58(%rbp), %rdi
leaq 0x10(%rbp), %rsi
callq 0x9e70
jmp 0x8354
movq -0x88(%rbp), %rdi
addq $0x90, %rdi
leaq -0x58(%rbp), %rsi
callq 0x9ef0
leaq -0x58(%rbp), %rdi
callq 0x9f50
jmp 0x845d
cmpl $0x2, -0x14(%rbp)
jne 0x83b3
leaq -0x60(%rbp), %rdi
leaq 0x10(%rbp), %rsi
callq 0x9fb0
jmp 0x838e
movq -0x88(%rbp), %rdi
addq $0x90, %rdi
leaq -0x60(%rbp), %rsi
callq 0xa030
leaq -0x60(%rbp), %rdi
callq 0xa090
jmp 0x845b
cmpl $0x3, -0x14(%rbp)
jne 0x83ea
leaq -0x68(%rbp), %rdi
leaq 0x10(%rbp), %rsi
callq 0xa0f0
jmp 0x83c8
movq -0x88(%rbp), %rdi
addq $0x90, %rdi
leaq -0x68(%rbp), %rsi
callq 0xa170
leaq -0x68(%rbp), %rdi
callq 0xa1d0
jmp 0x8459
cmpl $0x4, -0x14(%rbp)
jne 0x8421
leaq -0x70(%rbp), %rdi
leaq 0x10(%rbp), %rsi
callq 0xa230
jmp 0x83ff
movq -0x88(%rbp), %rdi
addq $0x90, %rdi
leaq -0x70(%rbp), %rsi
callq 0xa2b0
leaq -0x70(%rbp), %rdi
callq 0xa310
jmp 0x8457
movq -0x90(%rbp), %rsi
leaq -0x78(%rbp), %rdi
leaq -0x14(%rbp), %rdx
callq 0xa370
jmp 0x8437
movq -0x88(%rbp), %rdi
addq $0x90, %rdi
leaq -0x78(%rbp), %rsi
callq 0xa430
leaq -0x78(%rbp), %rdi
callq 0xa490
jmp 0x8459
jmp 0x845b
jmp 0x845d
testb $0x1, -0x15(%rbp)
jne 0x8495
movq -0x88(%rbp), %rdi
addq $0x30, %rdi
movl -0x14(%rbp), %esi
callq 0x2b740
jmp 0x8478
movq -0x88(%rbp), %rax
movq %rax, %rdi
addq $0x30, %rdi
movl 0x88(%rax), %esi
callq 0x2b8c0
jmp 0x8493
jmp 0x8495
movq -0x88(%rbp), %rdi
movq (%rdi), %rax
movq 0x48(%rax), %rax
callq *%rax
jmp 0x84a7
movq -0x88(%rbp), %rdi
addq $0xb8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa4f0
movq -0x88(%rbp), %rsi
movq %rsi, %rdi
addq $0xb8, %rdi
addq $0x98, %rsi
callq 0xa520
testb $0x1, -0x15(%rbp)
jne 0x84fa
movq -0x88(%rbp), %rdi
addq $0x30, %rdi
movl $0x20, %esi
callq 0x2ba30
jmp 0x84f8
jmp 0x84fa
movq -0x88(%rbp), %rdi
addq $0xb8, %rdi
callq 0xa550
movq -0x88(%rbp), %rsi
movq %rax, %rdi
addq $0x8, %rdi
addq $0x8, %rsi
callq 0x29070
jmp 0x8526
testb $0x1, -0x15(%rbp)
jne 0x855a
movq -0x88(%rbp), %rdi
addq $0xb8, %rdi
callq 0xa550
movq -0x88(%rbp), %rsi
movq %rax, %rdi
addq $0x8, %rdi
addq $0x30, %rsi
callq 0x29070
jmp 0x8558
jmp 0x855a
movq -0x88(%rbp), %rdi
addq $0xb8, %rdi
callq 0xa550
movq %rax, %rdi
movq (%rdi), %rax
movq 0x30(%rax), %rax
callq *%rax
jmp 0x857b
addq $0xc0, %rsp
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0xa570
movq -0xa8(%rbp), %rdi
callq 0xa570
movq -0xb0(%rbp), %rdi
callq 0xa5e0
movq -0xb8(%rbp), %rdi
callq 0xa650
movq -0xc0(%rbp), %rdi
callq 0xa6b0
movq -0x98(%rbp), %rdi
callq 0xa710
movq -0x80(%rbp), %rdi
callq 0xa750
movq -0x88(%rbp), %rdi
callq 0x13ff0
movq -0x28(%rbp), %rdi
callq 0x65c0
nopw (%rax,%rax)