// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, %r15
movl %r8d, 0xc(%rsp)
movl %ecx, %r12d
movl %edx, %ebp
movl %esi, 0x10(%rsp)
movq %rdi, %rbx
movl %ecx, 0x24(%rsp)
callq 0x8678
leaq 0x13126(%rip), %rax     # 0x191c0
movq %rax, (%rbx)
leaq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0xe4c0
movq %r12, 0x60(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x30(%rbx), %r15
movq %r15, %rdi
callq 0xff74
leaq 0x58(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x70(%rbx), %r13
leaq 0x90(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x98(%rbx), %rax
movq %rax, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x78(%rbx)
movups %xmm0, 0x68(%rbx)
movups %xmm0, 0x58(%rbx)
andl $0x0, 0x88(%rbx)
movups %xmm0, 0x90(%rbx)
movb %bpl, 0xa0(%rbx)
movl 0x10(%rsp), %eax
movl %eax, 0xa4(%rbx)
movl 0xc(%rsp), %eax
movb %al, 0xa8(%rbx)
movl 0xa0(%rsp), %eax
movl %eax, 0xac(%rbx)
movl $0x4, 0xb0(%rbx)
leaq 0xb8(%rbx), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0xb8(%rbx)
movl $0x12, 0xc0(%rbx)
movb $0x0, 0xc4(%rbx)
xorl %ebp, %ebp
pushq $0x12
popq %rax
leaq 0x28(%rsp), %r12
cmpl %eax, %ebp
jge 0x6193
movq %r12, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0xde74
movq %r13, %rdi
movq %r12, %rsi
callq 0x6f94
movq %r12, %rdi
callq 0x755c
incl %ebp
movl 0xc0(%rbx), %eax
jmp 0x6162
movq 0x60(%rsp), %rcx
decl %ecx
cmpl $0x3, %ecx
ja 0x61ff
leaq 0xaef2(%rip), %rax      # 0x11098
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x28(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x6fd0
jmp 0x6213
leaq 0x28(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x7056
jmp 0x6213
leaq 0x28(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x7099
jmp 0x6213
leaq 0x28(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x7013
jmp 0x6213
leaq 0x28(%rsp), %rdi
leaq 0x24(%rsp), %rdx
movq 0x58(%rsp), %rsi
callq 0x70dc
movq 0x28(%rsp), %rax
andq $0x0, 0x28(%rsp)
movq 0x18(%rsp), %rcx
movq (%rcx), %rdi
movq %rax, (%rcx)
testq %rdi, %rdi
je 0x6244
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x6244
movq (%rdi), %rax
callq *0x8(%rax)
cmpb $0x0, 0xc(%rsp)
jne 0x6265
movl 0x24(%rsp), %esi
movq %r15, %rdi
callq 0x10236
movl 0x88(%rbx), %esi
movq %r15, %rdi
callq 0x10302
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq 0x10(%rsp), %r12
movq (%r12), %rdi
andq $0x0, (%r12)
testq %rdi, %rdi
je 0x628d
movq (%rdi), %rax
callq *0x8(%rax)
movq (%r12), %rax
jmp 0x628f
xorl %eax, %eax
movq 0x48(%rsp), %rcx
movq (%rcx), %rdi
movq %rdi, (%r12)
movq %rax, (%rcx)
cmpb $0x0, 0xc(%rsp)
jne 0x62b8
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x103d4
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
movq %r14, %rsi
callq 0xf284
cmpb $0x0, 0xc(%rsp)
jne 0x62df
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
movq %r15, %rsi
callq 0xf284
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6321
jmp 0x6321
jmp 0x6321
jmp 0x6321
jmp 0x6321
movq %rax, %r12
jmp 0x635c
movq %rax, %r12
jmp 0x6364
jmp 0x6321
movq %rax, %r12
leaq 0x28(%rsp), %rdi
callq 0x755c
jmp 0x6324
movq %rax, %r12
movq 0x10(%rsp), %rdi
callq 0x715a
movq 0x48(%rsp), %rdi
callq 0x715a
movq 0x18(%rsp), %rdi
callq 0x7172
movq %r13, %rdi
callq 0x718a
movq 0x50(%rsp), %rdi
callq 0x71ac
movq %r15, %rdi
callq 0x71ce
movq %r14, %rdi
callq 0x71e6
movq %rbx, %rdi
callq 0x8684
movq %r12, %rdi
callq 0x5450