// File: /workspace/github_cpp_makefile_star2_O1/yukimasano[P]cpp_matrix/Matrix.cpp
// Function: momentum(Matrix&, Vector&, int&, double, double)
Vector momentum(Matrix& A, Vector& v, int& count,double lambda,double mu){
	assert(nrows(A) == ncols(A));
	int m =nrows(A);
	// we want a square system

	// INITIALISATION
	Vector x= v;
	double tol = 1.e-12;
	Vector r = A*x;
	r= r-v;
	Vector temp(m);
	//std::cout<<" before the while loop "<<(A*x -c).norm() << std::endl<<std::flush;
	while ((A*x -v).norm() > tol){
		count+=1;
    temp = mu*temp - lambda*r;
		x = x + temp;
		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 $0x78, %rsp
movq %rcx, 0x38(%rsp)
movsd %xmm0, 0x60(%rsp)
movsd %xmm1, 0x58(%rsp)
movl 0x8(%rsi), %ebp
cmpl 0xc(%rsi), %ebp
jne 0x810a
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq %rdx, %rsi
callq 0x82b8
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x3941
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %r15, %rdx
callq 0x84c8
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x89dc
leaq 0x8(%rsp), %rdi
callq 0x8310
leaq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x8268
leaq 0x48(%rsp), %r13
leaq 0x28(%rsp), %rbp
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x3941
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x84c8
movq %rbp, %rdi
movl $0x2, %esi
callq 0x8dfc
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
callq 0x8310
movq %r13, %rdi
callq 0x8310
movsd 0x40(%rsp), %xmm0
ucomisd 0x2081(%rip), %xmm0     # 0xa098
jbe 0x80e4
movq 0x38(%rsp), %rax
incl (%rax)
movq %r13, %rdi
leaq 0x58(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x877e
leaq 0x68(%rsp), %r14
movq %r14, %rdi
leaq 0x60(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x877e
movq %rbp, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84c8
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x89dc
movq %rbp, %rdi
callq 0x8310
leaq 0x68(%rsp), %rdi
callq 0x8310
movq %r13, %rdi
callq 0x8310
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x831d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x89dc
movq %rbp, %rdi
callq 0x8310
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x3941
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x84c8
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x89dc
movq %rbp, %rdi
callq 0x8310
movq %r13, %rdi
callq 0x8310
jmp 0x7fca
leaq 0x8(%rsp), %rdi
callq 0x8310
leaq 0x18(%rsp), %rdi
callq 0x8310
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2209(%rip), %rdi      # 0xa31a
leaq 0x2039(%rip), %rsi      # 0xa151
leaq 0x2371(%rip), %rcx      # 0xa490
movl $0x3b3, %edx            # imm = 0x3B3
callq 0x20b0
jmp 0x812d
jmp 0x8166
movq %rax, %r14
jmp 0x8191
movq %rax, %r14
jmp 0x819b
jmp 0x8166
movq %rax, %r14
jmp 0x814b
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x8310
leaq 0x68(%rsp), %rdi
jmp 0x8178
jmp 0x8170
jmp 0x816b
jmp 0x816b
movq %rax, %r14
leaq 0x28(%rsp), %rdi
jmp 0x8182
jmp 0x8166
jmp 0x8166
movq %rax, %r14
jmp 0x8187
movq %rax, %r14
jmp 0x817d
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x8310
leaq 0x48(%rsp), %rdi
callq 0x8310
leaq 0x8(%rsp), %rdi
callq 0x8310
leaq 0x18(%rsp), %rdi
callq 0x8310
movq %rbx, %rdi
callq 0x8310
movq %r14, %rdi
callq 0x21f0
nop