// File: 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
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x278(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x43f0
leaq -0x260(%rbp), %rdi
callq 0x53e0
jmp 0x5b54
movq -0x278(%rbp), %rdi
addq $0x38, %rdi
callq 0x4120
movq %rax, %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x4210
jmp 0x5b7a
leaq -0x220(%rbp), %rdi
callq 0x44b0
movb %al, -0x279(%rbp)
jmp 0x5b8e
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0x5b9d
jmp 0x5dd7
movq -0x278(%rbp), %rsi
addq $0x9c, %rsi
leaq -0x220(%rbp), %rdi
callq 0x41f0
jmp 0x5bb9
movq -0x278(%rbp), %rax
movslq 0x9c(%rax), %rsi
leaq -0x260(%rbp), %rdi
callq 0xa330
jmp 0x5bd5
jmp 0x5bd7
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x4560
movb %al, -0x27a(%rbp)
jmp 0x5bf7
movb -0x27a(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5c08
jmp 0x5d2f
movl $0x0, -0xc(%rbp)
movq -0x278(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x9c(%rcx), %eax
jge 0x5ca5
leaq -0x220(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x4070
jmp 0x5c37
movss -0x14(%rbp), %xmm0
movss %xmm0, -0x280(%rbp)
leaq -0x260(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0xa3c0
movss -0x280(%rbp), %xmm0
movss %xmm0, (%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5c0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x5e88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x4c10
jmp 0x5e88
movq -0x278(%rbp), %rax
testb $0x1, 0xa0(%rax)
je 0x5ccc
leaq -0x248(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0x4410
jmp 0x5cca
jmp 0x5ce3
leaq -0x248(%rbp), %rdi
leaq 0x10925(%rip), %rsi     # 0x165ff
callq 0x4430
jmp 0x5ce1
jmp 0x5ce3
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x4030
movb %al, -0x281(%rbp)
jmp 0x5d03
movb -0x281(%rbp), %al
testb $0x1, %al
jne 0x5d0f
jmp 0x5d11
jmp 0x5d2f
movq -0x278(%rbp), %rdi
subq $-0x80, %rdi
leaq -0x260(%rbp), %rsi
callq 0xa3e0
jmp 0x5d2a
jmp 0x5bd7
movq -0x278(%rbp), %rdi
movslq 0x30(%rdi), %rsi
callq 0xa450
jmp 0x5d41
movq -0x278(%rbp), %rax
movq %rax, %rdi
addq $0x18, %rdi
movslq 0x30(%rax), %rsi
callq 0xa450
jmp 0x5d5a
movl $0x0, -0x10(%rbp)
movq -0x278(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0x30(%rcx), %eax
jge 0x5dd1
movq -0x278(%rbp), %rdi
movslq -0x10(%rbp), %rsi
callq 0xa4e0
movq %rax, %rdi
movq -0x278(%rbp), %rax
movslq 0x9c(%rax), %rsi
callq 0xa330
jmp 0x5d98
movq -0x278(%rbp), %rdi
addq $0x18, %rdi
movslq -0x10(%rbp), %rsi
callq 0xa4e0
movq %rax, %rdi
movq -0x278(%rbp), %rax
movslq 0x9c(%rax), %rsi
callq 0xa330
jmp 0x5dc4
jmp 0x5dc6
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5d61
movb $0x1, -0x15(%rbp)
jmp 0x5e48
movq 0x1c1e2(%rip), %rdi     # 0x21fc0
leaq 0x10820(%rip), %rsi     # 0x16605
callq 0x4350
movq %rax, -0x290(%rbp)
jmp 0x5df3
movq -0x290(%rbp), %rdi
movq -0x278(%rbp), %rsi
addq $0x38, %rsi
callq 0x42f0
movq %rax, -0x298(%rbp)
jmp 0x5e13
movq -0x298(%rbp), %rdi
movq 0x1c167(%rip), %rsi     # 0x21f88
callq 0x4390
movq %rax, -0x2a0(%rbp)
jmp 0x5e2f
movq -0x2a0(%rbp), %rdi
movq 0x1c14b(%rip), %rsi     # 0x21f88
callq 0x4390
jmp 0x5e44
movb $0x0, -0x15(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x4080
jmp 0x5e56
movb -0x15(%rbp), %al
movb %al, -0x2a1(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x4c10
leaq -0x220(%rbp), %rdi
callq 0x40c0
movb -0x2a1(%rbp), %al
andb $0x1, %al
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x40c0
movq -0x268(%rbp), %rdi
callq 0x4530