// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r13
movl $0x10, %edi
callq 0x1150
movq %rax, %r15
movslq 0x8(%r13), %rbx
xorl %r14d, %r14d
movl %r14d, -0x30(%rbp)
leaq (,%rbx,4), %r12
movq %r12, %rdi
callq 0x1150
movq %rax, -0x48(%rbp)
movq %rax, (%r15)
movl $0x30, %edi
callq 0x1100
leaq 0x8(%rax), %rcx
movl %r14d, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %r15, -0x50(%rbp)
movq %rax, -0x40(%rbp)
movq %rax, 0x8(%r15)
movq %r12, %rdi
callq 0x1150
movq %rax, %r12
movq %r13, %rax
movq 0x10(%r13), %r13
movq 0x18(%rax), %rdx
movl %r14d, -0x2c(%rbp)
movq %rbx, -0x58(%rbp)
testq %rbx, %rbx
jle 0x1c54
movq %rdx, -0x38(%rbp)
movslq %r14d, %rbx
movq -0x48(%rbp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, (%rax,%rbx,4)
movl %ecx, (%r12,%rbx,4)
movl $0x18, %edi
callq 0x1100
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl %ebx, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x257c
movslq -0x2c(%rbp), %r14
movslq (%r13,%r14,4), %r15
cmpl 0x4(%r13,%r14,4), %r15d
jge 0x1c43
movq -0x38(%rbp), %rdx
movl (%rdx,%r15,4), %ebx
movl %ebx, -0x30(%rbp)
cmpl $-0x1, %ebx
sete %al
cmpl %r14d, %ebx
setge %cl
orb %al, %cl
jne 0x1c2a
movl -0x2c(%rbp), %eax
movslq %ebx, %rcx
movl (%r12,%rcx,4), %ebx
movl %r14d, (%r12,%rcx,4)
cmpl $-0x1, %ebx
je 0x1be5
movl %ebx, -0x30(%rbp)
movl %eax, %r14d
cmpl %eax, %ebx
jl 0x1bc6
movl %eax, %r14d
jmp 0x1c2a
movq -0x48(%rbp), %rax
movl %r14d, (%rax,%rcx,4)
movq -0x40(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x15f8
movq (%rax), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x1c16
movl -0x30(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x1c1f
leaq -0x30(%rbp), %rdx
callq 0x26c2
movq -0x38(%rbp), %rdx
movl %ebx, -0x30(%rbp)
movl -0x2c(%rbp), %r14d
incq %r15
movslq %r14d, %rax
movslq 0x4(%r13,%rax,4), %rax
cmpq %rax, %r15
jl 0x1bac
incl %r14d
jmp 0x1c46
incq %r14
movl %r14d, -0x2c(%rbp)
cmpl -0x58(%rbp), %r14d
jl 0x1b55
movq -0x50(%rbp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq