// File: /workspace/github_cpp_makefile_star2_O2/davidjosepha[P]slitherlink/src/shared/grid.cpp
// Function: Grid::initUpdateMatrix()
void Grid::initUpdateMatrix() {

    if (!init_) {
        updateMatrix_ = new bool*[m_];
        for (int i = 0; i < getHeight(); i++) {
            updateMatrix_[i] = new bool[n_];
            for (int j = 0; j < getWidth(); j++) {
                updateMatrix_[i][j] = true;
            }
        }
        contraMatrix_ = new bool*[m_];
        for (int i = 0; i < getHeight(); i++) {
            contraMatrix_[i] = new bool[n_];
            for (int j = 0; j < getWidth(); j++) {
                contraMatrix_[i][j] = false;
            }
        }
        contourMatrix_ = new std::pair<int,int>*[m_+1];
        for (int i = 0; i < getHeight()+1; i++) {
            contourMatrix_[i] = new std::pair<int,int>[n_+1];
            for (int j = 0; j < getWidth()+1; j++) {
                contourMatrix_[i][j] = std::make_pair<int,int>(-1,-1);
            }
        }
        numOpenLoops_ = 0;
        numClosedLoops_ = 0;
    }

    init_ = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x49(%rdi)
jne 0x2bee
movslq 0xc(%rbx), %r14
leaq (,%r14,8), %rdi
testq %r14, %r14
pushq $-0x1
popq %rax
cmovsq %rax, %rdi
movq %rdi, -0x38(%rbp)
callq 0x2030
movq %rax, %r12
movq %rax, 0x30(%rbx)
movl 0x10(%rbx), %r15d
xorl %r13d, %r13d
testl %r15d, %r15d
pushq $-0x1
popq %rax
cmovnsl %r15d, %eax
cltq
movq %rax, -0x30(%rbp)
cmovlel %r13d, %r15d
movq %r14, %rax
testl %eax, %eax
movl $0x0, %r14d
movq %rax, -0x48(%rbp)
cmovgl %eax, %r14d
cmpq %r14, %r13
je 0x2af9
movq -0x30(%rbp), %rdi
callq 0x2030
movq %rax, (%r12,%r13,8)
movq 0x30(%rbx), %r12
xorl %eax, %eax
cmpq %rax, %r15
je 0x2af4
movq (%r12,%r13,8), %rcx
movb $0x1, (%rcx,%rax)
incq %rax
jmp 0x2ae2
incq %r13
jmp 0x2aca
movq -0x38(%rbp), %rdi
callq 0x2030
movq %rax, %r15
movq %rax, 0x38(%rbx)
movq %rbx, -0x30(%rbp)
movl 0x10(%rbx), %r13d
xorl %ebx, %ebx
testl %r13d, %r13d
pushq $-0x1
popq %rax
cmovnsl %r13d, %eax
movslq %eax, %r12
cmovlel %ebx, %r13d
cmpq %r14, %rbx
je 0x2b56
movq %r12, %rdi
callq 0x2030
movq %rax, (%r15,%rbx,8)
movq -0x30(%rbp), %rax
movq 0x38(%rax), %r15
xorl %eax, %eax
cmpq %rax, %r13
je 0x2b51
movq (%r15,%rbx,8), %rcx
movb $0x0, (%rcx,%rax)
incq %rax
jmp 0x2b3f
incq %rbx
jmp 0x2b24
movq -0x48(%rbp), %rax
leaq 0x8(,%rax,8), %rdi
cmpl $-0x1, %eax
pushq $-0x1
popq %r12
cmovlq %r12, %rdi
callq 0x2030
movq %rax, %r15
movq -0x30(%rbp), %rbx
movq %rax, 0x40(%rbx)
movslq 0x10(%rbx), %r14
leal 0x1(%r14), %eax
movl %eax, -0x3c(%rbp)
cltq
shlq $0x3, %rax
cmpq $-0x1, %r14
movq %rax, -0x50(%rbp)
cmovgeq %rax, %r12
movq %r12, -0x38(%rbp)
xorl %r12d, %r12d
cmpq -0x48(%rbp), %r12
jg 0x2be9
movq -0x38(%rbp), %rdi
callq 0x2030
movq %rax, %r13
cmpl $0x0, -0x3c(%rbp)
je 0x2bc7
movq %r13, %rdi
xorl %esi, %esi
movq -0x50(%rbp), %rdx
callq 0x2100
movq %r13, (%r15,%r12,8)
movq 0x40(%rbx), %r15
xorl %eax, %eax
cmpq %r14, %rax
jg 0x2be4
movq (%r15,%r12,8), %rcx
orq $-0x1, (%rcx,%rax,8)
incq %rax
jmp 0x2bd1
incq %r12
jmp 0x2ba1
andq $0x0, 0x4c(%rbx)
movb $0x1, 0x49(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop