// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/anharmonic_tnm.c
// Function: Min_res_dist
float Min_res_dist(float *r, atom *atoms, int *i1, int *i2, int n, int natm)
{
  int res1=atoms[*i1].res, j1=Start_res(atoms, *i1, res1);
  // YY ??? think because it's the ID of CA, so goes -1 to start with N.
  int res2=atoms[*i2].res, j2=Start_res(atoms, *i2, res2);

  float d, d2, d2_min=1000;
  atom *atom1=atoms+j1; float *r1=r+3*j1;
  // YY coord of atom j1 (r beginning of array with all atom coord)
  while(atom1->res==res1){
    atom *atom2=atoms+j2; float *r2=r+3*j2; int jj2=j2;
    while(atom2->res==res2){
      if((NOCOV) && Covalent(res1, res2, atom1, atom2))goto next;
      d=r1[0]-r2[0]; d2 =d*d; if(d2>d2_min)goto next;
      d=r1[1]-r2[1]; d2+=d*d; if(d2>d2_min)goto next;
      d=r1[2]-r2[2]; d2+=d*d; if(d2>d2_min)goto next;
      if(d2<d2_min){d2_min=d2; *i1=j1; *i2=jj2;}
    next:
      r2+=3; atom2++; jj2++; if(jj2>=natm)break;
    }
    r1+=3; atom1++; j1++; if(j1>=natm)break;
  }
  if((d2_min<=C22)||(n>=0))return(sqrt(d2_min));
  return(100);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
movl -0x34(%rbp), %edx
callq 0x27610
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movl (%rax), %esi
movl -0x3c(%rbp), %edx
callq 0x27610
movl %eax, -0x40(%rbp)
movss 0x5500b(%rip), %xmm0    # 0x7c3e0
movss %xmm0, -0x4c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
imull $0x3, -0x38(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movl 0x64(%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x275bc
movq -0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
imull $0x3, -0x40(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x68(%rbp), %rax
movl 0x64(%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0x2758c
leaq 0x64167(%rip), %rax     # 0x8b5c0
cmpl $0x0, (%rax)
je 0x2747b
movl -0x34(%rbp), %edi
movl -0x3c(%rbp), %esi
movq -0x58(%rbp), %rdx
movq -0x68(%rbp), %rcx
callq 0x215f0
cmpl $0x0, %eax
je 0x2747b
jmp 0x2755c
movq -0x60(%rbp), %rax
movss (%rax), %xmm0
movq -0x70(%rbp), %rax
subss (%rax), %xmm0
movss %xmm0, -0x44(%rbp)
movss -0x44(%rbp), %xmm0
mulss -0x44(%rbp), %xmm0
movss %xmm0, -0x48(%rbp)
movss -0x48(%rbp), %xmm0
ucomiss -0x4c(%rbp), %xmm0
jbe 0x274af
jmp 0x2755c
movq -0x60(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x70(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x44(%rbp)
movss -0x44(%rbp), %xmm0
movss -0x44(%rbp), %xmm2
movss -0x48(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x48(%rbp)
movss -0x48(%rbp), %xmm0
ucomiss -0x4c(%rbp), %xmm0
jbe 0x274ef
jmp 0x2755c
movq -0x60(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x70(%rbp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0x44(%rbp)
movss -0x44(%rbp), %xmm0
movss -0x44(%rbp), %xmm2
movss -0x48(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x48(%rbp)
movss -0x48(%rbp), %xmm0
ucomiss -0x4c(%rbp), %xmm0
jbe 0x2752f
jmp 0x2755c
movss -0x48(%rbp), %xmm1
movss -0x4c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x2755a
movss -0x48(%rbp), %xmm0
movss %xmm0, -0x4c(%rbp)
movl -0x38(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x74(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x2755c
movq -0x70(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
addq $0x70, %rax
movq %rax, -0x68(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x30(%rbp), %eax
jl 0x27587
jmp 0x2758c
jmp 0x27442
movq -0x60(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
addq $0x70, %rax
movq %rax, -0x58(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x30(%rbp), %eax
jl 0x275b7
jmp 0x275bc
jmp 0x27403
movss -0x4c(%rbp), %xmm1
movss 0x74cd3(%rip), %xmm0    # 0x9c29c
ucomiss %xmm1, %xmm0
jae 0x275d4
cmpl $0x0, -0x2c(%rbp)
jl 0x275ed
movss -0x4c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4(%rbp)
jmp 0x275fa
movss 0x4eabb(%rip), %xmm0    # 0x760b0
movss %xmm0, -0x4(%rbp)
movss -0x4(%rbp), %xmm0
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)