// File: /workspace/github_cpp_makefile_star2_O3/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 0x2fd2
movslq 0xc(%rbx), %r13
leaq (,%r13,8), %rax
testq %r13, %r13
movq $-0x1, %r14
cmovnsq %rax, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, 0x30(%rbx)
testq %r13, %r13
jle 0x2efe
movq %r14, -0x30(%rbp)
movl 0x10(%rbx), %r15d
testl %r15d, %r15d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnsl %r15d, %eax
movslq %eax, %r12
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2030
movq 0x30(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
testl %r15d, %r15d
jle 0x2e9d
movq 0x30(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x20e0
incq %r14
cmpq %r14, %r13
jne 0x2e73
movq -0x30(%rbp), %rdi
callq 0x2030
movq %rax, 0x38(%rbx)
testl %r13d, %r13d
jle 0x2f0a
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 0x2ef4
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x20e0
incq %r12
cmpq %r12, %r13
jne 0x2ecd
jmp 0x2f0a
movq %r14, %rdi
callq 0x2030
movq %rax, 0x38(%rbx)
leal 0x1(%r13), %r14d
movslq %r14d, %rdi
shlq $0x3, %rdi
cmpl $-0x1, %r13d
movq $-0x1, %rax
movq $-0x1, -0x30(%rbp)
cmovlq %rax, %rdi
callq 0x2030
movq %rax, 0x40(%rbx)
testl %r13d, %r13d
js 0x2fca
movl 0x10(%rbx), %eax
leal 0x1(%rax), %r12d
movslq %r12d, %rcx
shlq $0x3, %rcx
movq %rax, -0x48(%rbp)
cmpl $-0x1, %eax
movq -0x30(%rbp), %rax
movq %rcx, -0x40(%rbp)
cmovgeq %rcx, %rax
movq %rax, -0x30(%rbp)
leaq (,%r12,8), %rax
movq %rax, -0x38(%rbp)
movl %r14d, %r15d
xorl %r14d, %r14d
movq -0x30(%rbp), %rdi
callq 0x2030
movq %rax, %r13
testl %r12d, %r12d
je 0x2fba
movq %r13, %rdi
xorl %esi, %esi
movq -0x40(%rbp), %rdx
callq 0x20e0
movq 0x40(%rbx), %rax
movq %r13, (%rax,%r14,8)
cmpl $0x0, -0x48(%rbp)
js 0x2fc2
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl $0xff, %esi
movq -0x38(%rbp), %rdx
callq 0x20e0
jmp 0x2fc2
movq 0x40(%rbx), %rax
movq %r13, (%rax,%r14,8)
incq %r14
cmpq %r14, %r15
jne 0x2f75
movq $0x0, 0x4c(%rbx)
movb $0x1, 0x49(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop