// File: /workspace/github_cpp_makefile_star2_O3/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 $0x418, %rsp            # imm = 0x418
movq %r8, %rbx
movl %ecx, %r14d
movl %edx, %ebp
movq %rdi, 0x50(%rsp)
leaq 0x210(%rsp), %rdi
movl $0x8, %edx
callq 0x2260
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x40(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0x88(%rsp), %r15
movq %r15, %rdi
callq 0x2100
leaq 0x68(%rsp), %rdi
movslq %ebp, %rsi
leaq 0x7(%rsp), %rdx
callq 0x5338
leaq 0x60(%rsp), %rax
movl %r14d, 0x24(%rax)
movl %ebp, 0x2c(%rsp)
movl %ebp, %ebp
shlq $0x2, %rbp
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
leaq 0x210(%rsp), %rdi
movq %r12, %rsi
callq 0x21a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x31ad
movq %r12, %rdi
movl $0x2c, %esi
xorl %edx, %edx
callq 0x21b0
cmpq $-0x1, %rax
je 0x30cb
movq 0x8(%rsp), %rcx
movb $0x20, (%rcx,%rax)
jmp 0x30ab
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x98(%rsp), %rdi
callq 0x2190
cmpl $0x0, 0x2c(%rsp)
jle 0x3105
xorl %r14d, %r14d
movq 0x68(%rsp), %rsi
addq %r14, %rsi
movq %r15, %rdi
callq 0x2270
addq $0x4, %r14
cmpq %r14, %rbp
jne 0x30ec
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0x21a0
movq %r13, 0x58(%rsp)
movl %r13d, 0x60(%rsp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
testl %edx, %edx
jle 0x317b
xorl %r13d, %r13d
xorl %r14d, %r14d
cmpq %r14, %rdx
jbe 0x3249
addq %r13, %rsi
leaq 0x30(%rsp), %rdi
callq 0x2040
testl %eax, %eax
je 0x3173
incq %r14
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
movq %rax, %rdx
sarq $0x5, %rdx
shrq $0x5, %rax
cltq
addq $0x20, %r13
cmpq %rax, %r14
jl 0x3134
jmp 0x317b
movl %r14d, 0x80(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x53c4
movq 0x58(%rsp), %r13
movq 0x88(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
xorl %esi, %esi
callq 0x2220
incl %r13d
jmp 0x3089
leaq 0x210(%rsp), %rdi
callq 0x2050
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
leaq 0x18(%rsp), %rbx
leaq 0x40(%rsp), %r14
je 0x31db
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x6dde(%rip), %rsi      # 0x9fc0
leaq 0x88(%rsp), %rdi
callq 0x2120
leaq 0x108(%rsp), %rdi
callq 0x2090
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x3213
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x322a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2180
leaq 0x210(%rsp), %rdi
callq 0x2060
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f9c(%rip), %rdi      # 0x71ec
movq %r14, %rsi
xorl %eax, %eax
leaq 0x18(%rsp), %r12
leaq 0x40(%rsp), %r13
callq 0x21d0
jmp 0x3283
movq %rax, %rbx
leaq 0x18(%rsp), %r12
leaq 0x40(%rsp), %r13
jmp 0x32a7
movq %rax, %rbx
jmp 0x32c8
jmp 0x3283
movq %rax, %rbx
jmp 0x3290
jmp 0x3283
movq %rax, %rbx
leaq 0x18(%rsp), %r12
leaq 0x40(%rsp), %r13
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x32a7
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x6d12(%rip), %rsi      # 0x9fc0
leaq 0x88(%rsp), %rdi
callq 0x2120
leaq 0x108(%rsp), %rdi
callq 0x2090
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x32df
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x32f6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2180
leaq 0x210(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2240
nop