// File: 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
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x2ad0
movq -0x50(%rbp), %rdi
movl %eax, -0x3c(%rbp)
callq 0x2af0
movq -0x48(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl %eax, %edx
callq 0x5820
movq -0x10(%rbp), %rdi
callq 0x31e0
movl $0x0, -0x14(%rbp)
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x54(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x54(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2f7c
movl $0x0, -0x18(%rbp)
movq -0x50(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, -0x58(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0x58(%rbp), %eax
cmpl %ecx, %eax
jge 0x2f6c
movq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x5bf0
movq -0x68(%rbp), %rdi
movl -0x60(%rbp), %esi
movl -0x5c(%rbp), %edx
movl %eax, %ecx
movq (%rdi), %rax
callq *0x10(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2f14
jmp 0x2f6e
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2ef2
movl $0x0, -0x1c(%rbp)
movq -0x50(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x6c(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x6c(%rbp), %eax
cmpl %ecx, %eax
jge 0x300d
movl $0x0, -0x20(%rbp)
movq -0x50(%rbp), %rdi
movl -0x20(%rbp), %eax
movl %eax, -0x70(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0x70(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2ffd
movq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x5c90
movq -0x80(%rbp), %rdi
movl -0x78(%rbp), %esi
movl -0x74(%rbp), %edx
movl %eax, %ecx
movq (%rdi), %rax
callq *0x18(%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2fa2
jmp 0x2fff
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2f83
movl $0x0, -0x24(%rbp)
movq -0x50(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0x84(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x84(%rbp), %eax
cmpl %ecx, %eax
jge 0x3119
movl $0x0, -0x28(%rbp)
movq -0x50(%rbp), %rdi
movl -0x28(%rbp), %eax
movl %eax, -0x88(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0x88(%rbp), %eax
cmpl %ecx, %eax
jge 0x3109
movq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x5b50
movq -0x98(%rbp), %rdi
movl -0x90(%rbp), %esi
movl -0x8c(%rbp), %edx
movl %eax, %ecx
callq 0x5d90
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movq 0x30(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x48f0
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movq 0x38(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x4930
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x303d
jmp 0x310b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3014
movl $0x0, -0x2c(%rbp)
movq -0x50(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, -0x9c(%rbp)
callq 0x2ad0
movl %eax, %ecx
movl -0x9c(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x31b3
movl $0x0, -0x30(%rbp)
movq -0x50(%rbp), %rdi
movl -0x30(%rbp), %eax
movl %eax, -0xa0(%rbp)
callq 0x2af0
movl %eax, %ecx
movl -0xa0(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x31a3
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
movq 0x40(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
callq 0x4970
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3148
jmp 0x31a5
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3120
movq -0x50(%rbp), %rax
movl 0x4c(%rax), %edx
movq -0x10(%rbp), %rcx
movl %edx, 0x4c(%rcx)
movl 0x50(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x50(%rax)
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)