// File: /workspace/github_cpp_makefile_star2_O3/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: forwardsubst(Matrix const&, Vector const&)
Vector forwardsubst(const Matrix& A, const Vector& b)
{
	int n = length(b);
	Vector x(n);
	for (int i=1;i<=n;i++)
	{
		if (A(i,i)==0)
		{
			throw Exception("Singular Matrix",
									  "no solution to equation as coefficient matrix is singular");
		}
		x(i) = b(i);
		for (int j = 1; j<=(i-1); j++)
		{
			x(i) = x(i) - A(i,j)*x(j);
		}
		x(i) = x(i)/A(i,i);
	}
	return x;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rdx, 0x18(%rsp)
movq %rdx, %rdi
callq 0x3461
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
callq 0x28b8
testl %ebp, %ebp
jle 0x6121
movl $0x1, %r12d
xorl %r14d, %r14d
movq %r15, %rdi
movl %r12d, %esi
movl %r12d, %edx
callq 0x5202
movsd (%rax), %xmm0
ucomisd 0x62f1(%rip), %xmm0     # 0xc2f8
jne 0x600f
jnp 0x6133
movq 0x18(%rsp), %rdi
movl %r12d, %esi
callq 0x318c
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3330
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
cmpl $0x2, %r12d
jb 0x60c5
movl $0x1, %r13d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3330
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x5202
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3330
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3330
movsd 0x10(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
leal (%r14,%r13), %eax
incl %eax
movl %r13d, %ecx
incl %ecx
movl %ecx, %r13d
cmpl $0x1, %eax
jne 0x604b
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3330
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movl %r12d, %esi
movl %r12d, %edx
callq 0x5202
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3330
movsd 0x8(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
leal 0x1(%r12), %eax
decl %r14d
cmpl %ebp, %r12d
movl %eax, %r12d
jne 0x5fed
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x40, %edi
callq 0x2070
movq %rax, %r14
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x6413(%rip), %rsi      # 0xc564
leaq 0x641b(%rip), %rdx      # 0xc573
leaq 0x28(%rsp), %rdi
callq 0x3c44
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x6402(%rip), %rsi      # 0xc574
leaq 0x6434(%rip), %rdx      # 0xc5ad
leaq 0x48(%rsp), %rdi
callq 0x3c44
movb $0x1, %bpl
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %r14, %rdi
callq 0x3cdc
xorl %ebp, %ebp
leaq 0x9bf7(%rip), %rsi      # 0xfd98
leaq -0x258e(%rip), %rdx     # 0x3c1a
movq %r14, %rdi
callq 0x2180
movq %rax, %r15
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x61c2
callq 0x2100
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x61d1
callq 0x2100
testb %bpl, %bpl
jne 0x61ef
jmp 0x61fe
movq %rax, %r15
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x61ef
callq 0x2100
jmp 0x61ef
movq %rax, %r15
movq %r14, %rdi
callq 0x20c0
jmp 0x61fe
jmp 0x61fb
movq %rax, %r15
movq %rbx, %rdi
callq 0x294e
movq %r15, %rdi
callq 0x21b0