// File: /workspace/github_cpp_makefile_star2_O3/jingdao[P]PointCloudApp/descriptor.cpp
// Function: Descriptor::LoadFromDir(char const*)
Descriptor* Descriptor::LoadFromDir(const char* dir) {
	Descriptor* res = new Descriptor();

	char buffer[1024];
	int ndir = strlen(dir);
	strncpy(buffer,dir,ndir);
	char* buffer_c = buffer + ndir;
	*buffer_c++ = '/';

	std::vector<double> measurements;
	int j;
	for (j=0;;j++) {
		snprintf(buffer_c,64,"%d-cloud.pcd",j);
		PCD cloud(buffer);
		if (cloud.numPoints==0)
			break;
		Descriptor desc(&cloud);
		double lambda[3],v[9];
		desc.getPCA_XY(lambda,v);
		desc.setPCA(lambda,v);
		measurements.push_back(desc.principalLengths[0]); //length;
		measurements.push_back(desc.principalLengths[1]); //width;
		measurements.push_back(desc.principalLengths[2]); //height;
	}

	//set data
	res->numPoints = j;
	res->dimension = 3;
	res->data = new float[res->numPoints * res->dimension];
	for (size_t i=0;i<measurements.size();i++) {
		res->data[i] = measurements[i];
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5a8, %rsp            # imm = 0x5A8
movq %rdi, %rbx
movl $0x90, %edi
callq 0x2200
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq %rax, 0x28(%rsp)
addq $0x8, %rax
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
callq 0x20c0
movslq %eax, %r14
leaq 0x1a0(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x20e0
leaq (%rsp,%r14), %r15
addq $0x1a1, %r15            # imm = 0x1A1
movb $0x2f, -0x1(%r15)
movq %rsp, %rax
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0xd8(%rsp), %rbx
leaq 0xc0(%rsp), %r13
leaq 0x150(%rsp), %r12
xorl %r14d, %r14d
xorl %ebp, %ebp
movl $0x40, %esi
movq %r15, %rdi
leaq 0x2a5c(%rip), %rdx      # 0xb9fc
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2340
movq %rbx, %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x3186
cmpl $0x0, 0x138(%rsp)
je 0x90b2
movl $0x1, 0x30(%rsp)
movq %rbx, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x9180
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x9270
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x9021
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x9038
movq %rsp, %rdi
leaq 0x48(%rsp), %rdx
callq 0x9a16
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x9052
movsd 0x50(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x9069
movq %rsp, %rdi
leaq 0x50(%rsp), %rdx
callq 0x9a16
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x9083
movsd 0x58(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x9090
movq %rsp, %rdi
leaq 0x58(%rsp), %rdx
callq 0x9a16
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x909f
callq 0x2260
movq %rbx, %rdi
callq 0x3494
incl %ebp
addl $0x3, %r14d
jmp 0x8f91
leaq 0xd8(%rsp), %rdi
callq 0x3494
movq 0x28(%rsp), %rbx
movl %ebp, (%rbx)
movl $0x3, 0x4(%rbx)
movl %r14d, %edi
shlq $0x2, %rdi
callq 0x2040
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0x9114
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
xorps %xmm0, %xmm0
cvtsd2ss (%rdi,%rdx,8), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x90fd
jmp 0x9119
testq %rdi, %rdi
je 0x9126
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rax
addq $0x5a8, %rsp            # imm = 0x5A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x913d
movq %rax, %rbx
jmp 0x9161
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9154
callq 0x2260
leaq 0xd8(%rsp), %rdi
callq 0x3494
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x9177
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x23a0
nop