// File: /workspace/github_cpp_makefile_star2_O3/yukimasano[P]cpp_matrix/Vector.cpp
// Function: operator-(Vector const&, Vector const&)
Vector operator-(const Vector& v1, 
                        const Vector& v2)
{
  int n;

//  set n to be the length of the longest vector and create a vector
//  of that length to be returned
  if (v1.mSize > v2.mSize)
    {
      n = v1.mSize;
    }
  else
    {
      n = v2.mSize;
    }
  Vector w(n);


//  subtract the vectors
//  if one vector is shorter than the other assume missing entries are 0
  if (v1.mSize == v2.mSize)
    {
      for (int i=0; i<v1.mSize; i++)
	{
	  w.mData[i] = v1.mData[i] - v2.mData[i];
	}
    }

  else if (v1.mSize > v2.mSize)
    {
      for (int i=0; i<v2.mSize; i++)
	{
	  w.mData[i] = v1.mData[i] - v2.mData[i];
	}
      for (int i=v2.mSize; i<v1.mSize; i++)
	{
	  w.mData[i] = v1.mData[i];
	}
      std::cerr<<"vector subtract - vectors different lengths\n";
      std::cerr<<"extra entries of shorter vector assumed to be 0.0\n";
    }

  else
    {
      for (int i=0; i<v1.mSize; i++)
	{
	  w.mData[i] = v1.mData[i] - v2.mData[i];
	}
      for (int i=v1.mSize; i<v2.mSize; i++)
	{
	  w.mData[i] = v2.mData[i];
	}
      std::cerr<<"vector subtract - vectors different lengths\n";
      std::cerr<<"extra entries of shorter vector assumed to be 0.0\n";
    }
  return w;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
movq %rsi, 0x8(%rsp)
movl 0x8(%rsi), %ebp
movq %rdx, (%rsp)
movl 0x8(%rdx), %r15d
cmpl %r15d, %ebp
movl %r15d, %ebx
cmovgl %ebp, %ebx
leaq (,%rbx,8), %r13
testl %ebx, %ebx
movq $-0x1, %rdi
cmovnsq %r13, %rdi
callq 0x2030
movq %rax, %r14
movq %rax, (%r12)
movq %r12, 0x10(%rsp)
movl %ebx, 0x8(%r12)
testl %ebx, %ebx
jle 0x848e
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20a0
cmpl %r15d, %ebp
jne 0x84c9
testl %ebp, %ebp
jle 0x859e
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rsp), %rcx
movq (%rcx), %rcx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
subsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%r14,%rdx,8)
incq %rdx
cmpq %rdx, %rbp
jne 0x84ac
jmp 0x859e
movslq %r15d, %rax
cmpl %r15d, %ebp
jle 0x851f
testl %r15d, %r15d
jle 0x84ff
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq (%rsp), %rdx
movq (%rdx), %rdx
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm0
subsd (%rdx,%rsi,8), %xmm0
movsd %xmm0, (%r14,%rsi,8)
incq %rsi
cmpq %rsi, %r15
jne 0x84e7
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movslq %ebp, %rdx
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, (%r14,%rax,8)
incq %rax
cmpq %rax, %rdx
jne 0x850a
jmp 0x856e
testl %ebp, %ebp
jle 0x854c
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq (%rsp), %rdx
movq (%rdx), %rdx
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm0
subsd (%rdx,%rsi,8), %xmm0
movsd %xmm0, (%r14,%rsi,8)
incq %rsi
cmpq %rsi, %rbp
jne 0x8534
cmpl %r15d, %ebp
jge 0x856e
movslq %ebp, %rcx
movq (%rsp), %rdx
movq (%rdx), %rdx
movsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x855b
movq 0x4a7b(%rip), %rdi      # 0xcff0
leaq 0xfef(%rip), %rsi       # 0x956b
movl $0x2c, %edx
callq 0x2160
movq 0x4a63(%rip), %rdi      # 0xcff0
leaq 0xfa4(%rip), %rsi       # 0x9538
movl $0x32, %edx
callq 0x2160
movq 0x10(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x21f0