// File: WeiqiangZhou[P]BIRD/source/predict_function.cpp
// Function: ReadinExon(char*, Exondata*)
int ReadinExon(char filename[255], Exondata *indata)  
{
	std::ifstream infile(filename);
	std::string line_temp;
	std::string line_token;

	if (infile.is_open())
	{
		std::cout << "Reading input file " << filename << std::endl;
		std::getline(infile, line_temp);
                if(line_temp[line_temp.length()-1]=='\r') {line_temp[line_temp.length()-1] = '\0';}     //handle windows file
		std::stringstream each_line(line_temp);
		std::getline(each_line, line_token, '\t');          //ignore the first string 'TranscriptCluster'
		while (std::getline(each_line, line_token, '\t'))
		{
			if (line_token.empty()){ break;}
			indata->sample_name.push_back(line_token);
		}

		while (!infile.eof())
		{
			std::getline(infile, line_temp);
                        if(line_temp[line_temp.length()-1]=='\r') {line_temp[line_temp.length()-1] = '\0';}
			if (line_temp.empty()){ break; }
			std::stringstream each_line(line_temp);
			std::getline(each_line, line_token, '\t');
			indata->TC_name.push_back(line_token);
			std::vector<double> data_temp;
			while (std::getline(each_line, line_token, '\t'))
			{
				if (line_token.empty()){ break;}
				data_temp.push_back(atof(line_token.c_str()));
			}
			indata->data.push_back(data_temp);
		}

		infile.close();
	}
	else
	{
		std::cout << "Error! File " << filename << " not found!" << std::endl;
		return 1;
	}

	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x650, %rsp            # imm = 0x650
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x220(%rbp), %rdi
movq %rdi, -0x5b0(%rbp)
movl $0x8, %edx
callq 0x23f0
leaq -0x240(%rbp), %rdi
callq 0x22b0
leaq -0x260(%rbp), %rdi
callq 0x22b0
movq -0x5b0(%rbp), %rdi
callq 0x2350
movb %al, -0x5a5(%rbp)
jmp 0x71ab
movb -0x5a5(%rbp), %al
testb $0x1, %al
jne 0x71ba
jmp 0x7604
movq 0xee17(%rip), %rdi      # 0x15fd8
leaq 0x8343(%rip), %rsi      # 0xf50b
callq 0x21c0
movq %rax, -0x5b8(%rbp)
jmp 0x71d6
movq -0x5b8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x21c0
movq %rax, -0x5c0(%rbp)
jmp 0x71ef
movq -0x5c0(%rbp), %rdi
movq 0xedc3(%rip), %rsi      # 0x15fc0
callq 0x2200
jmp 0x7204
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2050
jmp 0x7219
leaq -0x240(%rbp), %rdi
movq %rdi, -0x5d0(%rbp)
callq 0x2300
movq -0x5d0(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x2430
movq %rax, -0x5c8(%rbp)
jmp 0x7247
movq -0x5c8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x72a7
leaq -0x240(%rbp), %rdi
movq %rdi, -0x5e0(%rbp)
callq 0x2300
movq -0x5e0(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x2430
movq %rax, -0x5d8(%rbp)
jmp 0x7284
movq -0x5d8(%rbp), %rax
movb $0x0, (%rax)
jmp 0x72a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x76be
movl $0x10, %edi
movl $0x8, %esi
callq 0x9a40
movl %eax, -0x5e4(%rbp)
jmp 0x72be
movl -0x5e4(%rbp), %edx
leaq -0x3f8(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2340
jmp 0x72d9
leaq -0x3f8(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0x9, %edx
callq 0x2410
jmp 0x72f3
jmp 0x72f5
leaq -0x3f8(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0x9, %edx
callq 0x2410
movq %rax, -0x5f0(%rbp)
jmp 0x7316
movq -0x5f0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2250
movb %al, -0x5f1(%rbp)
jmp 0x7334
movb -0x5f1(%rbp), %al
testb $0x1, %al
jne 0x7340
jmp 0x7382
leaq -0x260(%rbp), %rdi
callq 0x2380
testb $0x1, %al
jne 0x7352
jmp 0x736b
jmp 0x7382
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x75f3
movq -0x18(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x9a60
jmp 0x737d
jmp 0x72f5
jmp 0x7384
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x2400
movb %al, -0x5f2(%rbp)
jmp 0x73a4
movb -0x5f2(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x73b5
jmp 0x75d4
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2050
jmp 0x73ca
leaq -0x240(%rbp), %rdi
movq %rdi, -0x608(%rbp)
callq 0x2300
movq -0x608(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x2430
movq %rax, -0x600(%rbp)
jmp 0x73f8
movq -0x600(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x743f
leaq -0x240(%rbp), %rdi
movq %rdi, -0x618(%rbp)
callq 0x2300
movq -0x618(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x2430
movq %rax, -0x610(%rbp)
jmp 0x7435
movq -0x610(%rbp), %rax
movb $0x0, (%rax)
leaq -0x240(%rbp), %rdi
callq 0x2380
testb $0x1, %al
jne 0x7451
jmp 0x7456
jmp 0x75d4
movl $0x10, %edi
movl $0x8, %esi
callq 0x9a40
movl %eax, -0x61c(%rbp)
jmp 0x746d
movl -0x61c(%rbp), %edx
leaq -0x580(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2340
jmp 0x7488
leaq -0x580(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0x9, %edx
callq 0x2410
jmp 0x74a2
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
leaq -0x260(%rbp), %rsi
callq 0x9a60
jmp 0x74b8
leaq -0x598(%rbp), %rdi
callq 0x9ad0
leaq -0x580(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0x9, %edx
callq 0x2410
movq %rax, -0x628(%rbp)
jmp 0x74e5
movq -0x628(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2250
movb %al, -0x629(%rbp)
jmp 0x7503
movb -0x629(%rbp), %al
testb $0x1, %al
jne 0x7512
jmp 0x7593
leaq -0x260(%rbp), %rdi
callq 0x2380
testb $0x1, %al
jne 0x7524
jmp 0x755d
jmp 0x7593
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x75c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
leaq -0x598(%rbp), %rdi
callq 0x5e90
jmp 0x75c6
leaq -0x260(%rbp), %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x2240
movsd %xmm0, -0x5a0(%rbp)
leaq -0x598(%rbp), %rdi
leaq -0x5a0(%rbp), %rsi
callq 0x9af0
jmp 0x758e
jmp 0x74c4
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
leaq -0x598(%rbp), %rsi
callq 0x9b20
jmp 0x75a9
leaq -0x598(%rbp), %rdi
callq 0x5e90
leaq -0x580(%rbp), %rdi
callq 0x2160
jmp 0x7384
leaq -0x580(%rbp), %rdi
callq 0x2160
jmp 0x75f3
leaq -0x220(%rbp), %rdi
callq 0x2070
jmp 0x75e2
leaq -0x3f8(%rbp), %rdi
callq 0x2160
jmp 0x767d
leaq -0x3f8(%rbp), %rdi
callq 0x2160
jmp 0x76be
movq 0xe9cd(%rip), %rdi      # 0x15fd8
leaq 0x7f0d(%rip), %rsi      # 0xf51f
callq 0x21c0
movq %rax, -0x638(%rbp)
jmp 0x7620
movq -0x638(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x21c0
movq %rax, -0x640(%rbp)
jmp 0x7639
movq -0x640(%rbp), %rdi
leaq 0x7ee5(%rip), %rsi      # 0xf52c
callq 0x21c0
movq %rax, -0x648(%rbp)
jmp 0x7655
movq -0x648(%rbp), %rdi
movq 0xe95d(%rip), %rsi      # 0x15fc0
callq 0x2200
jmp 0x766a
movl $0x1, -0x4(%rbp)
movl $0x1, -0x5a4(%rbp)
jmp 0x768e
movl $0x0, -0x4(%rbp)
movl $0x1, -0x5a4(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x2140
leaq -0x240(%rbp), %rdi
callq 0x2140
leaq -0x220(%rbp), %rdi
callq 0x2090
movl -0x4(%rbp), %eax
addq $0x650, %rsp            # imm = 0x650
popq %rbp
retq
leaq -0x260(%rbp), %rdi
callq 0x2140
leaq -0x240(%rbp), %rdi
callq 0x2140
leaq -0x220(%rbp), %rdi
callq 0x2090
movq -0x268(%rbp), %rdi
callq 0x23b0
nop