// File: /workspace/github_cpp_makefile_star2_O1/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 0x529e
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 0x3115
movq %r12, %rdi
movl $0x2c, %esi
xorl %edx, %edx
callq 0x21b0
cmpq $-0x1, %rax
je 0x3033
movq 0x8(%rsp), %rcx
movb $0x20, (%rcx,%rax)
jmp 0x3013
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x98(%rsp), %rdi
callq 0x2190
cmpl $0x0, 0x2c(%rsp)
jle 0x306d
xorl %r14d, %r14d
movq 0x68(%rsp), %rsi
addq %r14, %rsi
movq %r15, %rdi
callq 0x2270
addq $0x4, %r14
cmpq %r14, %rbp
jne 0x3054
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 0x30e3
xorl %r13d, %r13d
xorl %r14d, %r14d
cmpq %r14, %rdx
jbe 0x31b1
addq %r13, %rsi
leaq 0x30(%rsp), %rdi
callq 0x2040
testl %eax, %eax
je 0x30db
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 0x309c
jmp 0x30e3
movl %r14d, 0x80(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x5328
movq 0x58(%rsp), %r13
movq 0x88(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
xorl %esi, %esi
callq 0x2220
incl %r13d
jmp 0x2ff1
leaq 0x210(%rsp), %rdi
callq 0x2050
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
leaq 0x18(%rsp), %rbx
leaq 0x40(%rsp), %r14
je 0x3143
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x6e76(%rip), %rsi      # 0x9fc0
leaq 0x88(%rsp), %rdi
callq 0x2120
leaq 0x108(%rsp), %rdi
callq 0x2090
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x317b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x3192
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 0x4008(%rip), %rdi      # 0x71c0
movq %r14, %rsi
xorl %eax, %eax
leaq 0x18(%rsp), %r12
leaq 0x40(%rsp), %r13
callq 0x21d0
jmp 0x31eb
movq %rax, %rbx
leaq 0x18(%rsp), %r12
leaq 0x40(%rsp), %r13
jmp 0x320f
movq %rax, %rbx
jmp 0x3230
jmp 0x31eb
movq %rax, %rbx
jmp 0x31f8
jmp 0x31eb
movq %rax, %rbx
leaq 0x18(%rsp), %r12
leaq 0x40(%rsp), %r13
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x320f
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x6daa(%rip), %rsi      # 0x9fc0
leaq 0x88(%rsp), %rdi
callq 0x2120
leaq 0x108(%rsp), %rdi
callq 0x2090
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x3247
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x325e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2180
leaq 0x210(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2240
nop