// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/simulation.c
// Function: Energy_clashes
float Energy_clashes(float *r, int N){
  float dthr=1.2, dthr2=dthr*dthr;
  float dthr_large=7*dthr, dthr2_large=dthr_large*dthr_large;
  int large_skip=10, r_skip=3*large_skip;
  double E_sum=0;
  int i, j, k;
  float *ri=r;
  for(i=0; i<N; i++){
    float *rj=r;
    for(j=0; j<i-3; j++){
      float dd=0, d;
      for(k=0; k<3; k++){
	d=ri[k]-rj[k];
	if(fabs(d)> dthr_large){
	  j+=large_skip; rj+=r_skip; goto next_j;
	}
	if(fabs(d)> dthr)goto next_j;
	dd += d*d;
	if(dd > dthr2_large){
	  j+=large_skip; rj+=r_skip; goto next_j;
	}
	if(dd > dthr2)goto next_j;
      }
      if(dd==0){
	printf("ERROR, zero distance for atoms %d and %d\n", i, j);
	exit(8);
      }else{
	E_sum+=1./(dd*dd*dd);
      }
    next_j: rj+=3;
    }
    ri+=3;
  }
  return(E_sum/N);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movss 0x36825(%rip), %xmm0    # 0x8004c
movss %xmm0, -0x10(%rbp)
movss -0x10(%rbp), %xmm0
mulss -0x10(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
movss 0x32bad(%rip), %xmm0    # 0x7c3f0
mulss -0x10(%rbp), %xmm0
movss %xmm0, -0x18(%rbp)
movss -0x18(%rbp), %xmm0
mulss -0x18(%rbp), %xmm0
movss %xmm0, -0x1c(%rbp)
movl $0xa, -0x20(%rbp)
imull $0x3, -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x49a43
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x34(%rbp), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jge 0x49a29
xorps %xmm0, %xmm0
movss %xmm0, -0x54(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0x3, -0x3c(%rbp)
jge 0x499b7
movq -0x48(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
subss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x58(%rbp)
movss -0x58(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x32b9b(%rip), %xmm1    # 0x7c490
pand %xmm1, %xmm0
movss -0x18(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4992b
movl -0x20(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x24(%rbp), %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x49a0f
movss -0x58(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x32b55(%rip), %xmm1    # 0x7c490
pand %xmm1, %xmm0
movss -0x10(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x49953
jmp 0x49a0f
movss -0x58(%rbp), %xmm0
movss -0x58(%rbp), %xmm2
movss -0x54(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x54(%rbp), %xmm0
ucomiss -0x1c(%rbp), %xmm0
jbe 0x4999a
movl -0x20(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x24(%rbp), %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x49a0f
movss -0x54(%rbp), %xmm0
ucomiss -0x14(%rbp), %xmm0
jbe 0x499a7
jmp 0x49a0f
jmp 0x499a9
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x498bc
movss -0x54(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x499e4
jp 0x499e4
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
leaq 0x367df(%rip), %rdi     # 0x801b2
movb $0x0, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
movss -0x54(%rbp), %xmm0
mulss -0x54(%rbp), %xmm0
mulss -0x54(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x2c649(%rip), %xmm0    # 0x76048
divsd %xmm1, %xmm0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x49a0f
movq -0x50(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x50(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4989c
movq -0x48(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x49881
movsd -0x30(%rbp), %xmm0
cvtsi2sdl -0xc(%rbp), %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)