// File: /workspace/github_cpp_makefile_star2_O2/8igMac[P]random-forest/src/decision_tree.cpp
// Function: dataSet::get_data_from_file(char*, int, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
void dataSet::get_data_from_file(char* fileName, int num_attr, int num_cls, vector<string> formatTb)
{
	ifstream ifs(fileName, ifstream::in);
	string buffer;
	string classBuffer;
	size_t pos;
	stringstream ss;
	data_inst inst(num_attr, num_cls);

	for (int index = 0 ; ifs >> buffer; index++)
	{
		// replace ',' with ' '
		while ((pos = buffer.find(',')) != string::npos)
			buffer[pos] = ' ';

		// use stringstream to get data
		ss << buffer;
		for (int i=0; i<num_attr; i++)
			ss >> inst.attr[i];
		ss >> classBuffer;

		// store data index
		inst.inst_num = index;

		// covert class string to enum
		for (int i=0; i<(int)formatTb.size(); i++)
			if (classBuffer.compare(formatTb.at(i)) == 0)
			{
				inst.cls = i;
				break;
			}

		dataSet.push_back(inst);
		ss.clear();
	}

	ifs.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %r8, %rbx
movl %ecx, %ebp
movl %edx, %r14d
movq %rdi, 0x8(%rsp)
leaq 0x200(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x2240
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x78(%rsp), %r13
movq %r13, %rdi
callq 0x20f0
leaq 0x10(%rsp), %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x2d9c
xorl %ecx, %ecx
testl %r14d, %r14d
movl $0x0, %eax
movq %rax, (%rsp)
cmovlel %ecx, %r14d
shlq $0x2, %r14
leaq 0x58(%rsp), %rbp
pushq $0x2c
popq %r12
leaq 0x200(%rsp), %rdi
movq %rbp, %rsi
callq 0x2180
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2f3c
movq %rbp, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x21a0
cmpq $-0x1, %rax
je 0x2e8d
movq 0x58(%rsp), %rcx
movb $0x20, (%rcx,%rax)
jmp 0x2e6f
leaq 0x88(%rsp), %rdi
movq %rbp, %rsi
callq 0x2140
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x2ebb
movq 0x18(%rsp), %rsi
addq %r15, %rsi
movq %r13, %rdi
callq 0x2250
addq $0x4, %r15
jmp 0x2ea0
movq %r13, %rdi
leaq 0x38(%rsp), %rsi
callq 0x2180
movq (%rsp), %rax
movl %eax, 0x10(%rsp)
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x5, %rax
cltq
cmpq %rax, %r15
jge 0x2f0b
movq %rbx, %rdi
movq %r15, %rsi
callq 0x46e4
leaq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x2030
testl %eax, %eax
je 0x2f06
incq %r15
jmp 0x2ed3
movl %r15d, 0x30(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4706
movq 0x78(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
xorl %esi, %esi
callq 0x2210
movq (%rsp), %rax
incl %eax
movq %rax, (%rsp)
jmp 0x2e4d
leaq 0x200(%rsp), %rdi
callq 0x2040
leaq 0x18(%rsp), %rdi
callq 0x2878
leaq 0x78(%rsp), %rdi
callq 0x2110
leaq 0x38(%rsp), %rdi
callq 0x20a0
leaq 0x58(%rsp), %rdi
callq 0x20a0
leaq 0x200(%rsp), %rdi
callq 0x2050
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2fa0
movq %rax, %rbx
jmp 0x2fad
movq %rax, %rbx
jmp 0x2fb7
jmp 0x2fa0
jmp 0x2fa0
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2878
leaq 0x78(%rsp), %rdi
callq 0x2110
leaq 0x38(%rsp), %rdi
callq 0x20a0
leaq 0x58(%rsp), %rdi
callq 0x20a0
leaq 0x200(%rsp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2230