// File: /workspace/github_cpp_makefile_star2_O3/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 0x346ed(%rip), %rax     # 0x38fe0
movq (%rax), %rdi
movq 0x8(%r12), %rdx
subq (%r12), %rdx
sarq $0x3, %rdx
movq 0x8(%rsi), %rcx
subq (%rsi), %rcx
sarq $0x3, %rcx
leaq 0x29532(%rip), %rsi     # 0x2de47
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 0x499c
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpq %r13, %rax
jbe 0x4a46
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x496e
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0x4976
movq %r15, %rdi
callq 0xb74c
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 0x494b
movq (%r14), %rdx
movq 0x8(%r14), %rax
subq %rdx, %rax
sarq $0x3, %rax
testl %eax, %eax
jle 0x4a02
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpq %r12, %rax
jbe 0x4a52
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x49d6
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0x49de
movq %r15, %rdi
callq 0xb74c
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 0x49b3
movzbl %bpl, %edx
movq %r15, %rdi
movl 0x4(%rsp), %esi
callq 0x1a6af
movq %rax, %rbx
movq (%r15), %rdi
testq %rdi, %rdi
je 0x4a29
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 0x27e83(%rip), %rdi     # 0x2c8d0
movq %r13, %rsi
jmp 0x4a5c
leaq 0x27e77(%rip), %rdi     # 0x2c8d0
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2270