// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/allostery.c
// Function: Make_profile
float *Make_profile(float **Mat, int N, char PROF_TYPE, char *what)
{
  printf("Computing profiles of %s type %c\n", what, PROF_TYPE);
  float *prof=malloc(N*sizeof(float)); int i;
  float weight[N], sum_weight=0;
  if(PROF_TYPE=='A'){
    sum_weight=N; for(i=0; i<N; i++)weight[i]=1;
  }else{
    double **Mat2=Get_matrix_positive(Mat, N);
    if(PROF_TYPE=='P'){
      PE_profile(weight, Mat2, N);
    }else if(PROF_TYPE=='C'){
      float *c=EC_profile(NULL, Mat2, N, what);
      for(i=0; i<N; i++)weight[i]=c[i];
      free(c);
    }
    for(i=0; i<N; i++)sum_weight+=weight[i];
    Empty_matrix_d(Mat2, N);
  }
  for(i=0; i<N; i++){
    double sum=0; float *Ca=Mat[i];
    for(int j=0; j<N; j++)if(j!=i)sum+=Ca[j]*weight[j];
    prof[i]=sum/(sum_weight-weight[i]);
  }
  return(prof);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movl %esi, %r12d
movq %rdi, -0x40(%rbp)
leaq 0x18a3b(%rip), %rdi     # 0x5d51b
movq %rcx, -0x48(%rbp)
movq %rcx, %rsi
xorl %eax, %eax
callq 0x20f0
movslq %r12d, %r15
leaq (,%r15,4), %rdi
callq 0x21e0
movq %rax, %r14
movl %r15d, %r13d
movq %rsp, %r15
leaq 0xf(,%r13,4), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movl %ebx, -0x30(%rbp)
cmpb $0x41, %bl
jne 0x44c3a
testl %r12d, %r12d
movq -0x40(%rbp), %rbx
jle 0x44d3d
cvtsi2ss %r12d, %xmm9
leal 0x3(%r13), %eax
leaq -0x1(%r13), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %eax
shlq $0x4, %rax
movdqa 0xc4b8(%rip), %xmm1     # 0x51010
movdqa 0xc4c0(%rip), %xmm2     # 0x51020
xorl %ecx, %ecx
movdqa 0xc4c6(%rip), %xmm3     # 0x51030
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x11606(%rip), %xmm5    # 0x56180
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x44bb6
movl $0x3f800000, (%r15,%rcx) # imm = 0x3F800000
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x44bcd
movl $0x3f800000, 0x4(%r15,%rcx) # imm = 0x3F800000
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edx
testb $0x1, %dl
je 0x44c0d
movl $0x3f800000, 0x8(%r15,%rcx) # imm = 0x3F800000
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x44c20
movl $0x3f800000, 0xc(%r15,%rcx) # imm = 0x3F800000
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x44b7a
jmp 0x44ce9
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
movl %r12d, -0x34(%rbp)
movl %r12d, %esi
callq 0x47fa4
movsbl -0x30(%rbp), %ecx
cmpl $0x43, %ecx
je 0x44c74
cmpl $0x50, %ecx
movl -0x34(%rbp), %r12d
jne 0x44cbb
movq %r15, %rdi
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x46ad8
jmp 0x44cb7
xorl %edi, %edi
movq %rax, -0x30(%rbp)
movq %rax, %rsi
movl -0x34(%rbp), %r12d
movl %r12d, %edx
movq -0x48(%rbp), %rcx
callq 0x4f4b8
testl %r12d, %r12d
jle 0x44cab
leaq (,%r13,4), %rdx
movq %r15, %rdi
movq %rax, %rsi
movq %rax, %r12
callq 0x21b0
movq %r12, %rax
movq %rax, %rdi
callq 0x2050
movl -0x34(%rbp), %r12d
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
testl %r12d, %r12d
jle 0x44cd3
xorl %ecx, %ecx
addss (%r15,%rcx,4), %xmm0
incq %rcx
cmpq %rcx, %r13
jne 0x44cc5
movss %xmm0, -0x30(%rbp)
movq %rax, %rdi
movl %r12d, %esi
callq 0x496ae
movss -0x30(%rbp), %xmm9
testl %r12d, %r12d
jle 0x44d3d
xorl %eax, %eax
movq (%rbx,%rax,8), %rcx
xorps %xmm0, %xmm0
xorl %edx, %edx
cmpq %rdx, %rax
je 0x44d11
movss (%rcx,%rdx,4), %xmm1
mulss (%r15,%rdx,4), %xmm1
cvtss2sd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rdx
cmpq %rdx, %r13
jne 0x44cf9
movaps %xmm9, %xmm1
subss (%r15,%rax,4), %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%r14,%rax,4)
incq %rax
cmpq %r13, %rax
jne 0x44cf0
movq %r14, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq