// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/weisfeilerLehman.c
// Function: getWLLabel
char* getWLLabel(struct Vertex* v, struct Vertex* trie, struct GraphPool* gp, struct ShallowGraphPool* sgp) {
	char* resultingLabel;
	struct Vertex* local = getVertex(gp->vertexPool);
	struct ShallowGraph* string = getShallowGraph(sgp);
	struct ShallowGraph* copy;
	int deg = degree(v);
	char** neighborlabels = malloc(deg * sizeof(char*));
	int i = 0;
	struct VertexList* e;

	for (e=v->neighborhood; e!=NULL; e=e->next) {
		neighborlabels[i] = e->endPoint->label;
		++i;
	}
	qsort(neighborlabels, deg, sizeof(char*), &compare);

	e = getVertexList(sgp->listPool);
	e->label = v->label;
	appendEdge(string, e);
	for (i=0; i<deg; ++i) {
		e = getVertexList(sgp->listPool);
		e->label = neighborlabels[i];
		appendEdge(string, e);
	}
	// fprintf(stderr, "adding string ");
	// printCanonicalString(string, stdout);
	copy = cloneShallowGraph(string, sgp);
	// fprintf(stderr, "copy          ");
	// printCanonicalString(copy, stdout);
	addToSearchTree(local, copy, gp, sgp);
	mergeSearchTrees(trie, local, 1, NULL, 0, trie, 0, gp);
	i = getID(trie, string);
	// fprintf(stderr, "resulting label %i\n", i);
	resultingLabel = intLabel(i);
	dumpShallowGraphCycle(sgp, string);
	free(neighborlabels);
	return resultingLabel;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f6a0
movq %rax, 0x48(%rsp)
movq 0x58(%rsp), %rdi
callq 0x1fe70
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rdi
callq 0xa440
movl %eax, 0x34(%rsp)
movslq 0x34(%rsp), %rdi
shlq $0x3, %rdi
callq 0x1170
movq %rax, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movq 0x70(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x32a1e
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdx
movq 0x28(%rsp), %rax
movslq 0x24(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x329e1
movq 0x28(%rsp), %rdi
movslq 0x34(%rsp), %rsi
movl $0x8, %edx
leaq 0x13c(%rip), %rcx       # 0x32b70
callq 0x1060
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f310
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq (%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xbf70
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x32ac2
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f310
movq %rax, 0x18(%rsp)
movq 0x28(%rsp), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xbf70
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x32a73
movq 0x40(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0xbe10
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x58(%rsp), %rcx
callq 0x2c520
movq 0x68(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x68(%rsp), %r9
movq 0x60(%rsp), %rax
movl $0x1, %edx
xorl %ecx, %ecx
movl %ecx, %r8d
xorl %ecx, %ecx
movq %r8, %rcx
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2c650
movq 0x68(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x2c350
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %edi
callq 0x14ae0
movq %rax, 0x50(%rsp)
movq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x20000
movq 0x28(%rsp), %rdi
callq 0x1030
movq 0x50(%rsp), %rax
addq $0x78, %rsp
retq
nopw (%rax,%rax)