// File: /workspace/github_cpp_makefile_star2_O1/ADAPTLab[P]MuDBSCAN/partition.cpp
// Function: get_points_to_send(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, int*, std::vector<double, std::allocator<double>>&, std::vector<int, std::allocator<int>>&, double, int, int, int)
int get_points_to_send(vector< vector< double> >& objects, int* num_points, vector<double>& send_buf, vector<int>& invalid_pos_as, double median, int d, int rank, int partner_rank)
{
	int i, count = 0, j;
	send_buf.reserve((*num_points) * DIMENSION); 
	invalid_pos_as.clear();
	invalid_pos_as.resize(*num_points, 0);

	for(i = 0; i < *num_points; i++)
	{
		if (rank < partner_rank)
		{
			if(objects[i][d] > median)
			{
				invalid_pos_as[i] = 1;
				count++;
				for(j = 0; j < DIMENSION; j++)
					send_buf.push_back(objects[i][j]);
			}
		}
		else
		{
			if(objects[i][d] <= median)
			{
				invalid_pos_as[i] = 1;
				count++;
				for(j = 0; j < DIMENSION; j++)
					send_buf.push_back(objects[i][j]);
			}
		}
	}

	return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %ebx
movl %r8d, -0x38(%rbp)
movsd %xmm0, -0x60(%rbp)
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, %r13
movq %rsi, -0x48(%rbp)
movslq (%rsi), %rax
leaq 0xd6a0(%rip), %rcx      # 0x17364
movslq (%rcx), %rsi
imulq %rax, %rsi
movq %rdx, %rdi
callq 0xb4fc
movq (%r12), %rax
cmpq %rax, 0x8(%r12)
je 0x9ce3
movq %rax, 0x8(%r12)
movq -0x48(%rbp), %r14
movslq (%r14), %rsi
leaq -0x64(%rbp), %rdx
movl $0x0, (%rdx)
movq %r12, %rdi
callq 0xb594
cmpl $0x0, (%r14)
jle 0x9e4d
movq %r14, %rcx
movl 0x10(%rbp), %edx
movslq -0x38(%rbp), %rsi
xorl %r8d, %r8d
movl $0x0, -0x2c(%rbp)
movl %ebx, -0x3c(%rbp)
movq %r12, -0x58(%rbp)
leaq 0xd63c(%rip), %rdi      # 0x17364
movq %rsi, -0x50(%rbp)
movq (%r13), %rax
movq %r8, -0x38(%rbp)
leaq (%r8,%r8,2), %r14
movq (%rax,%r14,8), %rax
cmpl %edx, %ebx
jge 0x9db8
movsd (%rax,%rsi,8), %xmm0
ucomisd -0x60(%rbp), %xmm0
jbe 0x9e38
movq (%r12), %rax
movq -0x38(%rbp), %r8
movl $0x1, (%rax,%r8,4)
incl -0x2c(%rbp)
cmpl $0x0, (%rdi)
jle 0x9e38
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%r13), %rax
movq (%rax,%r14,8), %rdx
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x9d98
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r15)
jmp 0x9da7
movq %r15, %rdi
callq 0xbd84
leaq 0xd5bd(%rip), %rdi      # 0x17364
incq %r12
movslq (%rdi), %rax
addq $0x8, %rbx
cmpq %rax, %r12
jl 0x9d71
jmp 0x9e26
movsd -0x60(%rbp), %xmm0
ucomisd (%rax,%rsi,8), %xmm0
jb 0x9e38
movq (%r12), %rax
movq -0x38(%rbp), %r8
movl $0x1, (%rax,%r8,4)
incl -0x2c(%rbp)
cmpl $0x0, (%rdi)
jle 0x9e38
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%r13), %rax
movq (%rax,%r14,8), %rdx
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x9e08
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r15)
jmp 0x9e17
movq %r15, %rdi
callq 0xbd84
leaq 0xd54d(%rip), %rdi      # 0x17364
incq %r12
movslq (%rdi), %rax
addq $0x8, %rbx
cmpq %rax, %r12
jl 0x9de1
movl -0x3c(%rbp), %ebx
movq -0x58(%rbp), %r12
movq -0x48(%rbp), %rcx
movl 0x10(%rbp), %edx
movq -0x50(%rbp), %rsi
movq -0x38(%rbp), %r8
incq %r8
movslq (%rcx), %rax
cmpq %rax, %r8
jl 0x9d2c
jmp 0x9e54
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq