// File: /workspace/github_cpp_makefile_star2_O2/yukimasano[P]cpp_matrix/Matrix.cpp
// Function: SD(Matrix&, Vector&, int&)
Vector SD(Matrix& A, Vector& v, int& count){
	assert(nrows(A) == ncols(A));
	int m =nrows(A);
	// we want a square system

	// INITIALISATION
	Vector x= v;
	double tol = 1.e-14*v.norm();
	double top;
	Vector r = A*x;
	r= r-v;
	double bottom;
	Vector temp(m);
	double alpha;
	//std::cout<<" before the while loop "<<(A*x -c).norm() << std::endl<<std::flush;
	while (r.norm() > tol){
		top = r*r;
		temp = A*r;
		bottom = r*temp;
		alpha= top/bottom;
		count+=1;
		x = x + top*r/bottom;
		r = v - A*x;
	}
   //	std::cout<<count<<std::endl<<std::flush;

	return x;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, 0x40(%rsp)
movl 0x8(%rsi), %ebp
cmpl 0xc(%rsi), %ebp
jne 0x7231
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq %rdx, %rsi
callq 0x80b8
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x891a
movsd %xmm0, 0x10(%rsp)
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
movq %rbx, 0x8(%rsp)
movq %rbx, %rdx
callq 0x372f
leaq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r14, %rdx
callq 0x8238
leaq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x859c
movq %r14, 0x38(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x8104
leaq 0x18(%rsp), %rdi
movl %ebp, %esi
callq 0x8068
movsd 0x10(%rsp), %xmm0
mulsd 0x1f9e(%rip), %xmm0     # 0x9090
movsd %xmm0, 0x10(%rsp)
leaq 0x28(%rsp), %r13
leaq 0x48(%rsp), %rbp
leaq 0x78(%rsp), %r15
leaq 0x68(%rsp), %r14
movq %r13, %rdi
pushq $0x2
popq %rsi
callq 0x891a
ucomisd 0x10(%rsp), %xmm0
jbe 0x7206
movq %r13, %rdi
movq %r13, %rsi
callq 0x835f
movsd %xmm0, 0x60(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x372f
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x859c
movq %rbp, %rdi
callq 0x8104
movq %r13, %rdi
movq %rbx, %rsi
callq 0x835f
movsd %xmm0, 0x58(%rsp)
movq 0x40(%rsp), %rax
incl (%rax)
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
movq %r13, %rdx
callq 0x8418
movq %r14, %rdi
movq %r15, %rsi
leaq 0x58(%rsp), %rdx
callq 0x845c
movq %rbp, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x8111
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x859c
movq %rbp, %rdi
callq 0x8104
movq %r14, %rdi
callq 0x8104
movq %r15, %rdi
callq 0x8104
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x372f
movq %rbp, %rdi
movq 0x38(%rsp), %rsi
movq %r14, %rdx
callq 0x8238
movq %r13, %rdi
movq %rbp, %rsi
callq 0x859c
movq %rbp, %rdi
callq 0x8104
movq %r14, %rdi
callq 0x8104
jmp 0x710c
leaq 0x18(%rsp), %rdi
callq 0x8104
leaq 0x28(%rsp), %rdi
callq 0x8104
movq 0x8(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20e2(%rip), %rdi      # 0x931a
leaq 0x1f12(%rip), %rsi      # 0x9151
leaq 0x21c2(%rip), %rcx      # 0x9408
movl $0x330, %edx            # imm = 0x330
callq 0x20b0
jmp 0x7254
jmp 0x72bc
movq %rax, %r14
jmp 0x72c9
movq %rax, %r14
jmp 0x72d3
movq %rax, %r14
movq %rbx, %rdi
jmp 0x72d8
jmp 0x72bc
jmp 0x72bc
movq %rax, %r14
jmp 0x72a6
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x8104
jmp 0x7281
movq %rax, %r14
leaq 0x68(%rsp), %rdi
jmp 0x72b5
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x8104
jmp 0x729c
jmp 0x72bc
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x8104
leaq 0x78(%rsp), %rdi
jmp 0x72b5
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x8104
jmp 0x72bf
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x8104
leaq 0x28(%rsp), %rdi
callq 0x8104
movq 0x8(%rsp), %rdi
callq 0x8104
movq %r14, %rdi
callq 0x21d0