// File: BhanuPrakashN[P]sparse_chol/smatrix.cpp
// Function: UpdateF(Fmatrix*, double*, std::vector<int, std::allocator<int>>*)
Fm *UpdateF(Fm *F,double *l_b,vector<int> *Pind){
    Fm *U=(Fm*)malloc(sizeof(Fm));
    U->n=(F->n)-1;
    U->x=(double **)calloc(U->n,sizeof(double *));
    for(int i=0;i<U->n;i++)
        U->x[i]=(double*)calloc(U->n,sizeof(double));
    vector<int> *Gind=F->indices;
    U->indices =new vector<int>;
    int temp=0;
    if(Pind!=NULL)sort(Pind->begin(),Pind->end());
    //printf("Pind:");
    //for(int i=0;i<Pind->size();i++)
      //  printf("%d ",Pind->at(i) );
    //printf("\nGind:");
    //for(int i=0;i<Gind->size();i++)
      //  printf("%d ",Gind->at(i) );  
    

    for(int i=1;i<F->n;i++){
        //temp=0;
        while(Pind->at(temp)!=Gind->at(i))temp++;
        U->indices->push_back(temp);
    }
    //printf("\nLind:");
    //for(int i=0;i<U->indices->size();i++)
    //    printf("%d ",U->indices->at(i) );
    for(int i=0;i<U->n;i++){
        for(int j=0;j<U->n;j++){
            U->x[i][j]=F->x[i+1][j+1]-l_b[i]*l_b[j];
        }
    }

    return U;



}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x18, %edi
callq 0x1150
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
subl $0x1, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movslq (%rax), %rdi
movl $0x8, %esi
callq 0x10a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2a7e
movq -0x20(%rbp), %rax
movslq (%rax), %rdi
movl $0x8, %esi
callq 0x10a0
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2a44
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x18, %edi
callq 0x1100
movq %rax, %rdi
movq %rdi, -0x60(%rbp)
callq 0x2f00
movq -0x60(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2ae1
movq -0x18(%rbp), %rdi
callq 0x3040
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3070
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x3000
movl $0x1, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2b45
jmp 0x2af5
movq -0x18(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x16a0
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x4c(%rbp), %rsi
callq 0x16a0
movq %rax, %rcx
movl -0x64(%rbp), %eax
cmpl (%rcx), %eax
je 0x2b29
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x2af5
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x34(%rbp), %rsi
callq 0x2f90
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2ae8
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2c04
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2bf4
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x50(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl -0x54(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x10(%rbp), %rax
movslq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2b62
jmp 0x2bf6
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x2b4c
movq -0x20(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nop