// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/randomGraphGenerators.c
// Function: randomClusteredOverlapGraphWithLabels
struct Graph* randomClusteredOverlapGraphWithLabels(int n, double d, int nClusters, double mu, struct GraphPool* gp) {

	if (nClusters > n) {
		fprintf(stderr, "Number of clusters is larger than number of vertices: %i > %i\n", nClusters, n);
		return NULL;
	}

	// ensure that nClusters divides number of vertices.
	int nodesPerCluster = n / nClusters;
	if (n != nodesPerCluster * nClusters) {
		fprintf(stderr, "Randomly generated graph will have %i vertices instead of %i vertices\n", nodesPerCluster * nClusters, n);
		n = nodesPerCluster * nClusters;
	}

	struct Graph* g = createGraph(n, gp);

	// every vertex is a two-dimensional point
	int i=0;
	for (int v=0; v<nClusters; ++v) {
		g->vertices[i]->d = rand();
		g->vertices[i]->lowPoint = rand();
		g->vertices[i]->label = intLabel(v);
		g->vertices[i]->isStringMaster = 1;
		for (int w=1; w<nodesPerCluster; ++w) {
			g->vertices[i+w]->d = g->vertices[i]->d;
			g->vertices[i+w]->lowPoint = g->vertices[i]->lowPoint;
			g->vertices[i+w]->label = intLabel(v);
			g->vertices[i+w]->isStringMaster = 1;
			moveVertexGaussian(g->vertices[i+w], mu);
		}
		i += nodesPerCluster;
	}

	// add edge iff distance is smaller than d
	for (int v=0; v<n; ++v) {
		for (int w=v+1; w<n; ++w) {
			if (euclideanDistanceWrap(v, w, g) < d) {
				addEdgeBetweenVertices(v, w, intLabel(1), g, gp);
				g->vertices[v]->neighborhood->isStringMaster = 1;
			}
		}
	}
	return g;
}

// Assembly:
subq $0x68, %rsp
movl %edi, 0x5c(%rsp)
movsd %xmm0, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movsd %xmm1, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jle 0x2a905
movq 0x1371a(%rip), %rax     # 0x3dff8
movq (%rax), %rdi
movl 0x4c(%rsp), %edx
movl 0x5c(%rsp), %ecx
leaq 0xb629(%rip), %rsi      # 0x35f19
movb $0x0, %al
callq 0x1140
movq $0x0, 0x60(%rsp)
jmp 0x2abd2
movl 0x5c(%rsp), %eax
cltd
idivl 0x4c(%rsp)
movl %eax, 0x34(%rsp)
movl 0x5c(%rsp), %eax
movl 0x34(%rsp), %ecx
imull 0x4c(%rsp), %ecx
cmpl %ecx, %eax
je 0x2a955
movq 0x136ce(%rip), %rax     # 0x3dff8
movq (%rax), %rdi
movl 0x34(%rsp), %edx
imull 0x4c(%rsp), %edx
movl 0x5c(%rsp), %ecx
leaq 0xb617(%rip), %rsi      # 0x35f58
movb $0x0, %al
callq 0x1140
movl 0x34(%rsp), %eax
imull 0x4c(%rsp), %eax
movl %eax, 0x5c(%rsp)
movl 0x5c(%rsp), %edi
movq 0x38(%rsp), %rsi
callq 0xb850
movq %rax, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x4c(%rsp), %eax
jge 0x2ab03
callq 0x1220
movl %eax, %ecx
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, 0x28(%rax)
callq 0x1220
movl %eax, %ecx
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, 0x20(%rax)
movl 0x20(%rsp), %edi
callq 0x14ae0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x1, 0x24(%rax)
movl $0x1, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x2aae7
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x28(%rax), %ecx
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x24(%rsp), %edx
addl 0x1c(%rsp), %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, 0x28(%rax)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x20(%rax), %ecx
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x24(%rsp), %edx
addl 0x1c(%rsp), %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, 0x20(%rax)
movl 0x20(%rsp), %edi
callq 0x14ae0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x24(%rsp), %edx
addl 0x1c(%rsp), %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x24(%rsp), %ecx
addl 0x1c(%rsp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl $0x1, 0x24(%rax)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x24(%rsp), %ecx
addl 0x1c(%rsp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
movsd 0x40(%rsp), %xmm0
callq 0x2a800
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x2aa00
movl 0x34(%rsp), %eax
addl 0x24(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x2a978
movl $0x0, 0x18(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jge 0x2abc8
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jge 0x2abb6
movl 0x18(%rsp), %edi
movl 0x14(%rsp), %esi
movq 0x28(%rsp), %rdx
callq 0x2a350
movaps %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2aba4
movl 0x18(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
movl $0x1, %edi
callq 0x14ae0
movl 0xc(%rsp), %edi
movl 0x10(%rsp), %esi
movq %rax, %rdx
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %r8
callq 0xb670
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movl $0x1, 0x28(%rax)
jmp 0x2aba6
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x2ab24
jmp 0x2abb8
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x2ab0b
movq 0x28(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
nopl (%rax)