// File: davidjosepha[P]slitherlink/src/shared/grid.cpp
// Function: Grid::resetGrid()
void Grid::resetGrid() {
    for (int i = 1; i < getHeight(); i++) {
        for (int j = 1; j < getWidth()-1; j++) {
            hlines_[i][j] = EMPTY;
        }
    }

    for (int i = 1; i < getHeight()-1; i++) {
        for (int j = 1; j < getWidth(); j++) {
            vlines_[i][j] = EMPTY;
        }
    }

    for (int i = 0; i < getHeight(); i++) {
        for (int j = 0; j < getWidth(); j++) {
            setUpdateMatrix(i, j, true);
            setContraMatrix(i, j, true);
        }
    }

    for (int i = 0; i < getHeight()+1; i++) {
        for (int j = 0; j < getWidth()+1; j++) {
            setContourMatrix(i, j, std::make_pair(-1,-1));
        }
    }

    numClosedLoops_ = 0;
    numOpenLoops_ = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x1, -0xc(%rbp)
movq -0x40(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, -0x44(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x44(%rbp), %eax
cmpl %ecx, %eax
jge 0x2cf8
movl $0x1, -0x10(%rbp)
movq -0x40(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, -0x48(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0x48(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2ceb
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2caa
jmp 0x2ced
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2c8b
movl $0x1, -0x14(%rbp)
movq -0x40(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x4c(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x4c(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2d6c
movl $0x1, -0x18(%rbp)
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, -0x50(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0x50(%rbp), %eax
cmpl %ecx, %eax
jge 0x2d5f
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x18(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2d21
jmp 0x2d61
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2cff
movl $0x0, -0x1c(%rbp)
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x54(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
jge 0x2dea
movl $0x0, -0x20(%rbp)
movq -0x40(%rbp), %rdi
movl -0x20(%rbp), %eax
movl %eax, -0x58(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0x58(%rbp), %eax
cmpl %ecx, %eax
jge 0x2ddd
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl $0x1, %ecx
callq 0x48f0
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl $0x1, %ecx
callq 0x4930
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2d92
jmp 0x2ddf
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2d73
movl $0x0, -0x24(%rbp)
movq -0x40(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0x5c(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x5c(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2e87
movl $0x0, -0x28(%rbp)
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
movl %eax, -0x60(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0x60(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2e77
movl -0x24(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x64(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
leaq -0x34(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x49b0
movq -0x40(%rbp), %rdi
movl -0x68(%rbp), %esi
movl -0x64(%rbp), %edx
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
callq 0x4970
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2e13
jmp 0x2e79
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2df1
movq -0x40(%rbp), %rax
movl $0x0, 0x50(%rax)
movl $0x0, 0x4c(%rax)
addq $0x70, %rsp
popq %rbp
retq
nop