// File: ADAPTLab[P]MuDBSCAN/main.cpp
// Function: populateMulti(dataHdr**, char*, int*, int*)
int populateMulti(DataHdr* dataList, char* argv, int* totalSize, int* dims)
{

	int myrank, numprocs;
 	MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);	vector< vector<double> > objects;
    
    filereadstart = MPI_Wtime();
	int localSize = fileReadMulti(argv, totalSize, dims, objects);
	filereadend = MPI_Wtime();

	MPI_Barrier(MPI_COMM_WORLD);
	vector< vector<double> > remote_objects;

	vectorc* remote_PrIDs;
	remote_PrIDs = (vectorc*)malloc(sizeof(struct vectorc));
	// assert(remote_PrIDs != NULL);
	VECTOR_INIT(remote_PrIDs, INTEGER);

	vectorc* remote_Indices;
	remote_Indices = (vectorc*)malloc(sizeof(struct vectorc));
	// assert(remote_Indices != NULL);
	VECTOR_INIT(remote_Indices, INTEGER);

	int remote_number = 0;

	int i;

	get_extra_points(objects, &localSize, remote_objects, remote_PrIDs, remote_Indices, &remote_number);

	MPI_Barrier(MPI_COMM_WORLD);

	int rs_size = remote_objects.size();

	dataliststart = MPI_Wtime();
	*dataList = initDataHdr(localSize + remote_number);
	populateDataListLocal(*dataList, objects);
	int old = (*dataList)->uiCnt;
	populateDataListRemote(*dataList, remote_objects, remote_PrIDs, remote_Indices);
	datalistend = MPI_Wtime();

    VECTOR_FREE(remote_PrIDs);
    free(remote_PrIDs);

    VECTOR_FREE(remote_Indices);
    free(remote_Indices);

	return localSize + remote_number;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq 0xe816(%rip), %rdi      # 0x37fa8
movq %rdi, -0x98(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x9790
movq -0x98(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x99e0
leaq -0x40(%rbp), %rdi
callq 0xf970
callq 0x9880
movsd %xmm0, -0x90(%rbp)
jmp 0x297ca
movsd -0x90(%rbp), %xmm0
movsd %xmm0, 0xf0be(%rip)     # 0x38898
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x18eb0
movl %eax, -0x9c(%rbp)
jmp 0x297f7
movl -0x9c(%rbp), %eax
movl %eax, -0x50(%rbp)
callq 0x9880
movsd %xmm0, -0xa8(%rbp)
jmp 0x2980f
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, 0xf081(%rip)     # 0x388a0
movq 0xe782(%rip), %rdi      # 0x37fa8
callq 0x9450
jmp 0x2982d
leaq -0x68(%rbp), %rdi
callq 0xf970
movl $0x30, %edi
callq 0x9910
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0xa170
jmp 0x29851
movl $0x30, %edi
callq 0x9910
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
xorl %esi, %esi
callq 0xa170
jmp 0x2986c
movl $0x0, -0x7c(%rbp)
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %r8
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rdx
leaq -0x7c(%rbp), %r9
callq 0x1af30
jmp 0x29892
movq 0xe70f(%rip), %rdi      # 0x37fa8
callq 0x9450
jmp 0x298a0
leaq -0x68(%rbp), %rdi
callq 0xf820
movl %eax, -0x84(%rbp)
callq 0x9880
movsd %xmm0, -0xb0(%rbp)
jmp 0x298be
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, 0xf02a(%rip)     # 0x388f8
movl -0x50(%rbp), %edi
movl -0x7c(%rbp), %eax
addl %eax, %edi
callq 0xf2b0
movq %rax, -0xb8(%rbp)
jmp 0x298e4
movq -0xb8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0xf610
jmp 0x29904
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x70(%rbp), %rdx
movq -0x78(%rbp), %rcx
leaq -0x68(%rbp), %rsi
callq 0xf3e0
jmp 0x2992d
callq 0x9880
movsd %xmm0, -0xc0(%rbp)
jmp 0x2993c
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, 0xefb4(%rip)     # 0x38900
movq -0x70(%rbp), %rdi
callq 0xa7f0
jmp 0x29957
movq -0x70(%rbp), %rdi
callq 0x97c0
movq -0x78(%rbp), %rdi
callq 0xa7f0
jmp 0x2996b
movq -0x78(%rbp), %rdi
callq 0x97c0
movl -0x50(%rbp), %eax
addl -0x7c(%rbp), %eax
movl %eax, -0xc4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xf9f0
leaq -0x40(%rbp), %rdi
callq 0xf9f0
movl -0xc4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x299c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xf9f0
leaq -0x40(%rbp), %rdi
callq 0xf9f0
movq -0x48(%rbp), %rdi
callq 0x9c70
nopw %cs:(%rax,%rax)