// File: /workspace/github_c_makefile_star2_O3/pwelke[P]GraphMiningTools/cactustree.c
// Function: processComponentTree
struct Characteristics *processComponentTree(struct Graph *graph, struct Vertex *root, struct Vertex *componentRoot, int treeNumber, struct ShallowGraph **rootedComponents, struct Characteristics *oldChars, struct Characteristics *newChars, struct Graph *pattern, struct GraphPool *gPool, struct ShallowGraphPool *sgPool){
    struct VertexList *ehlp, **deletedEdges;
    struct Characteristics *ret=newChars;
    char exNext;
    int wTreeNumber=0;
    //printf("\nComproot %i root%i \n",componentRoot->number, root->number);
    for(ehlp=root->neighborhood;ehlp;ehlp=ehlp->next){
        //no need to check for visited as flags imply a arborescence with no back edges =]
        //printf("\t neighbour is %i flag: %i\n",ehlp->endPoint->number,ehlp->flag);
        if((ehlp->flag & 1)){
            ret=processComponentTree(graph, ehlp->endPoint, componentRoot, treeNumber, rootedComponents, oldChars, ret, pattern, gPool, sgPool);
            //printf("After returning from %i:\n",ehlp->endPoint->number);
            //printCharacteristics(ret);
        }
    }
    /*
    printf("\ncomproot number is %i \n",componentRoot->number);

    printf("\nroot number is %i\n",root->number);
    printf("----------old----------\n");
    printCharacteristics(oldChars);
    printf("--------new-----------\n");
    printCharacteristics(ret);
    */
    int i =0;
    if((componentRoot->number != root->number) || root->number==0){
        if(root->d <0){// not a component root
            for(;i<pattern->n;++i)
                ret=characteristics(root, treeNumber, 0, oldChars, ret, pattern->vertices[i], pattern->n, gPool);
        }
        else{
            deletedEdges = malloc((rootedComponents[root->d]->data)*sizeof(struct VertexList *));
            initSpanningTree(rootedComponents[root->d], deletedEdges,2);
            wTreeNumber=0;
            do{
                for(i=0;i<pattern->n;++i)
                    ret= characteristics(root, treeNumber, wTreeNumber, oldChars, ret, pattern->vertices[i], pattern->n, gPool);
                exNext=nextSpanningTree(rootedComponents[root->d], deletedEdges,2);
                ++wTreeNumber;
            }while(exNext);
            free(deletedEdges);
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movq %r8, 0x18(%rsp)
movl %ecx, %ebp
movq %rdx, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movq 0x70(%rsp), %r12
movq 0x68(%rsp), %r10
movq 0x60(%rsp), %r15
movq 0x8(%rsi), %r13
testq %r13, %r13
je 0x44e6
testb $0x1, 0x24(%r13)
je 0x44e0
movq 0x18(%r13), %rsi
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
movl %ebp, %ecx
movq 0x18(%rsp), %r8
movq %rbx, %r9
pushq 0x78(%rsp)
pushq %r12
pushq %r10
pushq %r15
callq 0x4466
movq 0x88(%rsp), %r10
addq $0x20, %rsp
movq %rax, %r15
movq 0x8(%r13), %r13
jmp 0x449e
movl 0x18(%r14), %eax
movq 0x8(%rsp), %rcx
cmpl %eax, 0x18(%rcx)
sete %cl
testl %eax, %eax
setne %al
testb %al, %cl
jne 0x4602
movslq 0x28(%r14), %rax
testq %rax, %rax
js 0x45c4
movl %ebp, 0x24(%rsp)
movq %rbx, 0x10(%rsp)
movq 0x18(%rsp), %rcx
movq (%rcx,%rax,8), %r13
movslq 0x28(%r13), %rdi
shlq $0x3, %rdi
callq 0x1190
movq %r13, %rdi
movq %rax, 0x8(%rsp)
movq %rax, %rsi
movl $0x2, %edx
callq 0x43d0
xorl %r13d, %r13d
movq 0x10(%rsp), %rbp
movl 0x24(%rsp), %r12d
movq 0x68(%rsp), %rdx
movl (%rdx), %eax
testl %eax, %eax
jle 0x4595
xorl %ebx, %ebx
movq 0x10(%rdx), %rcx
movq (%rcx,%rbx,8), %r9
movq %r14, %rdi
movl %r12d, %esi
movl %r13d, %edx
movq %rbp, %rcx
movq %r15, %r8
pushq 0x70(%rsp)
pushq %rax
callq 0x473f
movq 0x78(%rsp), %rdx
addq $0x10, %rsp
movq %rax, %r15
incq %rbx
movslq (%rdx), %rax
cmpq %rax, %rbx
jl 0x455d
movslq 0x28(%r14), %rax
movq 0x18(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
movq 0x8(%rsp), %rsi
movl $0x2, %edx
callq 0x4614
incl %r13d
testb %al, %al
jne 0x4550
movq 0x8(%rsp), %rdi
callq 0x1030
jmp 0x4602
movl (%r10), %eax
testl %eax, %eax
jle 0x4602
xorl %r13d, %r13d
movq 0x10(%r10), %rcx
movq (%rcx,%r13,8), %r9
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
movq %rbx, %rcx
movq %r15, %r8
pushq %r12
pushq %rax
callq 0x473f
movq 0x78(%rsp), %r10
addq $0x10, %rsp
movq %rax, %r15
incq %r13
movslq (%r10), %rax
cmpq %rax, %r13
jl 0x45ce
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq