#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int abs(int);
double sqrt(double);
void c_connections(int natoms, double *x, double *y, double *z,
                   double *atom_radii, int max_atoms_molecule, int *connected,
                   int iwidth) {
  double temp_distance;
  int i, j;
  for (i = 0; i < natoms; i++) {
#pragma omp parallel for ordered
    for (j = 0; j < i; j++) {
      if (abs(i - j) < max_atoms_molecule) {
        temp_distance =
            sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) +
                 (z[i] - z[j]) * (z[i] - z[j]));
        if (temp_distance <= (1.5 * (atom_radii[i] + atom_radii[j]))) {
          connected[j * iwidth + i] = 1;
          connected[i * iwidth + j] = 1;
        }
      }
    }
    connected[i * iwidth + i] = 1;
  }
  return;
}


x86 assembly (clang, -O0):
<c_connections>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12dd <c_connections+0x1bd>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    12b7 <c_connections+0x197>
mov    -0x3c(%rbp),%edi
sub    -0x40(%rbp),%edi
call   1030 <abs@plt>
cmp    -0x2c(%rbp),%eax
jge    12a4 <c_connections+0x184>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm2
movsd  0xd9f(%rip),%xmm0
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     129f <c_connections+0x17f>
mov    0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   0x18(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   0x18(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    12a4 <c_connections+0x184>
jmp    12a9 <c_connections+0x189>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1160 <c_connections+0x40>
mov    0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   0x18(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    114d <c_connections+0x2d>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_connections>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
test   %edi,%edi
jle    12b7 <c_connections+0x1a7>
mov    %r8,%r14
mov    %rdx,%r15
mov    0x90(%rsp),%rax
movslq 0x98(%rsp),%rbp
mov    %edi,%edi
mov    %rdi,0x20(%rsp)
mov    %rbp,0x18(%rsp)
lea    0x0(,%rbp,4),%r13
xor    %r10d,%r10d
xorpd  %xmm2,%xmm2
movsd  0xea1(%rip),%xmm3
mov    %rax,%rbx
mov    %rax,0x10(%rsp)
xor    %edi,%edi
mov    %rcx,0x40(%rsp)
mov    %rsi,0x38(%rsp)
mov    %r9d,0xc(%rsp)
jmp    11b8 <c_connections+0xa8>
nopw   0x0(%rax,%rax,1)
mov    0x30(%rsp),%rbx
mov    0x28(%rsp),%rbp
add    %rdi,%rbp
mov    0x90(%rsp),%rax
movl   $0x1,(%rax,%rbp,4)
add    $0x1,%rdi
add    %r13,0x10(%rsp)
add    $0x4,%rbx
add    $0x4,%r10
cmp    0x20(%rsp),%rdi
je     12b7 <c_connections+0x1a7>
test   %rdi,%rdi
je     12b0 <c_connections+0x1a0>
mov    %rdi,%rax
imul   0x18(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    %edi,%r12d
mov    %rbx,0x30(%rsp)
xor    %ebp,%ebp
mov    %r10,0x50(%rsp)
mov    %rdi,0x48(%rsp)
jmp    1200 <c_connections+0xf0>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x4,%rbp
add    %r13,%rbx
add    $0xffffffff,%r12d
cmp    %rbp,%r10
je     1180 <c_connections+0x70>
mov    %r12d,%eax
neg    %eax
cmovs  %r12d,%eax
cmp    %r9d,%eax
jge    11f0 <c_connections+0xe0>
movsd  (%rsi,%rdi,8),%xmm1
subsd  (%rsi,%rbp,2),%xmm1
movsd  (%r15,%rdi,8),%xmm0
subsd  (%r15,%rbp,2),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  (%rcx,%rdi,8),%xmm0
subsd  (%rcx,%rbp,2),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
jb     1250 <c_connections+0x140>
sqrtsd %xmm0,%xmm0
jmp    127a <c_connections+0x16a>
xchg   %ax,%ax
call   1030 <sqrt@plt>
mov    0x48(%rsp),%rdi
movsd  0xd9e(%rip),%xmm3
xorpd  %xmm2,%xmm2
mov    0x50(%rsp),%r10
mov    0x38(%rsp),%rsi
mov    0x40(%rsp),%rcx
mov    0xc(%rsp),%r9d
movsd  (%r14,%rdi,8),%xmm1
addsd  (%r14,%rbp,2),%xmm1
mulsd  %xmm3,%xmm1
ucomisd %xmm0,%xmm1
jb     11f0 <c_connections+0xe0>
movl   $0x1,(%rbx)
mov    0x10(%rsp),%rax
movl   $0x1,(%rax,%rbp,1)
jmp    11f0 <c_connections+0xe0>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
jmp    118a <c_connections+0x7a>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @c_connections(i32 %0, double* %1, double* %2, double* %3, double* %4, i32 %5, i32* %6, i32 %7) {
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store i32 %5, i32* %14
store i32* %6, i32** %15
store i32 %7, i32* %16
store i32 0, i32* %18
br label %20
20: ; preds = %152, %8
%21 = load i32, i32* %18
%22 = load i32, i32* %9
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %155
24: ; preds = %20
store i32 0, i32* %19
br label %25
25: ; preds = %140, %24
%26 = load i32, i32* %19
%27 = load i32, i32* %18
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %143
29: ; preds = %25
%30 = load i32, i32* %18
%31 = load i32, i32* %19
%32 = sub nsw i32 %30, %31
%33 = call i32 @abs(i32 %32)
%34 = load i32, i32* %14
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %139
36: ; preds = %29
%37 = load double*, double** %10
%38 = load i32, i32* %18
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %10
%43 = load i32, i32* %19
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = fsub double %41, %46
%48 = load double*, double** %10
%49 = load i32, i32* %18
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %10
%54 = load i32, i32* %19
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = fsub double %52, %57
%59 = load double*, double** %11
%60 = load i32, i32* %18
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %59, i64 %61
%63 = load double, double* %62
%64 = load double*, double** %11
%65 = load i32, i32* %19
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = fsub double %63, %68
%70 = load double*, double** %11
%71 = load i32, i32* %18
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
%75 = load double*, double** %11
%76 = load i32, i32* %19
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
%79 = load double, double* %78
%80 = fsub double %74, %79
%81 = fmul double %69, %80
%82 = call double @llvm.fmuladd.f64(double %47, double %58, double %81)
%83 = load double*, double** %12
%84 = load i32, i32* %18
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %83, i64 %85
%87 = load double, double* %86
%88 = load double*, double** %12
%89 = load i32, i32* %19
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %88, i64 %90
%92 = load double, double* %91
%93 = fsub double %87, %92
%94 = load double*, double** %12
%95 = load i32, i32* %18
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
%98 = load double, double* %97
%99 = load double*, double** %12
%100 = load i32, i32* %19
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
%103 = load double, double* %102
%104 = fsub double %98, %103
%105 = call double @llvm.fmuladd.f64(double %93, double %104, double %82)
%106 = call double @sqrt(double %105)
store double %106, double* %17
%107 = load double, double* %17
%108 = load double*, double** %13
%109 = load i32, i32* %18
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %108, i64 %110
%112 = load double, double* %111
%113 = load double*, double** %13
%114 = load i32, i32* %19
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %113, i64 %115
%117 = load double, double* %116
%118 = fadd double %112, %117
%119 = fmul double 1.500000e+00, %118
%120 = fcmp ole double %107, %119
br i1 %120, label %121, label %138
121: ; preds = %36
%122 = load i32*, i32** %15
%123 = load i32, i32* %19
%124 = load i32, i32* %16
%125 = mul nsw i32 %123, %124
%126 = load i32, i32* %18
%127 = add nsw i32 %125, %126
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i32, i32* %122, i64 %128
store i32 1, i32* %129
%130 = load i32*, i32** %15
%131 = load i32, i32* %18
%132 = load i32, i32* %16
%133 = mul nsw i32 %131, %132
%134 = load i32, i32* %19
%135 = add nsw i32 %133, %134
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds i32, i32* %130, i64 %136
store i32 1, i32* %137
br label %138
138: ; preds = %121, %36
br label %139
139: ; preds = %138, %29
br label %140
140: ; preds = %139
%141 = load i32, i32* %19
%142 = add nsw i32 %141, 1
store i32 %142, i32* %19
br label %25
143: ; preds = %25
%144 = load i32*, i32** %15
%145 = load i32, i32* %18
%146 = load i32, i32* %16
%147 = mul nsw i32 %145, %146
%148 = load i32, i32* %18
%149 = add nsw i32 %147, %148
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i32, i32* %144, i64 %150
store i32 1, i32* %151
br label %152
152: ; preds = %143
%153 = load i32, i32* %18
%154 = add nsw i32 %153, 1
store i32 %154, i32* %18
br label %20
155: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @c_connections(i32 %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, i32 %5, i32* nocapture writeonly %6, i32 %7) {
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %66
10: ; preds = %8
%11 = sext i32 %7 to i64
%12 = zext i32 %0 to i64
br label %13
13: ; preds = %10, %60
%14 = phi i64 [ 0, %10 ], [ %64, %60 ]
%15 = icmp eq i64 %14, 0
br i1 %15, label %60, label %16
16: ; preds = %13
%17 = getelementptr inbounds double, double* %1, i64 %14
%18 = getelementptr inbounds double, double* %2, i64 %14
%19 = getelementptr inbounds double, double* %3, i64 %14
%20 = getelementptr inbounds double, double* %4, i64 %14
%21 = mul nsw i64 %14, %11
br label %22
22: ; preds = %16, %57
%23 = phi i64 [ 0, %16 ], [ %58, %57 ]
%24 = sub nsw i64 %14, %23
%25 = trunc i64 %24 to i32
%26 = tail call i32 @llvm.abs.i32(i32 %25, i1 true)
%27 = icmp slt i32 %26, %5
br i1 %27, label %28, label %57
28: ; preds = %22
%29 = load double, double* %17
%30 = getelementptr inbounds double, double* %1, i64 %23
%31 = load double, double* %30
%32 = fsub double %29, %31
%33 = load double, double* %18
%34 = getelementptr inbounds double, double* %2, i64 %23
%35 = load double, double* %34
%36 = fsub double %33, %35
%37 = fmul double %36, %36
%38 = tail call double @llvm.fmuladd.f64(double %32, double %32, double %37)
%39 = load double, double* %19
%40 = getelementptr inbounds double, double* %3, i64 %23
%41 = load double, double* %40
%42 = fsub double %39, %41
%43 = tail call double @llvm.fmuladd.f64(double %42, double %42, double %38)
%44 = tail call double @sqrt(double %43)
%45 = load double, double* %20
%46 = getelementptr inbounds double, double* %4, i64 %23
%47 = load double, double* %46
%48 = fadd double %45, %47
%49 = fmul double %48, 1.500000e+00
%50 = fcmp ugt double %44, %49
br i1 %50, label %57, label %51
51: ; preds = %28
%52 = mul nsw i64 %23, %11
%53 = add nsw i64 %52, %14
%54 = getelementptr inbounds i32, i32* %6, i64 %53
store i32 1, i32* %54
%55 = add nsw i64 %23, %21
%56 = getelementptr inbounds i32, i32* %6, i64 %55
store i32 1, i32* %56
br label %57
57: ; preds = %22, %51, %28
%58 = add nuw nsw i64 %23, 1
%59 = icmp eq i64 %58, %14
br i1 %59, label %60, label %22
60: ; preds = %57, %13
%61 = phi i64 [ 0, %13 ], [ %21, %57 ]
%62 = add nsw i64 %61, %14
%63 = getelementptr inbounds i32, i32* %6, i64 %62
store i32 1, i32* %63
%64 = add nuw nsw i64 %14, 1
%65 = icmp eq i64 %64, %12
br i1 %65, label %66, label %13
66: ; preds = %60, %8
ret void
}