// File: /workspace/github_cpp_makefile_star2_O1/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, (%rsp)
movl 0x8(%rsi), %r13d
movq %rdx, 0x8(%rsp)
movl 0x8(%rdx), %ebp
cmpl %ebp, %r13d
movl %ebp, %ebx
cmovgl %r13d, %ebx
movslq %ebx, %r15
leaq (,%r15,8), %rax
testl %r15d, %r15d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movq %rax, %r14
movq %rax, (%r12)
movq %r12, 0x10(%rsp)
movl %r15d, 0x8(%r12)
testl %r15d, %r15d
jle 0x8536
movl %ebx, %edx
shlq $0x3, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x20a0
cmpl %ebp, %r13d
jne 0x8572
testl %r13d, %r13d
jle 0x864c
movq (%rsp), %rax
movq (%rax), %rax
movq 0x8(%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, %r13
jne 0x8555
jmp 0x864c
movslq %ebp, %rax
cmpl %ebp, %r13d
jle 0x85cb
testl %ebp, %ebp
jle 0x85a7
movq (%rsp), %rcx
movq (%rcx), %rcx
movq 0x8(%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 0x858f
cmpl %r13d, %ebp
jge 0x861c
movq (%rsp), %rcx
movq (%rcx), %rcx
movslq %r13d, %rdx
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, (%r14,%rax,8)
incq %rax
cmpq %rax, %rdx
jne 0x85b6
jmp 0x861c
testl %r13d, %r13d
jle 0x85f9
movq (%rsp), %rcx
movq (%rcx), %rcx
movq 0x8(%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, %r13
jne 0x85e1
cmpl %ebp, %r13d
jge 0x861c
movslq %r13d, %rcx
movq 0x8(%rsp), %rdx
movq (%rdx), %rdx
movsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x8609
movq 0x59cd(%rip), %rdi      # 0xdff0
leaq 0x1f41(%rip), %rsi      # 0xa56b
movl $0x2c, %edx
callq 0x2160
movq 0x59b5(%rip), %rdi      # 0xdff0
leaq 0x1ef6(%rip), %rsi      # 0xa538
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