// File: 8igMac[P]random-forest/src/main.cpp
// Function: main
int main(int argc, char** argv)
{
	formatHandler fmhdlr;
	dataSet data_set;
	vector<data_inst> TrainSet, ValiSet;
	random_forest Forest;
	vector<string> formatTb;

	if (argc != 3)
		cout << "usage: ./main data-set data-format" << endl;

	// handle data format
	formatTb = fmhdlr.handle_format(argv[2]);

	cout << "get data from file ... ";
	// extract data from file
	data_set.get_data_from_file(argv[1], fmhdlr.get_num_attr(), fmhdlr.get_num_cls(), formatTb);
	cout << "done" << endl;

	cout << "split data ... ";
	// split data into training subset and
	// validation subset
	data_set.split_data(TrainSet, ValiSet);
	cout << "done" << endl;

	cout << "building forest ... " << endl;
	// build forest
	Forest.build_forest(TrainSet);
	cout << "done" << endl;
	
	// validate and analyse accuracy
	analyser alyzr(formatTb);
	alyzr.analyse(Forest, ValiSet);
	alyzr.print_result(fmhdlr.get_num_inst());
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2880
leaq -0x50(%rbp), %rdi
callq 0x28a0
leaq -0x68(%rbp), %rdi
callq 0x28a0
leaq -0x80(%rbp), %rdi
callq 0x6d20
jmp 0x245f
leaq -0xa8(%rbp), %rdi
callq 0x28c0
cmpl $0x3, -0x8(%rbp)
je 0x24d2
movq 0x14b58(%rip), %rdi     # 0x16fd0
leaq 0xcb85(%rip), %rsi      # 0xf004
callq 0x2160
movq %rax, -0x158(%rbp)
jmp 0x248d
movq -0x158(%rbp), %rdi
movq 0x14b25(%rip), %rsi     # 0x16fc0
callq 0x2190
jmp 0x24a2
jmp 0x24d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x284e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x2839
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
leaq -0xc0(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x7840
jmp 0x24ec
leaq -0xa8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movq %rsi, -0x160(%rbp)
callq 0x28e0
movq -0x160(%rbp), %rdi
callq 0x2910
movq 0x14ab7(%rip), %rdi     # 0x16fd0
leaq 0xcb07(%rip), %rsi      # 0xf027
callq 0x2160
jmp 0x2527
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x170(%rbp)
leaq -0x1c(%rbp), %rdi
callq 0x7a00
movl %eax, -0x164(%rbp)
jmp 0x2547
leaq -0x1c(%rbp), %rdi
callq 0x7a10
movl %eax, -0x174(%rbp)
jmp 0x2558
leaq -0xd8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2970
jmp 0x256d
movl -0x174(%rbp), %ecx
movl -0x164(%rbp), %edx
movq -0x170(%rbp), %rsi
leaq -0x38(%rbp), %rdi
leaq -0xd8(%rbp), %r8
callq 0x4ed0
jmp 0x2592
leaq -0xd8(%rbp), %rdi
callq 0x2910
movq 0x14a2b(%rip), %rdi     # 0x16fd0
leaq 0xca93(%rip), %rsi      # 0xf03f
callq 0x2160
movq %rax, -0x180(%rbp)
jmp 0x25ba
movq -0x180(%rbp), %rdi
movq 0x149f8(%rip), %rsi     # 0x16fc0
callq 0x2190
jmp 0x25cf
movq 0x149fa(%rip), %rdi     # 0x16fd0
leaq 0xca67(%rip), %rsi      # 0xf044
callq 0x2160
jmp 0x25e4
leaq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x5560
jmp 0x25f7
movq 0x149d2(%rip), %rdi     # 0x16fd0
leaq 0xca3a(%rip), %rsi      # 0xf03f
callq 0x2160
movq %rax, -0x188(%rbp)
jmp 0x2613
movq -0x188(%rbp), %rdi
movq 0x1499f(%rip), %rsi     # 0x16fc0
callq 0x2190
jmp 0x2628
movq 0x149a1(%rip), %rdi     # 0x16fd0
leaq 0xca1e(%rip), %rsi      # 0xf054
callq 0x2160
movq %rax, -0x190(%rbp)
jmp 0x2644
movq -0x190(%rbp), %rdi
movq 0x1496e(%rip), %rsi     # 0x16fc0
callq 0x2190
jmp 0x2659
leaq -0xf0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2a60
jmp 0x266b
leaq -0x80(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x6d90
jmp 0x267d
leaq -0xf0(%rbp), %rdi
callq 0x2b50
movq 0x14940(%rip), %rdi     # 0x16fd0
leaq 0xc9a8(%rip), %rsi      # 0xf03f
callq 0x2160
movq %rax, -0x198(%rbp)
jmp 0x26a5
movq -0x198(%rbp), %rdi
movq 0x1490d(%rip), %rsi     # 0x16fc0
callq 0x2190
jmp 0x26ba
leaq -0x138(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2970
jmp 0x26cf
leaq -0x120(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x7270
jmp 0x26e4
leaq -0x138(%rbp), %rdi
callq 0x2910
leaq -0x150(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2a60
jmp 0x2702
leaq -0x120(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x7390
jmp 0x271b
leaq -0x150(%rbp), %rdi
callq 0x2b50
leaq -0x1c(%rbp), %rdi
callq 0x7a30
movl %eax, -0x19c(%rbp)
jmp 0x2738
movl -0x19c(%rbp), %esi
leaq -0x120(%rbp), %rdi
callq 0x7600
jmp 0x274c
movl $0x0, -0x4(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x2bb0
leaq -0xa8(%rbp), %rdi
callq 0x2910
leaq -0x80(%rbp), %rdi
callq 0x2be0
leaq -0x68(%rbp), %rdi
callq 0x2b50
leaq -0x50(%rbp), %rdi
callq 0x2b50
leaq -0x38(%rbp), %rdi
callq 0x2c00
movl -0x4(%rbp), %eax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x2910
jmp 0x2839
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x2b50
jmp 0x2839
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x2910
jmp 0x2839
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x282d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x2b50
leaq -0x120(%rbp), %rdi
callq 0x2bb0
leaq -0xa8(%rbp), %rdi
callq 0x2910
leaq -0x80(%rbp), %rdi
callq 0x2be0
leaq -0x68(%rbp), %rdi
callq 0x2b50
leaq -0x50(%rbp), %rdi
callq 0x2b50
leaq -0x38(%rbp), %rdi
callq 0x2c00
movq -0x88(%rbp), %rdi
callq 0x2270
nopw %cs:(%rax,%rax)
nop