// File: /workspace/github_cpp_makefile_star2_O1/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 0x2f8b
movslq 0xc(%rbx), %r15
leaq (,%r15,8), %rax
testq %r15, %r15
movq $-0x1, %r14
cmovnsq %rax, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, 0x30(%rbx)
movq %r15, -0x30(%rbp)
testq %r15, %r15
jle 0x2e6e
movl 0x10(%rbx), %r15d
testl %r15d, %r15d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnsl %r15d, %eax
movslq %eax, %r12
xorl %r13d, %r13d
movq %r12, %rdi
callq 0x2030
movq 0x30(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
testl %r15d, %r15d
jle 0x2e65
movq 0x30(%rbx), %rax
movq (%rax,%r13,8), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x20e0
incq %r13
cmpq %r13, -0x30(%rbp)
jne 0x2e3b
movq %r14, %rdi
callq 0x2030
movq %rax, 0x38(%rbx)
cmpl $0x0, -0x30(%rbp)
jle 0x2ec6
movl 0x10(%rbx), %r14d
testl %r14d, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnsl %r14d, %eax
movslq %eax, %r15
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x2030
movq 0x38(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
testl %r14d, %r14d
jle 0x2ebd
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x20e0
incq %r12
cmpq %r12, -0x30(%rbp)
jne 0x2e96
movq -0x30(%rbp), %r14
cmpl $-0x1, %r14d
leaq 0x8(,%r14,8), %rdi
movq $-0x1, %rax
movq $-0x1, -0x38(%rbp)
cmovlq %rax, %rdi
callq 0x2030
movq %rax, 0x40(%rbx)
testl %r14d, %r14d
js 0x2f83
movl 0x10(%rbx), %r12d
leal 0x1(%r12), %r15d
movslq %r15d, %rcx
shlq $0x3, %rcx
cmpl $-0x1, %r12d
movq -0x38(%rbp), %rax
movq %rcx, -0x48(%rbp)
cmovgeq %rcx, %rax
movq %rax, -0x38(%rbp)
leaq (,%r15,8), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
incl %eax
movq %rax, -0x30(%rbp)
xorl %r14d, %r14d
movq -0x38(%rbp), %rdi
callq 0x2030
movq %rax, %r13
testl %r15d, %r15d
je 0x2f57
movq %r13, %rdi
xorl %esi, %esi
movq -0x48(%rbp), %rdx
callq 0x20e0
movq 0x40(%rbx), %rax
movq %r13, (%rax,%r14,8)
testl %r12d, %r12d
js 0x2f7a
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl $0xff, %esi
movq -0x40(%rbp), %rdx
callq 0x20e0
incq %r14
cmpq %r14, -0x30(%rbp)
jne 0x2f38
movq $0x0, 0x4c(%rbx)
movb $0x1, 0x49(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq