// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]multi_thread_randomforest/RandomForest.cpp
// Function: RandomForest::readTrainSample(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool RandomForest::readTrainSample(string file){
	ifstream train("train.csv");
	if (!train.is_open()){
		cout << "[Error] : Failed to open file " << file << endl;
		return false;
	}
	cout << "reading sample ..." << endl;

	string s;
	getline(train, s); //���˵���һ�б�ǩ

	double value;
	char dot;
	int id;
	int label;
	while (true) {
		train >> id;
		if (train.eof())
			break;
		
		
		vector<double> features;
		for (int i = 0; i < numOfFeatures; i++){
			train >> dot;
			train >> value;
			features.push_back(value);
		}
		train >> dot;
		train >> label;
		all_samples.push_back(make_pair(label, features));

		if (train.peek() == '\n')
			train.get();
	}

	train.close();
	cout << "reading sample successful" << endl;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
leaq 0xf10(%rip), %rsi       # 0x61b4
leaq -0x2b0(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2310
leaq -0x238(%rbp), %rdi
callq 0x2070
movl %eax, %r14d
testb %al, %al
je 0x53e6
movq 0x4d07(%rip), %rdi      # 0x9fd8
leaq 0xf05(%rip), %rsi       # 0x61dd
callq 0x21e0
movq %rax, %rdi
callq 0x2100
movb %r14b, -0x29(%rbp)
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x2b0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2050
leaq -0x2b0(%rbp), %r12
leaq -0x2a(%rbp), %rbx
leaq -0x60(%rbp), %r13
leaq -0x88(%rbp), %r14
movq %r12, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x2130
movq -0x2b0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x290(%rbp,%rax)
jne 0x540e
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
andq $0x0, -0x50(%rbp)
movl $0x269, %r15d           # imm = 0x269
subl $0x1, %r15d
jb 0x5385
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2260
movq %r12, %rdi
movq %r14, %rsi
callq 0x2140
movq %r13, %rdi
movq %r14, %rsi
callq 0x56f8
jmp 0x535c
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2260
movq %r12, %rdi
leaq -0x30(%rbp), %rsi
callq 0x2130
movl -0x30(%rbp), %eax
movl %eax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
movq %r13, %rsi
callq 0x2864
movq -0x38(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x5844
leaq -0x78(%rbp), %rdi
callq 0x26c6
movq %r12, %rdi
callq 0x20c0
cmpl $0xa, %eax
jne 0x53d9
movq %r12, %rdi
callq 0x2240
movq %r13, %rdi
callq 0x26c6
jmp 0x5325
movq 0x4beb(%rip), %rdi      # 0x9fd8
leaq 0xdca(%rip), %rsi       # 0x61be
callq 0x21e0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x2100
jmp 0x5445
leaq -0x2b0(%rbp), %rdi
callq 0x2060
movq 0x4bb7(%rip), %rdi      # 0x9fd8
leaq 0xdc8(%rip), %rsi       # 0x61f0
callq 0x21e0
movq %rax, %rdi
callq 0x2100
leaq -0xa8(%rbp), %rdi
callq 0x20f0
movb -0x29(%rbp), %r14b
leaq -0x2b0(%rbp), %rdi
callq 0x2080
movl %r14d, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x547f
jmp 0x547f
movq %rax, %rbx
jmp 0x549e
jmp 0x5486
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x26c6
jmp 0x5489
movq %rax, %rbx
jmp 0x5492
jmp 0x5486
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x26c6
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0x2b0(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22e0