// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/anharmonic_tnm.c
// Function: Assign_interactions_SB_old
void Assign_interactions_SB_old(struct interaction *Int_list, int N_int,
				int POW, float EXPO, float k0)
{
  float A2; int n;
  if(POW){
    lambda=EXPO/4-0.5; lambda_2=2*lambda;
    A2=k0*pow(C0,EXPO)/(lambda_2*lambda_2);
    for(n=0; n<N_int; n++){
      Int_list[n].A2=A2*pow(Int_list[n].r0,-lambda_2);
    }
  }else{
    lambda=EXPO/4; lambda_2=2*lambda;
    A2=k0*exp(C0*EXPO)/(lambda_2*lambda_2);
    for(int n=0; n<N_int; n++){
      Int_list[n].A2=A2*exp(-Int_list[n].r0*lambda_2);
    }
  }
  float A4=A2/2;
  E_repulsion=A4;
  float kk0=A2*lambda_2*lambda_2, kk, EPS=0.005; int err=0;
  struct interaction *Int=Int_list;
  for(n=0; n<N_int; n++){
    Int->A4=A4;
    Int->A1=0;
    Int->A0=0;
    Int->r1=(Int->r0+C_THR)/2;
    Int->A0=-Compute_V(Int, C_THR);
    Int->E_min=Compute_V(Int, Int->r0);
    // Interpolation(Int_list+n);
    // Check force constant
    if(POW){kk=kk0*pow(Int->r0,-EXPO);}
    else{kk=kk0*exp(-Int->r0*EXPO);}
    if(fabs(kk-Int->sec_der)>EPS){
      err++;
      if(err <= 10){
	printf("ERROR in Assign_int n=%d r= %.2f ", n, Int->r0);
	printf("k= %.4g (old) %.4g (new) /= %.3f\n", 
	       Int->sec_der, kk, Int->sec_der/kk);
      }else{
	printf(".");
      }
    }
    Int++;
  }
  if(err){
    printf("\n%d errors in Assign_int, POW= %d EXPO= %.1f K0= %.4g r0= %.1f\n",
	   err, POW, EXPO, k0, C0); exit(8);
  }

  // Print energy versus r0
  char name_out[200]="Anharmonic_energy_TNM.dat";
  FILE *file_out=fopen(name_out, "w");
  printf("Writing %s\n", name_out);
  if(POW){ // power law: C0^-e
    fprintf(file_out, "# f(r)= %.2f r^(-%.2f)\n", -A4, EXPO);
  }else{ // Exponential
    fprintf(file_out, "# f(r)= %.2f exp(-%.2f*r)\n", -A4, EXPO);
  }
  for(float r=2.0; r<4.6; r+=0.005){
    float f;
    if(POW){f=-A4*pow(r,-EXPO);}
    else{f=-A4*exp(-EXPO*r);}
    fprintf(file_out, "%.2f %.4g\n", r, f);
  }
  fclose(file_out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movaps %xmm0, %xmm2
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movss 0x38748(%rip), %xmm0    # 0x572a4
mulss %xmm2, %xmm0
testl %edx, %edx
movaps %xmm2, 0x20(%rsp)
movss %xmm1, 0x1c(%rsp)
je 0x1ec31
addss 0x3872d(%rip), %xmm0    # 0x572a8
leaq 0x4a552(%rip), %rax     # 0x690d4
movss %xmm0, (%rax)
addss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x5a74a(%rip)    # 0x792e0
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, (%rsp)
leaq 0x4a4cb(%rip), %rax     # 0x69074
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
callq 0x20a0
mulsd (%rsp), %xmm0
movsd 0x5a717(%rip), %xmm1    # 0x792e0
mulsd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
testl %ebp, %ebp
jle 0x1eef9
movss %xmm0, 0x8(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movl %ebp, %eax
imulq $0xc8, %rax, %r15
xorl %r12d, %r12d
movsd 0x20(%r14,%r12), %xmm0
movsd 0x5a6d9(%rip), %xmm1    # 0x792e0
xorpd 0x32481(%rip), %xmm1    # 0x51090
callq 0x20a0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x40(%r14,%r12)
addq $0xc8, %r12
cmpq %r12, %r15
jne 0x1ebf8
jmp 0x1ece0
leaq 0x4a49c(%rip), %rax     # 0x690d4
movss %xmm0, (%rax)
addss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x5a694(%rip)    # 0x792e0
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, (%rsp)
leaq 0x4a415(%rip), %rax     # 0x69074
movss (%rax), %xmm0
mulss %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x22b0
mulsd (%rsp), %xmm0
movsd 0x5a663(%rip), %xmm1    # 0x792e0
mulsd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
testl %ebp, %ebp
jle 0x1eef9
movss %xmm0, 0x8(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movl %ebp, %eax
imulq $0xc8, %rax, %r15
xorl %r12d, %r12d
movsd 0x20(%r14,%r12), %xmm0
xorpd 0x323d5(%rip), %xmm0    # 0x51090
mulsd 0x5a61d(%rip), %xmm0    # 0x792e0
callq 0x22b0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x40(%r14,%r12)
addq $0xc8, %r12
cmpq %r12, %r15
jne 0x1ecac
movss 0x36edc(%rip), %xmm2    # 0x55bc4
movss 0x8(%rsp), %xmm1
mulss %xmm1, %xmm2
leaq 0x4a3df(%rip), %rax     # 0x690d8
movss %xmm2, (%rax)
testl %ebp, %ebp
movaps %xmm2, 0x40(%rsp)
jle 0x1ef11
movsd 0x5a5ce(%rip), %xmm0    # 0x792e0
cvtss2sd %xmm1, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
movsd %xmm1, 0x8(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movaps 0x322ed(%rip), %xmm0    # 0x51030
movaps 0x20(%rsp), %xmm1
xorps %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq $0x0, (%rsp)
leaq 0x4a2f7(%rip), %r12     # 0x69068
xorl %r13d, %r13d
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x48(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r14)
movss (%r12), %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
addsd 0x20(%r14), %xmm1
mulsd 0x323cd(%rip), %xmm1    # 0x51170
cvtsd2ss %xmm1, %xmm1
movss %xmm1, 0x10(%r14)
movq %r14, %rdi
callq 0x1c59a
xorps 0x32274(%rip), %xmm0    # 0x51030
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x30(%r14)
xorps %xmm0, %xmm0
cvtsd2ss 0x20(%r14), %xmm0
movq %r14, %rdi
callq 0x1c59a
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xb8(%r14)
movsd 0x20(%r14), %xmm0
testl %ebx, %ebx
je 0x1edfb
movsd 0x38(%rsp), %xmm1
callq 0x20a0
jmp 0x1ee0e
xorpd 0x3228d(%rip), %xmm0    # 0x51090
mulsd 0x30(%rsp), %xmm0
callq 0x22b0
mulsd 0x10(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movaps %xmm1, %xmm0
subsd 0x28(%r14), %xmm0
andpd 0x384c0(%rip), %xmm0    # 0x572f0
ucomisd 0x38558(%rip), %xmm0    # 0x57390
jbe 0x1eea7
movl %ebx, %r15d
movl %ebp, %ebx
movq %r12, %rbp
movq (%rsp), %rax
leal 0x1(%rax), %r12d
cmpl $0x9, %eax
jg 0x1ee8e
movsd 0x20(%r14), %xmm0
leaq 0x39292(%rip), %rdi     # 0x580ee
movl %r13d, %esi
movb $0x1, %al
movsd %xmm1, (%rsp)
callq 0x20f0
movsd 0x28(%r14), %xmm0
movapd %xmm0, %xmm2
movsd (%rsp), %xmm1
divsd %xmm1, %xmm2
leaq 0x3928b(%rip), %rdi     # 0x58110
movb $0x3, %al
callq 0x20f0
jmp 0x1ee98
movl $0x2e, %edi
callq 0x2060
movl %r12d, %eax
movq %rax, (%rsp)
movq %rbp, %r12
movl %ebx, %ebp
movl %r15d, %ebx
addq $0xc8, %r14
incl %r13d
cmpl %r13d, %ebp
jne 0x1ed74
movq (%rsp), %rsi
testl %esi, %esi
je 0x1ef11
xorps %xmm1, %xmm1
cvtss2sd 0x1c(%rsp), %xmm1
leaq 0x4a1a2(%rip), %rax     # 0x69074
xorps %xmm2, %xmm2
cvtss2sd (%rax), %xmm2
leaq 0x39252(%rip), %rdi     # 0x58132
movl %ebx, %edx
movsd 0x30(%rsp), %xmm0
movb $0x3, %al
callq 0x20f0
movl $0x8, %edi
callq 0x2280
mulss 0x36cc3(%rip), %xmm0    # 0x55bc4
leaq 0x4a1d0(%rip), %rax     # 0x690d8
movss %xmm0, (%rax)
movaps %xmm0, 0x40(%rsp)
leaq 0x38508(%rip), %rsi     # 0x57420
leaq 0x50(%rsp), %r15
movl $0xc8, %edx
movq %r15, %rdi
callq 0x21b0
leaq 0x382cf(%rip), %rsi     # 0x57200
movq %r15, %rdi
callq 0x2220
movq %rax, %r14
leaq 0x32e0c(%rip), %rdi     # 0x51d4f
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
testl %ebx, %ebx
movaps 0x40(%rsp), %xmm0
xorps 0x320d5(%rip), %xmm0    # 0x51030
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x20(%rsp), %xmm1
leaq 0x3921b(%rip), %rax     # 0x5818a
leaq 0x391fc(%rip), %rsi     # 0x58172
cmoveq %rax, %rsi
movq %r14, %rdi
movsd %xmm0, 0x8(%rsp)
movb $0x2, %al
callq 0x21a0
movaps 0x20(%rsp), %xmm1
xorps 0x3209a(%rip), %xmm1    # 0x51030
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movss 0x37f09(%rip), %xmm0    # 0x56eb4
movsd 0x321cd(%rip), %xmm2    # 0x51180
leaq 0x39126(%rip), %r15     # 0x580e0
movaps %xmm1, 0x20(%rsp)
testl %ebx, %ebx
movsd %xmm2, (%rsp)
je 0x1efd8
movaps %xmm2, %xmm0
movsd 0x10(%rsp), %xmm1
callq 0x20a0
jmp 0x1efe5
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x22b0
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
movb $0x2, %al
callq 0x21a0
movsd (%rsp), %xmm0
addsd 0x3793b(%rip), %xmm0    # 0x56950
cvtsd2ss %xmm0, %xmm0
xorps %xmm2, %xmm2
cvtss2sd %xmm0, %xmm2
movsd 0x38370(%rip), %xmm1    # 0x57398
ucomisd %xmm2, %xmm1
movaps 0x20(%rsp), %xmm1
ja 0x1efbf
movq %r14, %rdi
callq 0x20c0
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)