// File: /workspace/github_cpp_makefile_star2_O3/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 0x414a
movq %rbx, %rdi
callq 0x2e0c
movl 0xc(%r14), %eax
testl %eax, %eax
js 0x2df4
movl 0x10(%r14), %ecx
xorl %r15d, %r15d
testl %ecx, %ecx
jle 0x2cdd
xorl %r12d, %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x4322
movq (%rbx), %r8
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq *0x10(%r8)
incl %r12d
movl 0x10(%r14), %ecx
cmpl %ecx, %r12d
jl 0x2cad
movl 0xc(%r14), %eax
leal 0x1(%r15), %edx
cmpl %eax, %r15d
movl %edx, %r15d
jl 0x2ca6
testl %eax, %eax
jle 0x2db5
movl 0x10(%r14), %ecx
xorl %r15d, %r15d
testl %ecx, %ecx
js 0x2d32
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
incl %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x4368
movq (%rbx), %r8
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq *0x18(%r8)
movl 0x10(%r14), %ecx
cmpl %ecx, %r12d
jl 0x2d02
movl 0xc(%r14), %eax
incl %r15d
cmpl %eax, %r15d
jl 0x2cf8
testl %eax, %eax
jle 0x2db5
movl 0x10(%r14), %ecx
xorl %r15d, %r15d
testl %ecx, %ecx
jle 0x2daa
xorl %r12d, %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x42dc
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq 0x43de
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), %rcx
cmpq %rcx, %r12
jl 0x2d4c
movl 0xc(%r14), %eax
incq %r15
movslq %eax, %rdx
cmpq %rdx, %r15
jl 0x2d45
testl %eax, %eax
js 0x2df4
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 0x2dec
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 0x2ddc
incq %r8
cmpq %rax, %r8
jne 0x2dcd
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