// File: chiku[P]cmatrix/src/impl/matrix/mutators.cpp
// Function: cmatrix::Matrix<double>::mutateToInclude(double, long, long)
void Matrix<Type>::mutateToInclude(Type value, long int row, long int column)
{
	if (row < 0 || column < 0) {
		throw Exception::InvalidSizeReset(ExceptionBody::BadSizeOnMutate(size, row, column));
	}

	if (size.contains(row, column)) {
		access(row, column) = value;
		return;
	}

	Size newSize(std::max(rows(), row + 1), std::max(columns(), column + 1));
	StorageEngine<Type> newEngine;
	newEngine.allocateMemory(newSize);

	for (long int i = 0; i < rows(); i++) {
		for (long int j = 0; j < columns(); j++) {
			newEngine.access(i, j) = engine.access(i, j);
		}
	}

	engine.markMemoryAsUnused();
	engine = newEngine;
	size = newSize;

	access(row, column) = value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0x18(%rbp)
jl 0x275c9
cmpq $0x0, -0x20(%rbp)
jge 0x2767b
movb $0x1, -0x5d(%rbp)
movl $0x10, %edi
callq 0x61c0
movq %rax, %rcx
movq -0xd0(%rbp), %rax
movq %rcx, -0xd8(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x50(%rbp)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x278f0
jmp 0x2760a
movq -0xd8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x11540
jmp 0x2761c
movq -0xd8(%rbp), %rdi
movb $0x0, -0x5d(%rbp)
leaq 0x5f12a(%rip), %rsi     # 0x86758
leaq -0x160b5(%rip), %rdx    # 0x11580
callq 0x6760
jmp 0x278e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x27662
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6230
testb $0x1, -0x5d(%rbp)
jne 0x2766a
jmp 0x27676
movq -0xd8(%rbp), %rdi
callq 0x62c0
jmp 0x278e0
movq -0xd0(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x10be0
testb $0x1, %al
jne 0x27695
jmp 0x276c7
movq -0xd0(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x10e80
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x278d7
movq -0xd0(%rbp), %rdi
callq 0x10160
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x27a80
movq -0xd0(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
callq 0x10330
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x27a80
movq -0xe8(%rbp), %rsi
movq (%rax), %rdx
leaq -0x70(%rbp), %rdi
callq 0x27ac0
leaq -0xa8(%rbp), %rdi
callq 0x108b0
movq -0x70(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x11700
movq $0x0, -0xc0(%rbp)
movq -0xd0(%rbp), %rdi
movq -0xc0(%rbp), %rax
movq %rax, -0xf0(%rbp)
callq 0x10160
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jge 0x2786a
movq $0x0, -0xc8(%rbp)
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rax
movq %rax, -0xf8(%rbp)
callq 0x10330
movq %rax, %rcx
movq -0xf8(%rbp), %rax
cmpq %rcx, %rax
jge 0x27851
movq -0xd0(%rbp), %rdi
addq $0x10, %rdi
movq -0xc0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
callq 0x10ee0
movsd (%rax), %xmm0
movsd %xmm0, -0x100(%rbp)
movq -0xc0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x10ee0
movsd -0x100(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x277c1
jmp 0x27853
movq -0xc0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc0(%rbp)
jmp 0x27789
movq -0xd0(%rbp), %rdi
addq $0x10, %rdi
callq 0x10910
movq -0xd0(%rbp), %rdi
movq -0xa8(%rbp), %rax
movq %rax, 0x10(%rdi)
movq -0xa0(%rbp), %rax
movq %rax, 0x18(%rdi)
movq -0x98(%rbp), %rax
movq %rax, 0x20(%rdi)
movq -0x70(%rbp), %rax
movq %rax, (%rdi)
movq -0x68(%rbp), %rax
movq %rax, 0x8(%rdi)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x10e80
movsd -0x108(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x67c0
nopl (%rax)