// File: BhanuPrakashN[P]sparse_chol/smatrix.cpp
// Function: buildTree(smatrix*)
et * buildTree(sm *A){
    et *tree=(et*)malloc(sizeof(et));
    int n=A->n,i=0,next=0;
    int *par,*Ap,*Ai,*ancestor;
    map<int,vector<int>* >  *chl;
    vector<int> *t;
    tree->par=(int*)malloc(n*sizeof(int));
    tree->chl=new map<int,vector<int>* >;
    ancestor=(int*)malloc(n*sizeof(int));
    par=tree->par;
    chl=tree->chl;
    Ap=A->p;
    Ai=A->i;
    for(int k=0;k<n;k++){
        par[k]=-1;
        ancestor[k]=-1;
        t= new vector<int>;
        chl->insert(pair<int,vector<int>* >(k,t));
        for(int p=Ap[k];p<Ap[k+1];p++){
            i=Ai[p];
            while(i!=-1 && i<k){
               // printf("%d\n",i);
                next=ancestor[i];
                ancestor[i]=k;
                if(next==-1){

                    par[i]=k;
                    (chl->at(k))->push_back(i);
                }
                i=next;
            }
        }
    }
    return tree;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movl $0x10, %edi
callq 0x1150
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movslq -0x14(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1150
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x30, %edi
callq 0x1100
movq %rax, %rdi
movq %rdi, -0x88(%rbp)
callq 0x2ee0
movq -0x88(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movslq -0x14(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1150
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x24bb
movq -0x28(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl $0x18, %edi
callq 0x1100
movq %rax, %rdi
movq %rdi, -0x98(%rbp)
callq 0x2f00
movq -0x98(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x54(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x2f60
movq -0x90(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2f20
movq %rax, -0x78(%rbp)
movb %dl, -0x70(%rbp)
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x30(%rbp), %rcx
movl -0x54(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x24ab
movq -0x38(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
xorl %eax, %eax
cmpl $-0x1, -0x18(%rbp)
movb %al, -0x99(%rbp)
je 0x243e
movl -0x18(%rbp), %eax
cmpl -0x54(%rbp), %eax
setl %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x244a
jmp 0x249b
movq -0x40(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movl -0x54(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpl $-0x1, -0x1c(%rbp)
jne 0x2493
movl -0x54(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0x15e0
movq (%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x2f90
movl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x2421
jmp 0x249d
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x23fa
jmp 0x24ad
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x236b
movq -0x10(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)