// File: /workspace/github_cpp_makefile_star2_O2/isaacbrodsky[P]K-means-plus-plus/k-means-multi.cpp
// Function: Cluster_set::Read_input_data()
bool Cluster_set::Read_input_data(void){

	// local variables
	int iAttribute_index, iCluster_index;
	float fInput_attribute;
	bool bResult;

	// declare an input stream to read the key
	ifstream strInput_stream;

	// declare data storage for the input data
	Cluster_instance clInput_instance;

	// open the input stream to read the key
	strInput_stream.open(sIn_file.c_str());

	// check if the file was OK
	if (strInput_stream.is_open()){

		strInput_stream >> iAttribute_ct;

		clInput_instance.vfAttribute.resize(iAttribute_ct);

		while (!strInput_stream.eof()){

			for (iAttribute_index = 0; iAttribute_index < iAttribute_ct; iAttribute_index++){
				// get the attribute
				strInput_stream >> fInput_attribute;
				clInput_instance.vfAttribute[iAttribute_index] = fInput_attribute;
			} // for

			if (bUseLabels) {
				// read the classification name
				strInput_stream >> clInput_instance.sClassification;
			}
			else {
				clInput_instance.sClassification = "BLANK";
			} // if
			
			if (strInput_stream.fail()) {
				// Failed to read the input.
				// (E.g. hit the end of the file.)
				break;
			}

			// save the data in the vector set
			vclInput_data.push_back(clInput_instance);

		}// while

		// allocate memory for the mean storage
		vvfMeans.resize(iK_count);
		vvfOld_means.resize(iK_count);

		for (iCluster_index = 0; iCluster_index < iK_count; iCluster_index++){
			// get the attribute
			vvfMeans[iCluster_index].resize(iAttribute_ct);
			vvfOld_means[iCluster_index].resize(iAttribute_ct);
		} // for

		bResult = true;
	} //if
	else {
		cout << "Error reading " << sIn_file << endl << endl;
		bResult = false;
	}

	strInput_stream.close();

	return bResult;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rdi, %r14
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x3320
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rax
movaps %xmm0, -0x28(%rax)
andq $0x0, -0x18(%rax)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x38(%r14), %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x31b0
leaq 0xc8(%rsp), %rdi
callq 0x3060
movb %al, 0xb(%rsp)
testb %al, %al
je 0x3eca
leaq 0x9c(%r14), %r15
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x31a0
movslq (%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x530e
leaq 0x80(%r14), %r13
leaq 0x50(%rsp), %rbp
leaq 0xc(%rsp), %rbx
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x70(%rsp,%rax)
jne 0x3f30
xorl %r12d, %r12d
movslq (%r15), %rax
cmpq %rax, %r12
jge 0x3e7e
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3490
movss 0xc(%rsp), %xmm0
movq 0x10(%rsp), %rax
movss %xmm0, (%rax,%r12,4)
incq %r12
jmp 0x3e55
cmpb $0x1, 0xa0(%r14)
jne 0x3e97
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x3330
jmp 0x3ea8
leaq 0x28(%rsp), %rdi
leaq 0x42fc(%rip), %rsi      # 0x819f
callq 0x3470
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x70(%rsp,%rax)
jne 0x3f30
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x5340
jmp 0x3e3e
movq 0x90ef(%rip), %rdi      # 0xcfc0
leaq 0x42cd(%rip), %rsi      # 0x81a5
callq 0x32d0
addq $0x38, %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x3270
movq %rax, %rdi
callq 0x3120
movq %rax, %rdi
callq 0x3120
leaq 0x50(%rsp), %rdi
callq 0x3040
leaq 0x10(%rsp), %rdi
callq 0x37da
leaq 0x50(%rsp), %rdi
callq 0x3080
movb 0xb(%rsp), %al
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq 0x30(%r14), %rsi
movq %r14, %rdi
callq 0x536c
leaq 0x18(%r14), %rbx
movslq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x536c
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq 0x30(%r14), %rax
cmpq %rax, %r13
jge 0x3efc
movq (%r14), %rdi
addq %r12, %rdi
movslq 0x9c(%r14), %rsi
callq 0x530e
movq (%rbx), %rdi
addq %r12, %rdi
movslq (%r15), %rsi
callq 0x530e
incq %r13
addq $0x18, %r12
jmp 0x3f52
jmp 0x3f8a
jmp 0x3f8a
jmp 0x3f8a
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x37da
leaq 0x50(%rsp), %rdi
callq 0x3080
movq %rbx, %rdi
callq 0x3450
nop