// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/cactustree.c
// Function: nextSpanningTree
char nextSpanningTree(struct ShallowGraph *rootedComponent, struct VertexList **deletedEdges, int mask){
    int i =-1;
    struct ShallowGraph *shlp=rootedComponent;
    struct VertexList *ehlp;
    while(shlp){
        if(deletedEdges[++i]==NULL) shlp=shlp->next;
        else{//indicator for component of size > 1
            //Reinsert Edge into Graph
            markEdgeBetweenVertices(deletedEdges[i]->startPoint,deletedEdges[i]->endPoint,mask);
            //advance insertion point
            if(deletedEdges[i]->next==NULL){//The last edge removed was the last of the component.
                //reset to start of list, therfore we would have an already processed spanning tree and do not break but advance the next position.
                deletedEdges[i]=shlp->edges;
                unmarkEdgeBetweenVertices(shlp->edges->startPoint, shlp->edges->endPoint,mask);
                //we now have to reverse all edges, as we removed the first of that component/circle.
                for(ehlp=shlp->edges->next; ehlp; ehlp=ehlp->next){
                    unmarkEdgeBetweenVertices(ehlp->startPoint,ehlp->endPoint,mask);
                    markEdgeBetweenVertices(ehlp->endPoint, ehlp->startPoint,mask);
                }
                shlp=shlp->next;
            }
            else{
                deletedEdges[i]=deletedEdges[i]->next;
                //now remove the edge pointing in the other direction.
                unmarkEdgeBetweenVertices(deletedEdges[i]->endPoint, deletedEdges[i]->startPoint,mask);
                return 1;//we do not have to advance any further, this is a new spanning tree.
            }
        }
    }
    //We did not return early therefore we have now computed all possible spanning trees
    //No we unmark all the edges.
    for(shlp=rootedComponent;shlp;shlp=shlp->next){
        for(ehlp=shlp->edges;ehlp;ehlp=ehlp->next){
            unmarkEdgeBetweenVertices(ehlp->startPoint,ehlp->endPoint,mask);
            unmarkEdgeBetweenVertices(ehlp->endPoint,ehlp->startPoint,mask);
        }
    }
    return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x3ea7
movq 0x20(%rsp), %rax
movl 0x18(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rsp)
movslq %ecx, %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x3d5d
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x3ea2
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rsi
movl 0x1c(%rsp), %edx
callq 0x4950
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x8(%rax)
jne 0x3e49
movq 0x10(%rsp), %rax
movq (%rax), %rdx
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
movl 0x1c(%rsp), %edx
callq 0x48f0
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x3e39
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x1c(%rsp), %edx
callq 0x48f0
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl 0x1c(%rsp), %edx
callq 0x4950
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x3deb
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x3ea0
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdx
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rdi
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rsi
movl 0x1c(%rsp), %edx
callq 0x48f0
movb $0x1, 0x37(%rsp)
jmp 0x3f2b
jmp 0x3ea2
jmp 0x3d24
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x3f26
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x3f14
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x1c(%rsp), %edx
callq 0x48f0
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl 0x1c(%rsp), %edx
callq 0x48f0
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x3ec6
jmp 0x3f16
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x3eb1
movb $0x0, 0x37(%rsp)
movb 0x37(%rsp), %al
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)