// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: sort_bucket_read_lines(char*)
vector<char*>* sort_bucket_read_lines(char* bucket_fp)
{
	// Load the reads.
	vector<char*>* bucket_read_lines = buffer_file(bucket_fp);	
	vector<int>* read_starts = new vector<int>();
	vector<t_read_line_sorting_info*>* sorting_info_list = new vector<t_read_line_sorting_info*>();
	for(int i_read = 0; i_read < (int)bucket_read_lines->size(); i_read++)
	{
		int cur_read_start = 0;
		sscanf(bucket_read_lines->at(i_read), "%*s %*s %d", &cur_read_start);

		t_read_line_sorting_info* cur_line_info = new t_read_line_sorting_info();
		cur_line_info->start = cur_read_start;
		cur_line_info->read_line = bucket_read_lines->at(i_read);

		sorting_info_list->push_back(cur_line_info);
	} // i_read loop.

	sort(sorting_info_list->begin(), sorting_info_list->end(), sort_read_line_info);
	vector<char*>* sorted_bucket_read_lines = new vector<char*>();

	for(int i_read = 0; i_read < (int)sorting_info_list->size(); i_read++)
	{
		sorted_bucket_read_lines->push_back(sorting_info_list->at(i_read)->read_line);

		delete sorting_info_list->at(i_read);
	} // i_read loop.

	delete(sorting_info_list);
	delete(read_starts);

	delete(bucket_read_lines);

	return(sorted_bucket_read_lines);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
callq 0x2613e
movq %rax, %r14
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %ebx, %ebx
movq %rax, 0x20(%rsp)
movq %rbx, 0x10(%rax)
movl $0x18, %edi
callq 0x2180
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rbx, 0x10(%rax)
movq %r14, %rbx
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x11275
leaq 0x1ac12(%rip), %r13     # 0x2bddb
leaq 0xc(%rsp), %rbp
leaq 0x30(%rsp), %r14
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
cmpq %r12, %rdx
jbe 0x11529
movq (%rax,%r12,8), %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x2160
movl $0x10, %edi
callq 0x2180
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movq %rax, 0x30(%rsp)
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0x11529
movq (%rcx,%r12,8), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x11246
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0x11251
movq %r15, %rdi
movq %r14, %rdx
callq 0x12862
incq %r12
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
movq %rcx, %rdx
sarq $0x3, %rdx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r12
jl 0x111d6
movq (%r15), %r12
movq 0x8(%r15), %rbp
cmpq %rbp, %r12
je 0x11406
movq %rbx, 0x10(%rsp)
movq %rbp, %rbx
subq %r12, %rbx
movq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq 0x29b(%rip), %rcx       # 0x11546
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1299d
leaq 0x8(%r12), %r13
cmpq $0x81, %rbx
jl 0x11397
movq %rbp, 0x18(%rsp)
movl $0x8, %ebp
movq %r13, %r14
movq %r12, %r8
movq %r15, 0x28(%rsp)
movq %r8, %rcx
leaq (%r12,%rbp), %r8
movq (%r12,%rbp), %rbx
movq (%r12), %rdx
movl (%rbx), %eax
cmpl (%rdx), %eax
jge 0x11310
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r8, %r15
callq 0x22b0
movq %r15, %r8
movq 0x28(%rsp), %r15
movq %r12, %rcx
jmp 0x11333
movq (%rcx), %rdx
movq %r8, %rcx
cmpl (%rdx), %eax
jge 0x11333
movq %r14, %rdx
leaq -0x8(%rdx), %rcx
movq -0x10(%rdx), %rsi
movq -0x8(%rdx), %rdi
movq %rdi, (%rdx)
movq %rcx, %rdx
cmpl (%rsi), %eax
jl 0x1131d
movq %rbx, (%rcx)
addq $0x8, %rbp
addq $0x8, %r14
cmpq $0x80, %rbp
jne 0x112dd
subq $-0x80, %r12
movq 0x18(%rsp), %r9
cmpq %r9, %r12
movq 0x10(%rsp), %rbx
je 0x11406
movq -0x8(%r12), %rsi
movq (%r12), %rax
movl (%rax), %ecx
movq %r12, %rdx
cmpl (%rsi), %ecx
jge 0x11389
movq %r12, %rsi
leaq -0x8(%rsi), %rdx
movq -0x10(%rsi), %rdi
movq -0x8(%rsi), %r8
movq %r8, (%rsi)
movq %rdx, %rsi
cmpl (%rdi), %ecx
jl 0x11373
movq %rax, (%rdx)
addq $0x8, %r12
cmpq %r9, %r12
jne 0x1135e
jmp 0x11406
cmpq %rbp, %r13
movq 0x10(%rsp), %rbx
je 0x11406
movq %r12, %r14
movq %r14, %rdi
movq %r13, %r14
movq (%r13), %rbx
movq (%r12), %rcx
movl (%rbx), %eax
cmpl (%rcx), %eax
jge 0x113d2
movq %r14, %rdx
subq %r12, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r12, %rsi
callq 0x22b0
movq %r12, %rcx
jmp 0x113f5
movq (%rdi), %rdx
movq %r14, %rcx
cmpl (%rdx), %eax
jge 0x113f5
movq %r14, %rdx
leaq -0x8(%rdx), %rcx
movq -0x10(%rdx), %rsi
movq -0x8(%rdx), %rdi
movq %rdi, (%rdx)
movq %rcx, %rdx
cmpl (%rsi), %eax
jl 0x113df
movq %rbx, (%rcx)
leaq 0x8(%r14), %r13
cmpq %rbp, %r13
movq 0x10(%rsp), %rbx
jne 0x113a4
movl $0x18, %edi
callq 0x2180
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq (%r15), %rdi
movq 0x8(%r15), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x114b2
xorl %r13d, %r13d
cmpq %r13, %rdx
jbe 0x11535
movq (%rdi,%r13,8), %rdx
addq $0x8, %rdx
movq 0x8(%r12), %rsi
cmpq 0x10(%r12), %rsi
je 0x11461
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r12)
jmp 0x11469
movq %r12, %rdi
callq 0x12d32
movq (%r15), %rax
movq 0x8(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r13, %rdx
jbe 0x11535
movq (%rax,%r13,8), %rdi
testq %rdi, %rdi
je 0x11493
movl $0x10, %esi
callq 0x2190
incq %r13
movq (%r15), %rdi
movq 0x8(%r15), %rax
subq %rdi, %rax
movq %rax, %rdx
sarq $0x3, %rdx
shrq $0x3, %rax
cltq
cmpq %rax, %r13
jl 0x11436
testq %rdi, %rdi
je 0x114c3
movq 0x10(%r15), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %r15, %rdi
callq 0x2190
movq 0x20(%rsp), %r14
movq (%r14), %rdi
testq %rdi, %rdi
je 0x114e9
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %r14, %rdi
callq 0x2190
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1150a
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %rbx, %rdi
callq 0x2190
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c3a6(%rip), %rdi     # 0x2d8d6
movq %r12, %rsi
jmp 0x1153f
leaq 0x1c39a(%rip), %rdi     # 0x2d8d6
movq %r13, %rsi
xorl %eax, %eax
callq 0x2270