// File: /workspace/github_cpp_makefile_star2_O3/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, -0x58(%rbp)
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, %r13
movq %rsi, -0x48(%rbp)
movslq (%rsi), %rax
leaq 0xd712(%rip), %rcx      # 0x17364
movslq (%rcx), %rsi
imulq %rax, %rsi
movq %rdx, %rdi
callq 0xb490
movq (%r12), %rax
cmpq %rax, 0x8(%r12)
je 0x9c71
movq %rax, 0x8(%r12)
movq -0x48(%rbp), %r14
movslq (%r14), %rsi
leaq -0x64(%rbp), %rdx
movl $0x0, (%rdx)
movq %r12, %rdi
callq 0xb52c
cmpl $0x0, (%r14)
jle 0x9de6
movq %r14, %rcx
movl 0x10(%rbp), %esi
movslq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %edi, %edi
xorl %edx, %edx
movl %ebx, -0x3c(%rbp)
movq %r12, -0x50(%rbp)
movq (%r13), %rax
movq %rdi, -0x38(%rbp)
leaq (%rdi,%rdi,2), %r14
movq (%rax,%r14,8), %rax
movq -0x60(%rbp), %rdi
movsd (%rax,%rdi,8), %xmm0
cmpl %esi, %ebx
jge 0x9d48
ucomisd -0x58(%rbp), %xmm0
jbe 0x9dd1
movq (%r12), %rax
movq -0x38(%rbp), %rdi
movl $0x1, (%rax,%rdi,4)
incl %edx
leaq 0xd677(%rip), %rax      # 0x17364
movl (%rax), %eax
testl %eax, %eax
jle 0x9dd1
movl %edx, -0x2c(%rbp)
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%r13), %rcx
movq (%rcx,%r14,8), %rdx
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x9d26
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r15)
jmp 0x9d37
movq %r15, %rdi
callq 0xbd32
leaq 0xd62f(%rip), %rax      # 0x17364
movl (%rax), %eax
incq %r12
movslq %eax, %rcx
addq $0x8, %rbx
cmpq %rcx, %r12
jl 0x9cff
jmp 0x9dc0
movsd -0x58(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x9dd1
movq (%r12), %rax
movq -0x38(%rbp), %rdi
movl $0x1, (%rax,%rdi,4)
incl %edx
leaq 0xd5f9(%rip), %rax      # 0x17364
movl (%rax), %eax
testl %eax, %eax
jle 0x9dd1
movl %edx, -0x2c(%rbp)
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%r13), %rcx
movq (%rcx,%r14,8), %rdx
addq %rbx, %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x9da0
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r15)
jmp 0x9db1
movq %r15, %rdi
callq 0xbd32
leaq 0xd5b5(%rip), %rax      # 0x17364
movl (%rax), %eax
incq %r12
movslq %eax, %rcx
addq $0x8, %rbx
cmpq %rcx, %r12
jl 0x9d79
movl -0x3c(%rbp), %ebx
movq -0x50(%rbp), %r12
movq -0x48(%rbp), %rcx
movl -0x2c(%rbp), %edx
movl 0x10(%rbp), %esi
movq -0x38(%rbp), %rdi
incq %rdi
movslq (%rcx), %rax
cmpq %rax, %rdi
jl 0x9cad
jmp 0x9de8
xorl %edx, %edx
movl %edx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq