// File: /workspace/github_cpp_makefile_star2_O3/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 0x25af8
movq %rax, %r14
movl $0x18, %edi
callq 0x2180
movq %rax, %rbp
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %ebx, %ebx
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 0x1111d
movq %rbp, 0x18(%rsp)
leaq 0x19ef5(%rip), %r13     # 0x2add5
leaq 0xc(%rsp), %rbp
leaq 0x30(%rsp), %r14
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
cmpq %r12, %rdx
jbe 0x11237
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 0x11237
movq (%rcx,%r12,8), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x10f5d
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0x10f68
movq %r15, %rdi
movq %r14, %rdx
callq 0x12564
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 0x10eed
movq (%r15), %r12
movq 0x8(%r15), %rsi
cmpq %rsi, %r12
movq 0x18(%rsp), %rbp
je 0x1111d
movq %rbx, 0x10(%rsp)
movq %rsi, %rbx
subq %r12, %rbx
movq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq 0x28d(%rip), %rcx       # 0x11254
movq %r12, %rdi
movq %rsi, %r13
callq 0x1269f
leaq 0x8(%r12), %r8
cmpq $0x81, %rbx
movq %r13, 0x20(%rsp)
jl 0x110ae
movl $0x8, %r14d
movq %r8, %rbp
movq %r12, %rsi
movq %r13, %rdi
movq %rsi, %rcx
leaq (%r12,%r14), %rsi
movq (%r12,%r14), %rbx
movq (%r12), %rdx
movl (%rbx), %eax
cmpl (%rdx), %eax
jge 0x11035
movq %r8, %rdi
movq %rsi, 0x28(%rsp)
movq %r12, %rsi
movq %r14, %rdx
movq %r8, %r13
callq 0x22b0
movq %r13, %r8
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdi
movq %r12, %rcx
jmp 0x11051
movq (%rcx), %rdx
movq %rsi, %rcx
cmpl (%rdx), %eax
jge 0x11051
movq %rbp, %rcx
movq %rdx, (%rcx)
movq -0x10(%rcx), %rdx
addq $-0x8, %rcx
cmpl (%rdx), %eax
jl 0x11042
movq %rbx, (%rcx)
addq $0x8, %r14
addq $0x8, %rbp
cmpq $0x80, %r14
jne 0x10ff8
subq $-0x80, %r12
cmpq %rdi, %r12
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %rbp
je 0x1111d
movq -0x8(%r12), %rcx
movq (%r12), %rax
movl (%rax), %edx
movq %r12, %rsi
cmpl (%rcx), %edx
jge 0x110a0
movq %r12, %rsi
movq %rcx, (%rsi)
movq -0x10(%rsi), %rcx
addq $-0x8, %rsi
cmpl (%rcx), %edx
jl 0x11091
movq %rax, (%rsi)
addq $0x8, %r12
cmpq %rdi, %r12
jne 0x1107c
jmp 0x1111d
cmpq %r13, %r8
movq 0x10(%rsp), %rbx
je 0x1111d
movq %r13, %rsi
movq %r12, %r14
movq %r14, %rdi
movq %r8, %r14
movq (%r8), %rbx
movq (%r12), %rcx
movl (%rbx), %eax
cmpl (%rcx), %eax
jge 0x110f0
movq %r14, %rdx
subq %r12, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r12, %rsi
callq 0x22b0
movq 0x20(%rsp), %rsi
movq %r12, %rcx
jmp 0x1110c
movq (%rdi), %rdx
movq %r14, %rcx
cmpl (%rdx), %eax
jge 0x1110c
movq %r14, %rcx
movq %rdx, (%rcx)
movq -0x10(%rcx), %rdx
addq $-0x8, %rcx
cmpl (%rdx), %eax
jl 0x110fd
movq %rbx, (%rcx)
leaq 0x8(%r14), %r8
cmpq %rsi, %r8
movq 0x10(%rsp), %rbx
jne 0x110be
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 0x111c4
xorl %r13d, %r13d
cmpq %r13, %rdx
jbe 0x11243
movq (%rdi,%r13,8), %rdx
addq $0x8, %rdx
movq 0x8(%r12), %rsi
cmpq 0x10(%r12), %rsi
je 0x11178
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r12)
jmp 0x11180
movq %r12, %rdi
callq 0x12a12
movq (%r15), %rax
movq 0x8(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r13, %rdx
jbe 0x11243
movq (%rax,%r13,8), %rdi
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 0x1114d
testq %rdi, %rdi
je 0x111d5
movq 0x10(%r15), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %r15, %rdi
callq 0x2190
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x111f7
movq 0x10(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %rbp, %rdi
callq 0x2190
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x11218
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 0x1b692(%rip), %rdi     # 0x2c8d0
movq %r12, %rsi
jmp 0x1124d
leaq 0x1b686(%rip), %rdi     # 0x2c8d0
movq %r13, %rsi
xorl %eax, %eax
callq 0x2270