// File: /workspace/github_cpp_makefile_star2_O1/davidjosepha[P]slitherlink/src/shared/grid.cpp
// Function: Grid::copy(Grid&) const
void Grid::copy(Grid & newGrid) const {
    newGrid.initArrays(getHeight(), getWidth());
    newGrid.initUpdateMatrix();

    for (int i = 0; i < getHeight()+1; i++) {
        for (int j = 0; j < getWidth(); j++) {
            newGrid.changeHLine(i, j, getHLine(i,j));
        }
    }

    for (int i = 0; i < getHeight(); i++) {
        for (int j = 0; j < getWidth()+1; j++) {
            newGrid.changeVLine(i, j, getVLine(i,j));
        }
    }

    for (int i = 0; i < getHeight(); i++) {
        for (int j = 0; j < getWidth(); j++) {
            newGrid.setNumber(i, j, getNumber(i,j));
            newGrid.setUpdateMatrix(i, j, updateMatrix_[i][j]);
            newGrid.setContraMatrix(i, j, contraMatrix_[i][j]);
        }
    }

    for (int i = 0; i < getHeight()+1; i++) {
        for (int j = 0; j < getWidth()+1; j++) {
            newGrid.setContourMatrix(i, j, contourMatrix_[i][j]);
        }
    }

    newGrid.numOpenLoops_ = numOpenLoops_;
    newGrid.numClosedLoops_ = numClosedLoops_;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0xc(%rdi), %esi
movl 0x10(%rdi), %edx
movq %rbx, %rdi
callq 0x412e
movq %rbx, %rdi
callq 0x2dd8
cmpl $0x0, 0xc(%r14)
js 0x2cbd
xorl %r15d, %r15d
cmpl $0x0, 0x10(%r14)
jle 0x2cb0
xorl %r12d, %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x431a
movq (%rbx), %r8
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq *0x10(%r8)
incl %r12d
cmpl 0x10(%r14), %r12d
jl 0x2c87
leal 0x1(%r15), %eax
cmpl 0xc(%r14), %r15d
movl %eax, %r15d
jl 0x2c7d
cmpl $0x0, 0xc(%r14)
jle 0x2d06
xorl %r15d, %r15d
cmpl $0x0, 0x10(%r14)
js 0x2cfd
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
incl %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x4360
movq (%rbx), %r8
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq *0x18(%r8)
cmpl 0x10(%r14), %r12d
jl 0x2cd4
incl %r15d
cmpl 0xc(%r14), %r15d
jl 0x2cc7
movl 0xc(%r14), %eax
testl %eax, %eax
jle 0x2d81
xorl %r15d, %r15d
cmpl $0x0, 0x10(%r14)
jle 0x2d75
xorl %r12d, %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x42d4
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq 0x43d6
movq 0x30(%r14), %rax
movq (%rax,%r15,8), %rax
movb (%rax,%r12), %al
movq 0x30(%rbx), %rcx
movq (%rcx,%r15,8), %rcx
movb %al, (%rcx,%r12)
movq 0x38(%r14), %rax
movq (%rax,%r15,8), %rax
movb (%rax,%r12), %al
movq 0x38(%rbx), %rcx
movq (%rcx,%r15,8), %rcx
movb %al, (%rcx,%r12)
incq %r12
movslq 0x10(%r14), %rax
cmpq %rax, %r12
jl 0x2d1b
incq %r15
movslq 0xc(%r14), %rax
cmpq %rax, %r15
jl 0x2d11
testl %eax, %eax
js 0x2dc0
movl 0x10(%r14), %ecx
movq 0x40(%r14), %rdx
movq 0x40(%rbx), %rsi
leal 0x1(%rcx), %edi
incl %eax
xorl %r8d, %r8d
testl %ecx, %ecx
js 0x2db8
movq (%rdx,%r8,8), %r9
movq (%rsi,%r8,8), %r10
xorl %r11d, %r11d
movq (%r9,%r11,8), %r15
movq %r15, (%r10,%r11,8)
incq %r11
cmpq %r11, %rdi
jne 0x2da8
incq %r8
cmpq %rax, %r8
jne 0x2d99
movl 0x4c(%r14), %eax
movl %eax, 0x4c(%rbx)
movl 0x50(%r14), %eax
movl %eax, 0x50(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop