// File: yukimasano[P]cpp_matrix/Vector.cpp
// Function: Vector::operator=(Vector const&)
Vector& Vector::operator=(const Vector& v)
{

//  check both vectors have same length
//  if rhs vector is too short, assume missing entries are 0
//  if rhs vector is too long then throw

  if (v.mSize > mSize)
    {
      throw Exception("length mismatch",
		  "vector assignment operator - vectors have different lengths");
    }
  else if (v.mSize < mSize)
    {
      for (int i=0; i<v.mSize; i++)
	{
	  mData[i] = v.mData[i];
	}
      for (int i=v.mSize; i<mSize; i++)
	{
	  mData[i] = 0.0;
	}
      std::cerr << "vector assignment operator - copied vector was too short";
      std::cerr << " and has been extended with zeroes\n";
    }
  else
    {
      for (int i=0; i<mSize; i++)
	{
	  mData[i] = v.mData[i];
	}
    }

  return *this;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x90(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movq 0x88(%rsp), %rax
movl 0x8(%rax), %eax
cmpl 0x8(%rcx), %eax
jle 0xddae
movb $0x1, 0x2e(%rsp)
movl $0x40, %edi
callq 0x2070
movq %rax, 0x8(%rsp)
leaq 0x67(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x21f0
movq 0x10(%rsp), %rdx
leaq 0x13fc(%rip), %rsi      # 0xf0d3
leaq 0x68(%rsp), %rdi
callq 0x2150
jmp 0xdce3
leaq 0x2f(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x21f0
movq (%rsp), %rdx
leaq 0x18b8(%rip), %rsi      # 0xf5b4
leaq 0x30(%rsp), %rdi
callq 0x2150
jmp 0xdd08
movq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0xe550
jmp 0xdd1e
movq 0x8(%rsp), %rdi
movb $0x0, 0x2e(%rsp)
leaq 0x4061(%rip), %rsi      # 0x11d90
leaq -0xd26(%rip), %rdx      # 0xd010
callq 0x21b0
jmp 0xdee0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0xdd8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0xdd78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x2080
leaq 0x2f(%rsp), %rdi
callq 0x2130
leaq 0x68(%rsp), %rdi
callq 0x2080
leaq 0x67(%rsp), %rdi
callq 0x2130
testb $0x1, 0x2e(%rsp)
jne 0xdd9f
jmp 0xdda9
movq 0x8(%rsp), %rdi
callq 0x20c0
jmp 0xded6
movq 0x18(%rsp), %rcx
movq 0x88(%rsp), %rax
movl 0x8(%rax), %eax
cmpl 0x8(%rcx), %eax
jge 0xde7b
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
movq 0x88(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xde14
movq 0x18(%rsp), %rax
movq 0x88(%rsp), %rcx
movq (%rcx), %rcx
movslq 0x28(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq (%rax), %rax
movslq 0x28(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0xddcf
movq 0x88(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x24(%rsp)
movq 0x18(%rsp), %rcx
movl 0x24(%rsp), %eax
cmpl 0x8(%rcx), %eax
jge 0xde53
movq 0x18(%rsp), %rax
movq (%rax), %rax
movslq 0x24(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0xde23
movq 0x4196(%rip), %rdi      # 0x11ff0
leaq 0x178f(%rip), %rsi      # 0xf5f0
callq 0x2110
movq 0x4183(%rip), %rdi      # 0x11ff0
leaq 0x17b5(%rip), %rsi      # 0xf629
callq 0x2110
jmp 0xdec7
movl $0x0, 0x20(%rsp)
movq 0x18(%rsp), %rcx
movl 0x20(%rsp), %eax
cmpl 0x8(%rcx), %eax
jge 0xdec5
movq 0x18(%rsp), %rax
movq 0x88(%rsp), %rcx
movq (%rcx), %rcx
movslq 0x20(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq (%rax), %rax
movslq 0x20(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xde83
jmp 0xdec7
jmp 0xdec9
movq 0x18(%rsp), %rax
addq $0x98, %rsp
retq
movq 0x58(%rsp), %rdi
callq 0x21e0