// File: /workspace/github_cpp_makefile_star2_O3/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
xorl %eax, %eax
leaq 0x38(%rsp), %rcx
movq %rax, -0x18(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, -0x28(%rcx)
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq 0x38(%r14), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x31b0
leaq 0xc8(%rsp), %rdi
callq 0x3070
movb %al, 0xb(%rsp)
testb %al, %al
je 0x41a7
leaq 0x9c(%r14), %r15
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x31a0
movslq (%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x5578
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 0x4229
cmpl $0x0, (%r15)
jle 0x414a
xorl %r12d, %r12d
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3480
movss 0xc(%rsp), %xmm0
movq 0x10(%rsp), %rax
movss %xmm0, (%rax,%r12,4)
incq %r12
movslq (%r15), %rax
cmpq %rax, %r12
jl 0x4123
cmpb $0x1, 0xa0(%r14)
jne 0x4163
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x3340
jmp 0x4181
movq 0x30(%rsp), %rdx
movl $0x5, %r8d
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
leaq 0x4053(%rip), %rcx      # 0x81cf
callq 0x33b0
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x70(%rsp,%rax)
jne 0x4229
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x55aa
jmp 0x4106
movq 0x7e12(%rip), %rdi      # 0xbfc0
leaq 0x4020(%rip), %rsi      # 0x81d5
movl $0xe, %edx
callq 0x3330
movq 0x38(%r14), %rsi
movq 0x40(%r14), %rdx
movq 0x7df2(%rip), %rdi      # 0xbfc0
callq 0x3330
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
jmp 0x4282
movslq 0x30(%r14), %rsi
movq %r14, %rdi
callq 0x55d4
leaq 0x18(%r14), %rbx
movslq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x55d4
cmpl $0x0, 0x30(%r14)
jle 0x4282
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%r14), %rdi
addq %r12, %rdi
movslq 0x9c(%r14), %rsi
callq 0x5578
movq (%rbx), %rdi
addq %r12, %rdi
movslq (%r15), %rsi
callq 0x5578
incq %r13
movslq 0x30(%r14), %rax
addq $0x18, %r12
cmpq %rax, %r13
jl 0x4252
leaq 0x50(%rsp), %rdi
callq 0x3050
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x42a8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x42bf
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
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
jmp 0x42e5
jmp 0x42e5
jmp 0x42e5
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x5610
leaq 0x50(%rsp), %rdi
callq 0x3080
movq %rbx, %rdi
callq 0x3450