// File: /workspace/github_cpp_makefile_star2_O2/gersteinlab[P]MUSIC/src/ms_annot_region_tools.cpp
// Function: load_Interval(char*)
vector<t_annot_region*>* load_Interval(char* interval_fp)
{
	vector<t_annot_region*>* composite_interval_regions = new vector<t_annot_region*>();

	FILE* f_interval = open_f(interval_fp, "r");
	char* cur_line = getline(f_interval);
	while(cur_line != NULL)
	{
		bool skip_line = check_line_skip(cur_line);

		if(!skip_line)
		{
			// ENST00000469418.1|ENST00000480075.1     chr7    -       19757   35479   4       19757,20834,31060,35335 19895,21029,31606,35479
			char region_name[1000];
			char cur_chrom[1000];
			char cur_strand;
			int cur_start;
			int cur_end;
			int n_intervals;
			char int_starts[100000];
			char int_ends[100000];

			if(sscanf(cur_line, "%s %s %c %d %d %d %s %s", region_name, cur_chrom, 
				&cur_strand, &cur_start, &cur_end, &n_intervals, int_starts, int_ends) == 8)
			{
				t_annot_region* new_int_comp_region = new t_annot_region();
				new_int_comp_region->chrom = t_string::copy_me_str(cur_chrom);
				normalize_chr_id(new_int_comp_region->chrom);
				new_int_comp_region->start = translate_coord(cur_start, INTERVAL_COORDS::start_base, CODEBASE_COORDS::start_base);
				new_int_comp_region->end = translate_coord(cur_end, INTERVAL_COORDS::end_base, CODEBASE_COORDS::end_base);
				new_int_comp_region->strand = cur_strand;
				new_int_comp_region->name = t_string::copy_me_str(region_name);
				new_int_comp_region->intervals = new vector<t_annot_region*>();

				// Allocate the interval.
				vector<t_annot_region*>* intervals = new vector<t_annot_region*>();
				t_string* starts_str = new t_string(int_starts);
				t_string* ends_str = new t_string(int_ends);
				vector<int>* starts = starts_str->get_integers_in_string();
				vector<int>* ends = ends_str->get_integers_in_string();

				if(starts->size() != ends->size())
				{
					fprintf(stderr, "The number of starts is not the same as ends in:\n%s\n", cur_line);
					exit(0);
				}

				// Parse all the intervals.
				for(int i_int = 0; i_int < (int)starts->size(); i_int++)
				{
					t_annot_region* new_interval = new t_annot_region();
					new_interval->chrom = t_string::copy_me_str(cur_chrom);
					normalize_chr_id(new_interval->chrom);
					new_interval->start = translate_coord(starts->at(i_int), INTERVAL_COORDS::start_base, CODEBASE_COORDS::start_base);
					new_interval->end = translate_coord(ends->at(i_int), INTERVAL_COORDS::end_base, CODEBASE_COORDS::end_base);

					if(ends->at(i_int) < starts->at(i_int))
					{
						fprintf(stderr, "One of the starts is larger than the end for:\n%s\n", cur_line);
						exit(0);
					}

					new_interval->strand = cur_strand;

					intervals->push_back(new_interval);
				} // i_int loop.

				new_int_comp_region->intervals = intervals;

				composite_interval_regions->push_back(new_int_comp_region);
			}
			else
			{
				fprintf(stderr, "Could not parse:\n%s\n", cur_line);
				exit(0);
			}
		} // skip_line check.

		delete [] cur_line;

		// Read the next line.
		cur_line = getline(f_interval);
	}
	fclose(f_interval);

	return(composite_interval_regions);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x31568, %rsp          # imm = 0x31568
movq %rdi, %rbx
pushq $0x18
popq %rdi
callq 0x2170
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x28(%rsp)
andq $0x0, 0x10(%rax)
leaq 0x12562(%rip), %rsi     # 0x26d08
movq %rbx, %rdi
callq 0x2027c
movq %rax, %rbx
movq %rax, %rdi
callq 0x2017f
movq %rax, %r12
leaq 0x18ec0(%rsp), %r15
leaq 0x40(%rsp), %r14
leaq 0x430(%rsp), %r13
movq %rbx, 0x30(%rsp)
testq %r12, %r12
je 0x14a55
movq %r12, %rdi
callq 0x13e9f
testb %al, %al
jne 0x14a3d
movq %r12, %rdi
leaq 0x1336a(%rip), %rsi     # 0x27b63
movq %r14, %rdx
movq %r13, %rcx
leaq 0x7(%rsp), %r8
leaq 0x24(%rsp), %r9
xorl %eax, %eax
leaq 0x820(%rsp), %r10
pushq %r10
pushq %r15
leaq 0x4c(%rsp), %r10
pushq %r10
leaq 0x38(%rsp), %r10
pushq %r10
callq 0x2150
addq $0x20, %rsp
cmpl $0x8, %eax
jne 0x14a98
pushq $0x50
popq %rdi
callq 0x2170
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x40(%rax)
movq %rax, 0x10(%rsp)
movq %r13, %rdi
callq 0x21062
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0xf63c
movl 0x24(%rsp), %eax
incl %eax
movq 0x10(%rsp), %rcx
movl %eax, 0xc(%rcx)
movl 0x20(%rsp), %eax
movl %eax, 0x20(%rcx)
movb 0x7(%rsp), %al
movb %al, 0x8(%rcx)
movq %r14, %rdi
callq 0x21062
movq 0x10(%rsp), %rbx
movq %rax, 0x18(%rbx)
pushq $0x18
popq %r14
movq %r14, %rdi
callq 0x2170
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rax, 0x30(%rbx)
movq %r14, %rdi
callq 0x2170
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
pushq $0x8
popq %rbp
movq %rbp, %rdi
callq 0x2170
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x20c04
movq %rbp, %rdi
callq 0x2170
movq %rax, %r15
movq %rax, %rdi
leaq 0x820(%rsp), %rsi
callq 0x20c04
movq %r12, 0x18(%rsp)
movq %r14, %rdi
callq 0x212d6
movq %rax, %r12
movq %r15, %rdi
callq 0x212d6
movq %rax, %r15
movq (%r12), %rcx
movq 0x8(%r12), %rax
movq %rax, %rdx
subq %rcx, %rdx
movq 0x8(%r15), %rsi
subq (%r15), %rsi
cmpq %rsi, %rdx
jne 0x14aae
xorl %r14d, %r14d
subq %rcx, %rax
shrq $0x2, %rax
cltq
cmpq %rax, %r14
jge 0x14a0e
pushq $0x50
popq %rdi
callq 0x2170
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x40(%rax)
movq %rax, 0x8(%rsp)
movq %r13, %rdi
callq 0x21062
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0xf63c
movq %r12, %rdi
movq %r14, %rsi
callq 0x7364
movl (%rax), %eax
incl %eax
movq 0x8(%rsp), %rcx
movl %eax, 0xc(%rcx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x7364
movl (%rax), %eax
movq 0x8(%rsp), %rcx
movl %eax, 0x20(%rcx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x7364
movl (%rax), %ebp
movq %r12, %rdi
movq %r14, %rsi
callq 0x7364
cmpl (%rax), %ebp
jl 0x14a74
movb 0x7(%rsp), %al
movq 0x8(%rsp), %rcx
movb %al, 0x8(%rcx)
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x7448
incq %r14
movq (%r12), %rcx
movq 0x8(%r12), %rax
jmp 0x14946
movq 0x10(%rsp), %rax
movq %rbx, 0x30(%rax)
movq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x7448
movq 0x18(%rsp), %r12
movq 0x30(%rsp), %rbx
leaq 0x18ec0(%rsp), %r15
leaq 0x40(%rsp), %r14
movq %r12, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x2017f
movq %rax, %r12
jmp 0x147d6
movq %rbx, %rdi
callq 0x2160
movq 0x28(%rsp), %rax
addq $0x31568, %rsp          # imm = 0x31568
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20565(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x1312b(%rip), %rsi     # 0x27bb0
movq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x2240
xorl %edi, %edi
callq 0x21d0
movq 0x20541(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x13139(%rip), %rsi     # 0x27be2
movq %r12, %rdx
jmp 0x14a8a
movq 0x2052b(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x130bc(%rip), %rsi     # 0x27b7b
jmp 0x14a85
movq %rax, %rbx
jmp 0x14acc
movq %rax, %rbx
movq %r15, %r14
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x2180
movq %rbx, %rdi
callq 0x22d0