// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/randomGraphGenerators.c
// Function: blockChainGenerator
struct Graph* blockChainGenerator(int nBlocks, int blockSize, int nVertexLabels, int nEdgeLabels, double diagonalProbability, struct GraphPool* gp) {

	// create empty graph of correct size
	int nVertices = nBlocks * blockSize - nBlocks + 1;
	struct Graph* g = createGraph(nVertices, gp);

	// add vertex labels
	if (nVertexLabels < 1) {
		for (int v=0; v<nVertices; ++v) {
			g->vertices[v]->label = intLabel(v);
			g->vertices[v]->isStringMaster = 1;
		}
	} else {
		randomVertexLabels(g, nVertexLabels);
	}

	// add cycle edges
	for (int blockStart=0; blockStart<nVertices-1; blockStart+=blockSize-1) {
		for (int v=blockStart; v<blockStart+blockSize; ++v) {
			for (int w=v+1; w<blockStart+blockSize; ++w) {
				if ((w - v == 1) || (rand() / ((double)RAND_MAX) <= diagonalProbability)) {
					addEdgeBetweenVertices(v, w, intLabel(rand() % nEdgeLabels), g, gp);
				}
			}
		}
		if (!isIncident(g->vertices[blockStart], g->vertices[blockStart+blockSize-1])) {
			addEdgeBetweenVertices(blockStart, blockStart+blockSize-1, intLabel(rand() % nEdgeLabels), g, gp);
		}
	}
	return g;
}

// Assembly:
subq $0x58, %rsp
movl %edi, 0x54(%rsp)
movl %esi, 0x50(%rsp)
movl %edx, 0x4c(%rsp)
movl %ecx, 0x48(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movl 0x54(%rsp), %eax
imull 0x50(%rsp), %eax
subl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %edi
movq 0x38(%rsp), %rsi
callq 0xb850
movq %rax, 0x28(%rsp)
cmpl $0x1, 0x4c(%rsp)
jge 0x29958
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x29956
movl 0x24(%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 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x29905
jmp 0x29966
movq 0x28(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x29550
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movl 0x34(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x29ad3
movl 0x20(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x20(%rsp), %ecx
addl 0x50(%rsp), %ecx
cmpl %ecx, %eax
jge 0x29a45
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
movl 0x20(%rsp), %ecx
addl 0x50(%rsp), %ecx
cmpl %ecx, %eax
jge 0x29a33
movl 0x18(%rsp), %eax
subl 0x1c(%rsp), %eax
cmpl $0x1, %eax
je 0x299e6
callq 0x1220
cvtsi2sd %eax, %xmm1
movsd 0xc4d2(%rip), %xmm0     # 0x35ea8
divsd %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x29a21
movl 0x1c(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x18(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x1220
cltd
idivl 0x48(%rsp)
movl %edx, %edi
callq 0x14ae0
movl 0x10(%rsp), %edi
movl 0x14(%rsp), %esi
movq %rax, %rdx
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %r8
callq 0xb670
jmp 0x29a23
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x299a8
jmp 0x29a35
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x29989
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x20(%rsp), %ecx
addl 0x50(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0xa5a0
cmpb $0x0, %al
jne 0x29abd
movl 0x20(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x20(%rsp), %eax
addl 0x50(%rsp), %eax
subl $0x1, %eax
movl %eax, 0xc(%rsp)
callq 0x1220
cltd
idivl 0x48(%rsp)
movl %edx, %edi
callq 0x14ae0
movl 0x8(%rsp), %edi
movl 0xc(%rsp), %esi
movq %rax, %rdx
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %r8
callq 0xb670
jmp 0x29abf
movl 0x50(%rsp), %eax
subl $0x1, %eax
addl 0x20(%rsp), %eax
movl %eax, 0x20(%rsp)
jmp 0x2996e
movq 0x28(%rsp), %rax
addq $0x58, %rsp
retq
nopl (%rax)