// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x598, %rsp            # imm = 0x598
movq %rsi, %r12
movq %rdi, %rbx
leaq -0x2a8(%rbp), %rdi
pushq $0x8
popq %rdx
movq %rbx, %rsi
callq 0x2370
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq -0x58(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %edx, %edx
movb %dl, (%rax)
movb %dl, (%rcx)
leaq -0x230(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x4347
movq 0x6d39(%rip), %rdi      # 0xafd8
leaq 0x31f9(%rip), %rsi      # 0x749f
callq 0x21d0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x2120
leaq -0x2a8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2050
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpb $0xd, -0x1(%rax,%rcx)
jne 0x42e2
movb $0x0, -0x1(%rax,%rcx)
leaq -0x430(%rbp), %rdi
leaq -0x48(%rbp), %rsi
pushq $0x18
popq %rdx
callq 0x22f0
leaq -0x430(%rbp), %rdi
leaq -0x68(%rbp), %rsi
pushq $0x9
popq %rdx
callq 0x2380
leaq -0x430(%rbp), %rbx
leaq -0x68(%rbp), %r14
pushq $0x9
popq %r15
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x2380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4384
cmpq $0x0, -0x60(%rbp)
je 0x4384
movq %r12, %rdi
movq %r14, %rsi
callq 0x586e
jmp 0x4317
movq 0x6c8a(%rip), %rdi      # 0xafd8
leaq 0x315e(%rip), %rsi      # 0x74b3
callq 0x21d0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21d0
leaq 0x3154(%rip), %rsi      # 0x74c0
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x2120
pushq $0x1
popq %rbx
jmp 0x44ad
leaq 0x18(%r12), %rax
movq %rax, -0x78(%rbp)
addq $0x30, %r12
movq %r12, -0x70(%rbp)
leaq -0x5b8(%rbp), %r13
leaq -0x68(%rbp), %r15
pushq $0x9
popq %r14
leaq -0xa0(%rbp), %r12
leaq -0x80(%rbp), %rbx
movq -0x2a8(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x288(%rbp,%rax)
jne 0x4493
leaq -0x2a8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2050
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
cmpb $0xd, -0x1(%rcx,%rax)
jne 0x43f0
movb $0x0, -0x1(%rcx,%rax)
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x4493
movq %r13, %rdi
leaq -0x48(%rbp), %rsi
pushq $0x18
popq %rdx
callq 0x22f0
movq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x2380
movq -0x78(%rbp), %rdi
movq %r15, %rsi
callq 0x586e
xorps %xmm0, %xmm0
movaps %xmm0, -0xa0(%rbp)
andq $0x0, -0x90(%rbp)
movq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x2380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4472
cmpq $0x0, -0x60(%rbp)
je 0x4472
movq -0x68(%rbp), %rdi
callq 0x2230
movsd %xmm0, -0x80(%rbp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x61d4
jmp 0x4434
movq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0x58aa
movq %r12, %rdi
callq 0x3a3e
movq %r13, %rdi
callq 0x2160
jmp 0x43af
leaq -0x2a8(%rbp), %rdi
callq 0x2070
leaq -0x430(%rbp), %rdi
callq 0x2160
xorl %ebx, %ebx
leaq -0x68(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
callq 0x2110
leaq -0x2a8(%rbp), %rdi
callq 0x20a0
movl %ebx, %eax
addq $0x598, %rsp            # imm = 0x598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x44e3
jmp 0x44f3
movq %rax, %rbx
jmp 0x4521
jmp 0x44fa
jmp 0x44f3
jmp 0x44f3
movq %rax, %rbx
jmp 0x4509
movq %rax, %rbx
jmp 0x4515
jmp 0x44fa
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x3a3e
leaq -0x5b8(%rbp), %rdi
callq 0x2160
leaq -0x430(%rbp), %rdi
callq 0x2160
leaq -0x68(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
callq 0x2110
leaq -0x2a8(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2340