// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_annot_region_tools.cpp
// Function: merge_annot_regions(std::vector<t_annot_region*, std::allocator<t_annot_region*>>*, std::vector<t_annot_region*, std::allocator<t_annot_region*>>*, int, bool)
vector<t_annot_region*>* merge_annot_regions(vector<t_annot_region*>* annot_regions1,
											vector<t_annot_region*>* annot_regions2,
											int max_gap, 
											bool match_strands) // Maximum distance between two annotated regions that are in the merged region.
{
	fprintf(stderr, "Merging %ld versus %ld regions.\n", annot_regions1->size(), annot_regions2->size());

	vector<t_annot_region*>* total_annot_regions = new vector<t_annot_region*>();
	for(int i = 0; i < (int)annot_regions1->size(); i++)
	{
		total_annot_regions->push_back(annot_regions1->at(i));
	} // i loop.

	for(int i = 0; i < (int)annot_regions2->size(); i++)
	{
		total_annot_regions->push_back(annot_regions2->at(i));
	} // i loop.

	vector<t_annot_region*>* merged_annot_regions = merge_annot_regions(total_annot_regions,
																			max_gap, 
																			match_strands);

	delete(total_annot_regions);

	return(merged_annot_regions);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, %r12
movq 0x35582(%rip), %rax     # 0x39fe0
movq (%rax), %rdi
movq 0x8(%r12), %rdx
subq (%r12), %rdx
sarq $0x3, %rdx
movq 0x8(%rsi), %rcx
subq (%rsi), %rcx
sarq $0x3, %rcx
leaq 0x2a3c7(%rip), %rsi     # 0x2ee47
xorl %eax, %eax
callq 0x2250
pushq $0x18
popq %rdi
callq 0x2180
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq (%r12), %rdx
movq 0x8(%r12), %rax
subq %rdx, %rax
sarq $0x3, %rax
testl %eax, %eax
jle 0x4b07
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpq %r13, %rax
jbe 0x4bb1
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x4ad9
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0x4ae1
movq %r15, %rdi
callq 0xb976
incq %r13
movq (%r12), %rdx
movq 0x8(%r12), %rcx
subq %rdx, %rcx
movq %rcx, %rax
sarq $0x3, %rax
shrq $0x3, %rcx
movslq %ecx, %rcx
addq $0x8, %rbx
cmpq %rcx, %r13
jl 0x4ab6
movq (%r14), %rdx
movq 0x8(%r14), %rax
subq %rdx, %rax
sarq $0x3, %rax
testl %eax, %eax
jle 0x4b6d
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpq %r12, %rax
jbe 0x4bbd
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x4b41
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0x4b49
movq %r15, %rdi
callq 0xb976
incq %r12
movq (%r14), %rdx
movq 0x8(%r14), %rcx
subq %rdx, %rcx
movq %rcx, %rax
sarq $0x3, %rax
shrq $0x3, %rcx
movslq %ecx, %rcx
addq $0x8, %rbx
cmpq %rcx, %r12
jl 0x4b1e
movzbl %bpl, %edx
movq %r15, %rdi
movl 0x4(%rsp), %esi
callq 0x1ab1c
movq %rax, %rbx
movq (%r15), %rdi
testq %rdi, %rdi
je 0x4b94
movq 0x10(%r15), %rsi
subq %rdi, %rsi
callq 0x2190
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x2190
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28d1e(%rip), %rdi     # 0x2d8d6
movq %r13, %rsi
jmp 0x4bc7
leaq 0x28d12(%rip), %rdi     # 0x2d8d6
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2270