// File: /workspace/github_cpp_makefile_star2_O2/juancalaca[P]dotsboxes/DotsBoard.cc
// Function: DotsBoard::DotsBoard(int, int)
DotsBoard::DotsBoard(int rows, int columns)
{
	this->rows = rows;
	this->columns = columns;
	this->claimedBoxes = 0;
	this->totalBoxes = (rows * columns);
	
	for (int r = 0; r < rows; r++)
	{
		vector<DotsBox*> newRow;
		
		for (int c = 0; c < columns; c++)
		{
			DotsBox *box = new DotsBox();
			
			DotsEdge *bottom = new DotsEdge();
			bottom->SetBox1(box);
			
			DotsEdge *right = new DotsEdge();
			right->SetBox1(box);

			DotsEdge *left;
			if (c == 0)
			{
				left = new DotsEdge();
				left->SetBox1(box);
			}
			else
			{
				left = newRow[(c - 1)]->GetRight();
				left->SetBox2(box);
			}
			
			DotsEdge *top;
			if (r == 0)
			{
				top = new DotsEdge();
				top->SetBox1(box);
			}
			else 
			{
				top = this->boxes[(r - 1)][c]->GetBottom();
				top->SetBox2(box);
			}
			
			box->SetLeft(left);
			box->SetRight(right);
			box->SetTop(top);
			box->SetBottom(bottom);
			
			newRow.push_back(box);
		}
		
		this->boxes.push_back(newRow);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
andq $0x0, 0x20(%rdi)
movl %esi, (%rdi)
movl %edx, 0x4(%rdi)
andl $0x0, 0x8(%rdi)
leaq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movl %edx, %eax
imull %esi, %eax
xorl %ecx, %ecx
testl %edx, %edx
cmovlel %ecx, %edx
movq %rdx, 0x50(%rsp)
movl %eax, 0xc(%rdi)
testl %esi, %esi
cmovlel %ecx, %esi
movq %rsi, 0x40(%rsp)
pushq $0x18
popq %rbp
cmpq 0x40(%rsp), %rcx
je 0x27e7
andq $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
imulq $0x18, %rcx, %rax
movq %rax, 0x48(%rsp)
xorl %r14d, %r14d
cmpq %r14, 0x50(%rsp)
je 0x27c0
pushq $0x48
popq %rdi
callq 0x2130
movq %rax, %rbx
movq %rax, %rdi
callq 0x24e0
movq %rbx, 0x8(%rsp)
movq %rbp, %rdi
callq 0x2130
movq %rax, %rbx
movq %rax, %rdi
callq 0x23cc
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x23da
movq %rbp, %rdi
callq 0x2130
movq %rax, %r13
movq %rax, %rdi
callq 0x23cc
movq 0x8(%rsp), %rsi
movq %r13, %rdi
callq 0x23da
testq %r14, %r14
je 0x2700
movq 0x20(%rsp), %rax
movq -0x8(%rax,%r14,8), %rdi
callq 0x2568
movq %rax, %r15
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x23de
jmp 0x2720
movq %rbp, %rdi
callq 0x2130
movq %rax, %r15
movq %rax, %rdi
callq 0x23cc
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x23da
cmpq $0x0, 0x18(%rsp)
je 0x2755
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x48(%rsp), %rcx
movq -0x18(%rax,%rcx), %rax
movq (%rax,%r14,8), %rdi
callq 0x256e
movq %rax, %r12
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x23de
jmp 0x2775
movq %rbp, %rdi
callq 0x2130
movq %rax, %r12
movq %rax, %rdi
callq 0x23cc
movq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x23da
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2548
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x2552
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x254c
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2558
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2d56
incq %r14
jmp 0x2677
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x2d74
movq %rbx, %rdi
callq 0x2e70
movq 0x18(%rsp), %rcx
incq %rcx
jmp 0x264d
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2838
movq %rax, %r14
pushq $0x18
popq %rsi
movq %r15, %rdi
jmp 0x282b
movq %rax, %r14
pushq $0x18
popq %rsi
movq %r12, %rdi
jmp 0x282b
movq %rax, %r14
pushq $0x18
jmp 0x2827
movq %rax, %r14
pushq $0x18
popq %rsi
movq %r13, %rdi
jmp 0x282b
jmp 0x2838
movq %rax, %r14
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x2140
jmp 0x283b
jmp 0x2838
jmp 0x2838
jmp 0x2838
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x2e70
movq 0x10(%rsp), %rdi
callq 0x2da0
movq %r14, %rdi
callq 0x21c0
nop