// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %r9, %r15
movl %r8d, 0xc(%rsp)
movq %rcx, 0x20(%rsp)
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
callq 0x8a68
leaq 0x13b39(%rip), %rax     # 0x1a198
movq %rax, (%rbx)
leaq 0x8(%rbx), %r13
movq %r13, %rdi
callq 0x100c4
movq %r15, 0x50(%rsp)
leaq 0x30(%rbx), %r12
movq %r12, %rdi
callq 0x12110
movl 0x90(%rsp), %ecx
leaq 0x58(%rbx), %rax
movq %rax, 0x48(%rsp)
leaq 0x70(%rbx), %r15
leaq 0x90(%rbx), %rax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x78(%rbx)
movups %xmm0, 0x68(%rbx)
movups %xmm0, 0x58(%rbx)
movl $0x0, 0x88(%rbx)
movups %xmm0, 0x90(%rbx)
movb %bpl, 0xa0(%rbx)
movl %r14d, 0xa4(%rbx)
movl 0xc(%rsp), %eax
movb %al, 0xa8(%rbx)
movl %ecx, 0xac(%rbx)
movl $0x4, 0xb0(%rbx)
movq $0x0, 0xb8(%rbx)
movl $0x12, 0xc0(%rbx)
movb $0x0, 0xc4(%rbx)
xorl %ebp, %ebp
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf78c
movq %r15, %rdi
movq %r14, %rsi
callq 0x789c
movq %r14, %rdi
callq 0x7b7c
incl %ebp
cmpl 0xc0(%rbx), %ebp
jl 0x670a
movq 0x20(%rsp), %rax
decl %eax
cmpl $0x3, %eax
ja 0x68a2
leaq 0xc94a(%rip), %rcx      # 0x13098
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x10, %edi
callq 0x52b0
movq %rax, %rbp
movq %rax, %rdi
movl 0x90(%rsp), %esi
callq 0xf180
jmp 0x67cd
movl $0x10, %edi
callq 0x52b0
movq %rax, %rbp
movq %rax, %rdi
movl 0x90(%rsp), %esi
callq 0xf2a8
jmp 0x67cd
movl $0x10, %edi
callq 0x52b0
movq %rax, %rbp
movq %rax, %rdi
movl 0x90(%rsp), %esi
callq 0xf334
jmp 0x67cd
movl $0x10, %edi
callq 0x52b0
movq %rax, %rbp
movq %rax, %rdi
movl 0x90(%rsp), %esi
callq 0xf220
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %rbp, (%rax)
testq %rdi, %rdi
movl 0xc(%rsp), %ebp
je 0x67e7
movq (%rdi), %rax
callq *0x8(%rax)
testb %bpl, %bpl
jne 0x6807
movq %r12, %rdi
movq 0x20(%rsp), %rsi
callq 0x124a0
movl 0x88(%rbx), %esi
movq %r12, %rdi
callq 0x12678
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq 0xb8(%rbx), %rdi
movq $0x0, 0xb8(%rbx)
testq %rdi, %rdi
je 0x682d
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x98(%rbx), %rax
movq 0xb8(%rbx), %rcx
movq %rax, 0xb8(%rbx)
movq %rcx, 0x98(%rbx)
testb %bpl, %bpl
jne 0x685b
movq %r12, %rdi
movl $0x20, %esi
callq 0x12852
movq 0xb8(%rbx), %rdi
addq $0x8, %rdi
movq %r13, %rsi
callq 0x110bc
testb %bpl, %bpl
jne 0x6886
movq 0xb8(%rbx), %rdi
addq $0x8, %rdi
movq %r12, %rsi
callq 0x110bc
movq 0xb8(%rbx), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x50, %edi
callq 0x52b0
movq %rax, 0x18(%rsp)
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x50(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x6510
leaq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rdx
callq 0xf3c0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x68fe
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq 0x18(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x67d8
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6932
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x6932
movq %rax, %r14
movl $0x50, %esi
movq 0x18(%rsp), %rdi
jmp 0x694f
jmp 0x6944
jmp 0x6944
jmp 0x6944
movq %rax, %r14
movl $0x10, %esi
movq %rbp, %rdi
callq 0x52c0
jmp 0x6984
jmp 0x6972
jmp 0x6972
jmp 0x6972
jmp 0x6972
jmp 0x6972
movq %rax, %r14
jmp 0x6a05
movq %rax, %r14
jmp 0x6a1d
jmp 0x6972
movq %rax, %r14
jmp 0x6984
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x7b7c
movq 0xb8(%rbx), %rdi
testq %rdi, %rdi
je 0x6996
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0xb8(%rbx)
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x69b3
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x98(%rbx)
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x69d0
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x90(%rbx)
movq %r15, %rdi
callq 0x7a04
movq 0x48(%rsp), %rdi
callq 0x7a46
leaq 0x14344(%rip), %rax     # 0x1ad38
addq $0x10, %rax
movq %rax, 0x30(%rbx)
leaq 0x50(%rbx), %rdi
callq 0x7bfe
leaq 0x1422c(%rip), %rax     # 0x1ac38
addq $0x10, %rax
movq %rax, 0x8(%rbx)
leaq 0x10(%rbx), %rdi
callq 0x7c32
movq %rbx, %rdi
callq 0x8a74
movq %r14, %rdi
callq 0x5480
nop