// File: 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
subq $0x50, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %eax
leaq 0x1ea14(%rip), %rcx     # 0x387d4
imull (%rcx), %eax
movslq %eax, %rsi
callq 0x1bfe0
movq -0x20(%rbp), %rdi
callq 0x1c0e0
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
movl $0x0, -0x40(%rbp)
leaq -0x40(%rbp), %rdx
callq 0x1c100
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x19f4a
movl -0x30(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0x19ea5
movq -0x8(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0xf850
movq %rax, %rdi
movslq -0x2c(%rbp), %rsi
callq 0xf870
movsd (%rax), %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x19ea0
movq -0x20(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x1c1b0
movl $0x1, (%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
leaq 0x1e972(%rip), %rcx     # 0x387d4
cmpl (%rcx), %eax
jge 0x19e9e
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0xf850
movq %rax, %rdi
movslq -0x3c(%rbp), %rsi
callq 0xf870
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x1c1d0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x19e58
jmp 0x19ea0
jmp 0x19f3a
movq -0x8(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0xf850
movq %rax, %rdi
movslq -0x2c(%rbp), %rsi
callq 0xf870
movsd (%rax), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x19f38
movq -0x20(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x1c1b0
movl $0x1, (%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
leaq 0x1e8da(%rip), %rcx     # 0x387d4
cmpl (%rcx), %eax
jge 0x19f36
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0xf850
movq %rax, %rdi
movslq -0x3c(%rbp), %rsi
callq 0xf870
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x1c1d0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x19ef0
jmp 0x19f38
jmp 0x19f3a
jmp 0x19f3c
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x19df6
movl -0x38(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)