// File: jingdao[P]PointCloudApp/main.cpp
// Function: testSVD()
void testSVD() {
	int m=6,n=4,l=(m>n?n:m);
	double A[6*4] = {2.27,0.28,-0.48,1.07,-2.35,0.62,
					-1.54,-1.67,-3.09,1.22,2.93,-7.39,
					1.15,0.94,0.99,0.79,-1.45,1.03,
					-1.94,-0.78,-0.21,0.63,2.30,-2.57};
	double U[6*6] = {};
	double S[4] = {};
	double VT[4*4] = {};
	Normal::svd(m,n,A,U,S,VT);
	printf("S: ");
	for (int i=0;i<l;i++)
		printf("%f ",S[i]);
	printf("\n");
	for (int i=0;i<m;i++) {
		printf("u%d: ",i);
		for (int j=0;j<m;j++) {
			printf("%f ",U[i*m+j]);
		}
		printf("\n");
	}
	for (int i=0;i<n;i++) {
		printf("v%d: ",i);
		for (int j=0;j<n;j++) {
			printf("%f ",VT[i*n+j]);
		}
		printf("\n");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movl $0x6, -0x4(%rbp)
movl $0x4, -0x8(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jle 0x28cc
movl -0x8(%rbp), %eax
movl %eax, -0x2a8(%rbp)
jmp 0x28d5
movl -0x4(%rbp), %eax
movl %eax, -0x2a8(%rbp)
movl -0x2a8(%rbp), %eax
movl %eax, -0xc(%rbp)
leaq -0xd0(%rbp), %rdi
leaq 0x107a4(%rip), %rsi     # 0x13090
movl $0xc0, %edx
callq 0x2180
leaq -0x1f0(%rbp), %rdi
xorl %esi, %esi
movl $0x120, %edx            # imm = 0x120
callq 0x2100
leaq -0x210(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2100
leaq -0x290(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x2100
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
leaq -0xd0(%rbp), %rdx
leaq -0x1f0(%rbp), %rcx
leaq -0x210(%rbp), %r8
leaq -0x290(%rbp), %r9
callq 0x11e70
leaq 0x1080e(%rip), %rdi     # 0x1316b
movb $0x0, %al
callq 0x2050
movl $0x0, -0x294(%rbp)
movl -0x294(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x29a8
movslq -0x294(%rbp), %rax
movsd -0x210(%rbp,%rax,8), %xmm0
leaq 0x107d7(%rip), %rdi     # 0x13167
movb $0x1, %al
callq 0x2050
movl -0x294(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x294(%rbp)
jmp 0x296e
leaq 0x11036(%rip), %rdi     # 0x139e5
movb $0x0, %al
callq 0x2050
movl $0x0, -0x298(%rbp)
movl -0x298(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x2a54
movl -0x298(%rbp), %esi
leaq 0x10793(%rip), %rdi     # 0x1316f
movb $0x0, %al
callq 0x2050
movl $0x0, -0x29c(%rbp)
movl -0x29c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x2a32
movl -0x298(%rbp), %eax
imull -0x4(%rbp), %eax
addl -0x29c(%rbp), %eax
cltq
movsd -0x1f0(%rbp,%rax,8), %xmm0
leaq 0x1074d(%rip), %rdi     # 0x13167
movb $0x1, %al
callq 0x2050
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
jmp 0x29ed
leaq 0x10fac(%rip), %rdi     # 0x139e5
movb $0x0, %al
callq 0x2050
movl -0x298(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x298(%rbp)
jmp 0x29c0
movl $0x0, -0x2a0(%rbp)
movl -0x2a0(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x2af2
movl -0x2a0(%rbp), %esi
leaq 0x106e7(%rip), %rdi     # 0x13161
movb $0x0, %al
callq 0x2050
movl $0x0, -0x2a4(%rbp)
movl -0x2a4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x2ad0
movl -0x2a0(%rbp), %eax
imull -0x8(%rbp), %eax
addl -0x2a4(%rbp), %eax
cltq
movsd -0x290(%rbp,%rax,8), %xmm0
leaq 0x106af(%rip), %rdi     # 0x13167
movb $0x1, %al
callq 0x2050
movl -0x2a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a4(%rbp)
jmp 0x2a8b
leaq 0x10f0e(%rip), %rdi     # 0x139e5
movb $0x0, %al
callq 0x2050
movl -0x2a0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a0(%rbp)
jmp 0x2a5e
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
nopl (%rax,%rax)