// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/nma.c
// Function: Transform_tors_modes_old
void Transform_tors_modes_old(float *Tors_mode, float *Masswtd_Tors_mode,
			      double **T_sqrt, double **T_sqrt_inv,
			      int N_modes, int N_axes)
{
  int ib, j;
  float *Mw_ev=Masswtd_Tors_mode;
  float *ev=Tors_mode;

  if(KINETIC==0){
    for(ib=0; ib<N_modes; ib++)ev[ib]=Mw_ev[ib];
  }else if(T_sqrt_inv){
    // ev= T_sqrt_inv Masswtd_ev
    for(ib=0; ib<N_axes; ib++){
      double sum=0;
      for(j=0; j<N_modes; j++)sum+=Mw_ev[j]*T_sqrt_inv[j][ib];
      ev[ib]=sum;
    }
  }else{
    // Solve (L^t)EV = M_EV by backward_substitution
    // x_i =(v_i - sum_j>i L_ji x_j)/L_ii
    double *x=malloc(N_modes*sizeof(double));
    for(ib=N_modes-1; ib>=0; ib--){
      x[ib]=Mw_ev[ib];
      for(j=ib+1; j<N_modes; j++)x[ib]-= x[j]*T_sqrt[j][ib];
      x[ib]/=T_sqrt[ib][ib];
      ev[ib]=x[ib];
    }
    free(x);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x5893d(%rip), %rax     # 0x8b5c4
cmpl $0x0, (%rax)
jne 0x32cc5
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x32cc0
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x40(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x32c93
jmp 0x32e75
cmpq $0x0, -0x20(%rbp)
je 0x32d62
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x32d5d
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x32d39
movq -0x38(%rbp), %rax
movslq -0x30(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x48(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x32cee
movsd -0x48(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x40(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x32cd7
jmp 0x32e73
movslq -0x24(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1180
movq %rax, -0x50(%rbp)
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x32e6a
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x32e13
movq -0x50(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x32dad
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x50(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x40(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x32d7c
movq -0x50(%rbp), %rdi
callq 0x1040
jmp 0x32e75
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)