// File: /workspace/github_cpp_makefile_star2_O3/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 0x8b10
leaq 0x13b45(%rip), %rax     # 0x1a1d0
movq %rax, (%rbx)
leaq 0x8(%rbx), %r13
movq %r13, %rdi
callq 0xfdf8
movq %r15, 0x50(%rsp)
leaq 0x30(%rbx), %r12
movq %r12, %rdi
callq 0x11d88
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 0xf504
movq %r15, %rdi
movq %r14, %rsi
callq 0x7898
movq %r14, %rdi
callq 0x7b92
incl %ebp
cmpl 0xc0(%rbx), %ebp
jl 0x6736
movq 0x20(%rsp), %rax
decl %eax
cmpl $0x3, %eax
ja 0x68d2
leaq 0xc91e(%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 0xeef8
jmp 0x67f9
movl $0x10, %edi
callq 0x52b0
movq %rax, %rbp
movq %rax, %rdi
movl 0x90(%rsp), %esi
callq 0xf020
jmp 0x67f9
movl $0x10, %edi
callq 0x52b0
movq %rax, %rbp
movq %rax, %rdi
movl 0x90(%rsp), %esi
callq 0xf0ac
jmp 0x67f9
movl $0x10, %edi
callq 0x52b0
movq %rax, %rbp
movq %rax, %rdi
movl 0x90(%rsp), %esi
callq 0xef98
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %rbp, (%rax)
testq %rdi, %rdi
movl 0xc(%rsp), %ebp
je 0x6813
movq (%rdi), %rax
callq *0x8(%rax)
testb %bpl, %bpl
jne 0x6833
movq %r12, %rdi
movq 0x20(%rsp), %rsi
callq 0x12118
movl 0x88(%rbx), %esi
movq %r12, %rdi
callq 0x122f0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq 0xb8(%rbx), %rdi
movq $0x0, 0xb8(%rbx)
testq %rdi, %rdi
je 0x6862
movq (%rdi), %rax
callq *0x8(%rax)
movq 0xb8(%rbx), %rax
jmp 0x6864
xorl %eax, %eax
movq 0x98(%rbx), %rdi
movq %rdi, 0xb8(%rbx)
movq %rax, 0x98(%rbx)
testb %bpl, %bpl
jne 0x6892
movq %r12, %rdi
movl $0x20, %esi
callq 0x124ca
movq 0xb8(%rbx), %rdi
addq $0x8, %rdi
movq %r13, %rsi
callq 0x10e14
testb %bpl, %bpl
jne 0x68b6
movq 0xb8(%rbx), %rdi
addq $0x8, %rdi
movq %r12, %rsi
callq 0x10e14
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 0x6530
leaq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rdx
callq 0xf138
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x692e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq 0x18(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x6804
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6962
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x6962
movq %rax, %r14
movl $0x50, %esi
movq 0x18(%rsp), %rdi
jmp 0x697f
jmp 0x6974
jmp 0x6974
jmp 0x6974
movq %rax, %r14
movl $0x10, %esi
movq %rbp, %rdi
callq 0x52c0
jmp 0x69b4
jmp 0x69a2
jmp 0x69a2
jmp 0x69a2
jmp 0x69a2
jmp 0x69a2
movq %rax, %r14
jmp 0x6a35
movq %rax, %r14
jmp 0x6a4d
jmp 0x69a2
movq %rax, %r14
jmp 0x69b4
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x7b92
movq 0xb8(%rbx), %rdi
testq %rdi, %rdi
je 0x69c6
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0xb8(%rbx)
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x69e3
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x98(%rbx)
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x6a00
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x90(%rbx)
movq %r15, %rdi
callq 0x7a06
movq 0x48(%rsp), %rdi
callq 0x7a4e
leaq 0x14314(%rip), %rax     # 0x1ad38
addq $0x10, %rax
movq %rax, 0x30(%rbx)
leaq 0x50(%rbx), %rdi
callq 0x7c1a
leaq 0x141fc(%rip), %rax     # 0x1ac38
addq $0x10, %rax
movq %rax, 0x8(%rbx)
leaq 0x10(%rbx), %rdi
callq 0x7c4e
movq %rbx, %rdi
callq 0x8b1c
movq %r14, %rdi
callq 0x5480
nop