// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq (%r8), %rdi
movq 0x8(%r8), %rsi
movq %rsi, %r14
subq %rdi, %r14
sarq $0x3, %r14
leaq 0xd4ff(%rip), %rax      # 0x17364
movslq (%rax), %r9
movq %r14, %rax
xorl %edx, %edx
divq %r9
movq %rax, %r15
subl %r10d, %r15d
jge 0x9ef3
movq %r12, -0x30(%rbp)
movl %r9d, %edx
movl (%rbx), %eax
cmpq %rdi, %rsi
je 0x9ff8
movq (%rcx), %rsi
testl %eax, %eax
jle 0x9ffb
movq -0x30(%rbp), %r8
movq (%r8), %r9
xorl %r8d, %r8d
xorl %r10d, %r10d
cmpl $0x1, (%rsi,%r8,4)
jne 0x9ee3
testl %edx, %edx
jle 0x9ed7
leaq (%r8,%r8,2), %r11
movq (%r9,%r11,8), %r11
movslq %r10d, %r12
leaq (%rdi,%r12,8), %r13
xorl %r12d, %r12d
movsd (%r13,%r12,8), %xmm0
movsd %xmm0, (%r11,%r12,8)
incq %r12
cmpq %r12, %rdx
jne 0x9ebf
addl %r12d, %r10d
movslq %r10d, %r11
cmpq %r11, %r14
je 0xa0f6
incq %r8
cmpq %rax, %r8
jne 0x9ea2
movl %eax, %r8d
jmp 0x9ffe
movq %r8, -0x38(%rbp)
movl (%rbx), %eax
addl %r15d, %eax
movslq %eax, %rsi
leaq -0x44(%rbp), %rdx
movl $0x1, (%rdx)
movq %rcx, -0x40(%rbp)
movq %rcx, %rdi
callq 0xb52c
movl (%rbx), %eax
addl %r15d, %eax
movslq %eax, %rsi
movq %r12, %rdi
callq 0xb342
movl (%rbx), %eax
addl %r15d, %eax
testl %eax, %eax
movq %r12, %r14
movq %r15, %rdx
movq %rbx, %rsi
leaq 0xd428(%rip), %r15      # 0x17364
jle 0x9f79
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r14, -0x30(%rbp)
movq (%r14), %rdi
addq %r13, %rdi
movq %rsi, %r14
movslq (%r15), %rsi
movq %rdx, %rbx
callq 0xb3c0
movq %r14, %rsi
movq -0x30(%rbp), %r14
movq %rbx, %rdx
incq %r12
movl (%rsi), %eax
addl %edx, %eax
movslq %eax, %rcx
addq $0x18, %r13
cmpq %rcx, %r12
jl 0x9f48
movq %rsi, %r12
movq -0x40(%rbp), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
je 0x9ff0
sarq $0x2, %rdx
movl (%r15), %esi
movq -0x38(%rbp), %rdi
movq (%rdi), %rdi
movq (%r14), %r8
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %r9d, %r9d
xorl %r10d, %r10d
testl %esi, %esi
setle %r11b
cmpl $0x1, (%rcx,%r9,4)
setne %r14b
orb %r11b, %r14b
jne 0x9fe8
leaq (%r9,%r9,2), %r11
movq (%r8,%r11,8), %r11
movslq %r10d, %r14
leaq (%rdi,%r14,8), %r15
xorl %r14d, %r14d
movsd (%r15,%r14,8), %xmm0
movsd %xmm0, (%r11,%r14,8)
incq %r14
cmpq %r14, %rsi
jne 0x9fd1
addl %r14d, %r10d
incq %r9
cmpq %rdx, %r9
jne 0x9fab
movq %r12, %r15
jmp 0xa0e4
movq (%rcx), %rsi
xorl %r8d, %r8d
movq 0x8(%rcx), %rcx
subq %rsi, %rcx
sarq $0x2, %rcx
movslq %r8d, %rdi
cmpq %rdi, %rcx
movq -0x30(%rbp), %r14
jbe 0xa08b
movq (%r14), %r8
movl %eax, %r9d
cmpl $0x1, (%rsi,%rdi,4)
jne 0xa083
movslq %r9d, %r10
cmpl %edi, %r10d
movl %edi, %r9d
cmovll %r10d, %r9d
cmpq %rdi, %r10
jle 0xa045
leaq -0x1(%r10), %r11
cmpl $0x0, -0x4(%rsi,%r10,4)
movq %r11, %r10
jne 0xa02e
movl %r11d, %r9d
testl %edx, %edx
setle %r11b
movslq %r9d, %r10
cmpl $0x0, (%rsi,%r10,4)
setne %r12b
orb %r11b, %r12b
jne 0xa083
leaq (%r10,%r10,2), %r10
movq (%r8,%r10,8), %r10
leaq (%rdi,%rdi,2), %r11
movq (%r8,%r11,8), %r11
xorl %r12d, %r12d
movsd (%r10,%r12,8), %xmm0
movsd %xmm0, (%r11,%r12,8)
incq %r12
cmpq %r12, %rdx
jne 0xa06f
incq %rdi
cmpq %rdi, %rcx
ja 0xa01b
addl %r15d, %eax
movslq %eax, %rsi
movq %r14, %rdi
callq 0xb342
movl (%rbx), %eax
addl %r15d, %eax
testl %eax, %eax
movq %r15, %rdx
movq %rbx, %r15
leaq 0xd2b7(%rip), %rbx      # 0x17364
jle 0xa0e4
xorl %r13d, %r13d
xorl %r12d, %r12d
movq (%r14), %rdi
addq %r13, %rdi
movslq (%rbx), %rsi
movq %rdx, %rbx
callq 0xb3c0
movq %rbx, %rdx
incq %r12
movl (%r15), %eax
addl %edx, %eax
movslq %eax, %rcx
addq $0x18, %r13
cmpq %rcx, %r12
leaq 0xd282(%rip), %rbx      # 0x17364
jl 0xa0b5
movl %eax, (%r15)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl %r8d
jmp 0x9ffe