// File: /workspace/github_cpp_makefile_star2_O2/ADAPTLab[P]MuDBSCAN/partition.cpp
// Function: update_points(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, int*, int, std::vector<int, std::allocator<int>>&, std::vector<double, std::allocator<double>>&)
void update_points(vector< vector< double> >& objects, int* num_points, int s_count, vector <int>& invalid_pos_as, vector <double>& recv_buf)
{
	int i, j, k, l, r_count = recv_buf.size() / DIMENSION;

	if(r_count >= s_count)
	{
		invalid_pos_as.resize(*num_points + r_count - s_count, 1);

		objects.resize(*num_points + r_count - s_count);
		for(int ll = 0; ll < *num_points + r_count - s_count; ll++)
			objects[ll].resize(DIMENSION);

		j = 0;
		for(i = 0; i < invalid_pos_as.size(); i++)
		{
			if(invalid_pos_as[i] == 1)
			{
				for(k = 0; k < DIMENSION; k++)
					objects[i][k] = recv_buf[j++];
			}
		}			

		*num_points = *num_points + r_count - s_count;
	}
	else
	{
		j = 0;
		i = 0;	
		if(recv_buf.size() > 0)
		{
			for(i = 0; i < *num_points; i++)
			{
				if(invalid_pos_as[i] == 1)
				{
					for(k = 0; k < DIMENSION; k++)
						objects[i][k] = recv_buf[j++];

					if(j == recv_buf.size())
					{
						i++;
						break;
					}
				}
			}
		}

		l = *num_points;
		for( ; i < invalid_pos_as.size(); i++)
		{
			if(invalid_pos_as[i] == 1)
			{
				while(l > i)
				{
					l--;
					if(invalid_pos_as[l] == 0)
						break;
				}

				if(invalid_pos_as[l] == 0)	
					for(k = 0; k < DIMENSION; k++)
						objects[i][k] = objects[l][k];
			}
		}

		objects.resize(*num_points + r_count - s_count);
		for(int ll = 0; ll < *num_points + r_count - s_count; ll++)
			objects[ll].resize(DIMENSION);

		*num_points = *num_points + r_count - s_count;
	}		
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r10d
movq %rsi, %rbx
movq %rdi, %r14
movq (%r8), %rdi
movq 0x8(%r8), %r9
movq %r9, %rax
subq %rdi, %rax
sarq $0x3, %rax
leaq 0xc2c4(%rip), %rdx      # 0x14334
movslq (%rdx), %rsi
movq %rax, -0x40(%rbp)
xorl %edx, %edx
divq %rsi
movq %rax, %r15
subl %r10d, %r15d
jge 0x8124
movl (%rbx), %r8d
cmpq %rdi, %r9
movl %r8d, -0x2c(%rbp)
je 0x81f5
movq %rcx, -0x38(%rbp)
movq (%rcx), %rcx
movl %r8d, %eax
xorl %r8d, %r8d
testl %esi, %esi
cmovlel %r8d, %esi
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
movabsq $0x100000000, %r10      # imm = 0x100000000
xorl %r11d, %r11d
movq %rdi, -0x48(%rbp)
cmpq %rdx, %r8
je 0x8204
cmpl $0x1, (%rcx,%r8,4)
jne 0x811f
imulq $0x18, %r8, %rax
addq (%r14), %rax
movslq %r11d, %r13
movq -0x48(%rbp), %rdi
leaq (%rdi,%r13,8), %rdi
shlq $0x20, %r13
xorl %r12d, %r12d
cmpq %r12, %rsi
je 0x810b
movsd (%rdi,%r12,8), %xmm0
movq (%rax), %r9
movsd %xmm0, (%r9,%r12,8)
incq %r12
addq %r10, %r13
jmp 0x80ef
sarq $0x20, %r13
cmpq %r13, -0x40(%rbp)
je 0x81fe
movl %r11d, %r11d
addq %r12, %r11
incq %r8
jmp 0x80c6
movq %r8, -0x40(%rbp)
movl (%rbx), %eax
addl %r15d, %eax
movslq %eax, %rsi
leaq -0x4c(%rbp), %rdx
movl $0x1, (%rdx)
movq %rcx, -0x38(%rbp)
movq %rcx, %rdi
callq 0x94bc
movl (%rbx), %eax
addl %r15d, %eax
movslq %eax, %rsi
movq %r14, %rdi
callq 0x92a6
xorl %r12d, %r12d
xorl %r13d, %r13d
movl (%rbx), %eax
addl %r15d, %eax
movslq %eax, %rcx
cmpq %rcx, %r13
jge 0x8187
movq (%r14), %rdi
addq %r12, %rdi
leaq 0xc1be(%rip), %rax      # 0x14334
movslq (%rax), %rsi
callq 0x92e8
incq %r13
addq $0x18, %r12
jmp 0x815c
movq -0x38(%rbp), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
leaq 0xc194(%rip), %rsi      # 0x14334
movl (%rsi), %esi
xorl %edi, %edi
testl %esi, %esi
cmovlel %edi, %esi
xorl %r8d, %r8d
movq -0x40(%rbp), %r12
cmpq %rdx, %rdi
je 0x82cf
cmpl $0x1, (%rcx,%rdi,4)
jne 0x81f0
imulq $0x18, %rdi, %r9
addq (%r14), %r9
movslq %r8d, %r10
shlq $0x3, %r10
addq (%r12), %r10
xorl %r11d, %r11d
cmpq %r11, %rsi
je 0x81ed
movsd (%r10,%r11,8), %xmm0
movq (%r9), %r15
movsd %xmm0, (%r15,%r11,8)
incq %r11
jmp 0x81d4
addl %r11d, %r8d
incq %rdi
jmp 0x81b0
xorl %edx, %edx
testl %esi, %esi
cmovlel %edx, %esi
jmp 0x820c
incl %r8d
movl %r8d, %edx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %rcx
movq (%rcx), %r12
movq 0x8(%rcx), %rdi
subq %r12, %rdi
sarq $0x2, %rdi
movslq %edx, %rdx
movl %esi, %esi
cmpq %rdx, %rdi
jbe 0x828d
cmpl $0x1, (%r12,%rdx,4)
jne 0x8258
movslq %r8d, %rax
cmpl %edx, %eax
movl %edx, %r8d
cmovll %eax, %r8d
cmpq %rdx, %rax
jle 0x824e
leaq -0x1(%rax), %r9
cmpl $0x0, -0x4(%r12,%rax,4)
movq %r9, %rax
jne 0x8237
movl %r9d, %r8d
movslq %r8d, %rax
cmpl $0x0, (%r12,%rax,4)
je 0x825d
incq %rdx
jmp 0x821f
movq (%r14), %r10
imulq $0x18, %rax, %rax
addq %r10, %rax
imulq $0x18, %rdx, %r9
addq %r10, %r9
xorl %r10d, %r10d
cmpq %r10, %rsi
je 0x8258
movq (%rax), %r11
movsd (%r11,%r10,8), %xmm0
movq (%r9), %r11
movsd %xmm0, (%r11,%r10,8)
incq %r10
jmp 0x8271
movl -0x2c(%rbp), %eax
addl %r15d, %eax
movslq %eax, %rsi
movq %r14, %rdi
callq 0x92a6
xorl %r13d, %r13d
xorl %r12d, %r12d
movl (%rbx), %eax
addl %r15d, %eax
movslq %eax, %rcx
cmpq %rcx, %r12
jge 0x82cf
movq (%r14), %rdi
addq %r13, %rdi
leaq 0xc076(%rip), %rax      # 0x14334
movslq (%rax), %rsi
callq 0x92e8
incq %r12
addq $0x18, %r13
jmp 0x82a4
movl %eax, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq