// File: liujan[P]randomforest/RandomForest.cpp
// Function: RandomForest::readTestSample(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool RandomForest::readTestSample(string file){
    ifstream test("test.csv");
    if (!test.is_open()){
        cout << "[Error] : Failed to open file " << file << endl;
        return false;
    }
    cout << "reading test sample ..." << endl;
    test_samples.clear();
    string s;
    getline(test, s); //过滤掉第一行标签
    
    double value;
    char dot;
    int id;
    
    while (true) {
        test >> id;
        if (test.eof())
            break;
        
        vector<double> features;
        for (int i = 0; i < numOfFeatures; i++){
            test >> dot;
            test >> value;
            features.push_back(value);
        }
        
        test_samples.push_back(make_pair(id, features));
        
        if (test.peek() == '\n')
            test.get();
    }
    
    test.close();
    cout << "reading test sample successful" << endl;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rsi, -0x2c0(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq 0x1cae(%rip), %rsi      # 0x101ea
leaq -0x220(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
movl $0x8, %edx
callq 0x2360
movq -0x2b0(%rbp), %rdi
callq 0x22f0
movb %al, -0x2a1(%rbp)
jmp 0xe568
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0xe5eb
jmp 0xe574
movq 0xaa5d(%rip), %rdi      # 0x18fd8
leaq 0x1c1c(%rip), %rsi      # 0x1019e
callq 0x21c0
movq %rax, -0x2c8(%rbp)
jmp 0xe590
movq -0x2c0(%rbp), %rsi
movq -0x2c8(%rbp), %rdi
callq 0x21b0
movq %rax, -0x2d0(%rbp)
jmp 0xe5ac
movq -0x2d0(%rbp), %rdi
movq 0xaa0e(%rip), %rsi      # 0x18fc8
callq 0x2200
jmp 0xe5c1
movb $0x0, -0x1(%rbp)
movl $0x1, -0x230(%rbp)
jmp 0xe866
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0xe880
movq 0xa9e6(%rip), %rdi      # 0x18fd8
leaq 0x1bfa(%rip), %rsi      # 0x101f3
callq 0x21c0
movq %rax, -0x2d8(%rbp)
jmp 0xe607
movq -0x2d8(%rbp), %rdi
movq 0xa9b3(%rip), %rsi      # 0x18fc8
callq 0x2200
jmp 0xe61c
movq -0x2b8(%rbp), %rdi
addq $0x18, %rdi
callq 0xea80
leaq -0x250(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x22a0
movq -0x2e0(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0x2050
jmp 0xe654
jmp 0xe656
jmp 0xe658
leaq -0x220(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x2100
jmp 0xe66d
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x2370
movb %al, -0x2e1(%rbp)
jmp 0xe68d
movb -0x2e1(%rbp), %al
testb $0x1, %al
jne 0xe699
jmp 0xe6b5
jmp 0xe7fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0xe858
leaq -0x278(%rbp), %rdi
callq 0xe980
movl $0x0, -0x27c(%rbp)
cmpl $0x269, -0x27c(%rbp)    # imm = 0x269
jge 0xe740
leaq -0x220(%rbp), %rdi
leaq -0x259(%rbp), %rsi
callq 0x2290
jmp 0xe6ec
leaq -0x220(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x2180
jmp 0xe701
leaq -0x278(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0xe9a0
jmp 0xe716
jmp 0xe718
movl -0x27c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x27c(%rbp)
jmp 0xe6cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0xe7ef
movq -0x2b8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x2f0(%rbp)
leaq -0x2a0(%rbp), %rdi
leaq -0x260(%rbp), %rsi
leaq -0x278(%rbp), %rdx
callq 0xea40
jmp 0xe76e
movq -0x2f0(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0xea10
jmp 0xe783
leaq -0x2a0(%rbp), %rdi
callq 0x2b50
leaq -0x220(%rbp), %rdi
callq 0x20b0
movl %eax, -0x2f4(%rbp)
jmp 0xe7a3
movl -0x2f4(%rbp), %eax
cmpl $0xa, %eax
jne 0xe7de
leaq -0x220(%rbp), %rdi
callq 0x2270
jmp 0xe7bc
jmp 0xe7de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x2b50
jmp 0xe7ef
leaq -0x278(%rbp), %rdi
callq 0x2b70
jmp 0xe656
leaq -0x278(%rbp), %rdi
callq 0x2b70
jmp 0xe858
leaq -0x220(%rbp), %rdi
callq 0x2060
jmp 0xe80b
movq 0xa7c6(%rip), %rdi      # 0x18fd8
leaq 0x19f2(%rip), %rsi      # 0x1020b
callq 0x21c0
movq %rax, -0x300(%rbp)
jmp 0xe827
movq -0x300(%rbp), %rdi
movq 0xa793(%rip), %rsi      # 0x18fc8
callq 0x2200
jmp 0xe83c
movb $0x1, -0x1(%rbp)
movl $0x1, -0x230(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x2110
jmp 0xe866
leaq -0x250(%rbp), %rdi
callq 0x2110
jmp 0xe880
leaq -0x220(%rbp), %rdi
callq 0x2070
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x2070
movq -0x228(%rbp), %rdi
callq 0x2330
nopl (%rax,%rax)