#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 */
double pow(double const, int);
double sqrt(double);
double dist_between_boxes(const double *x1, const double *y1, const double *z1,
                          int n1, const double *x2, const double *y2,
                          const double *z2, int n2) {
  double dist;
  int i, j;
  dist = 0.0;
  for (i = 0; i < n1; i++) {
    for (j = 0; j < n2; j++) {
      dist = (dist > pow(x1[i] - x2[j], 2.) + pow(y1[i] - y2[j], 2.) +
                          pow(z1[i] - z2[j], 2.)
                  ? dist
                  : pow(x1[i] - x2[j], 2.) + pow(y1[i] - y2[j], 2.) +
                        pow(z1[i] - z2[j], 2.));
    }
  }
  dist = sqrt(dist);
  return (dist);
}


x86 assembly (clang, -O0):
<dist_between_boxes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12e8 <dist_between_boxes+0x1c8>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    12d5 <dist_between_boxes+0x1b5>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    122a <dist_between_boxes+0x10a>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    12bd <dist_between_boxes+0x19d>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1168 <dist_between_boxes+0x48>
jmp    12da <dist_between_boxes+0x1ba>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1155 <dist_between_boxes+0x35>
movsd  -0x38(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_between_boxes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,0x18(%rsp)
xorpd  %xmm0,%xmm0
test   %ecx,%ecx
jle    1291 <dist_between_boxes+0x171>
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
mov    0x78(%rsp),%eax
mov    0x70(%rsp),%rbp
mov    %ecx,%ecx
mov    %rcx,0x28(%rsp)
mov    %eax,0x14(%rsp)
mov    %eax,%eax
mov    %rax,0x30(%rsp)
xorpd  %xmm0,%xmm0
xor    %r14d,%r14d
jmp    118f <dist_between_boxes+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    0x28(%rsp),%r14
je     1291 <dist_between_boxes+0x171>
cmpl   $0x0,0x14(%rsp)
jle    1180 <dist_between_boxes+0x60>
xor    %r15d,%r15d
jmp    11ab <dist_between_boxes+0x8b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %r15,0x30(%rsp)
je     1180 <dist_between_boxes+0x60>
movsd  %xmm0,(%rsp)
movsd  (%rbx,%r14,8),%xmm0
mov    0x18(%rsp),%rax
subsd  (%rax,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x0(%r13,%r14,8),%xmm0
mov    0x20(%rsp),%rax
subsd  (%rax,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r12,%r14,8),%xmm0
subsd  0x0(%rbp,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
addsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  (%rsp),%xmm0
ja     11a0 <dist_between_boxes+0x80>
movsd  (%rbx,%r14,8),%xmm0
mov    0x18(%rsp),%rax
subsd  (%rax,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,(%rsp)
movsd  0x0(%r13,%r14,8),%xmm0
mov    0x20(%rsp),%rax
subsd  (%rax,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%r12,%r14,8),%xmm0
subsd  0x0(%rbp,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
addsd  (%rsp),%xmm0
jmp    11a0 <dist_between_boxes+0x80>
ucomisd 0xd67(%rip),%xmm0
jb     12ae <dist_between_boxes+0x18e>
sqrtsd %xmm0,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @dist_between_boxes(double* %0, double* %1, double* %2, i32 %3, double* %4, double* %5, double* %6, i32 %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca i32
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
store double* %0, double** %9
store double* %1, double** %10
store double* %2, double** %11
store i32 %3, i32* %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store i32 %7, i32* %16
store double 0.000000e+00, double* %17
store i32 0, i32* %18
br label %20
20: ; preds = %117, %8
%21 = load i32, i32* %18
%22 = load i32, i32* %12
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %120
24: ; preds = %20
store i32 0, i32* %19
br label %25
25: ; preds = %113, %24
%26 = load i32, i32* %19
%27 = load i32, i32* %16
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %116
29: ; preds = %25
%30 = load double, double* %17
%31 = load double*, double** %9
%32 = load i32, i32* %18
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = load double*, double** %13
%37 = load i32, i32* %19
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = fsub double %35, %40
%42 = call double @pow(double %41, i32 2)
%43 = load double*, double** %10
%44 = load i32, i32* %18
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %14
%49 = load i32, i32* %19
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = fsub double %47, %52
%54 = call double @pow(double %53, i32 2)
%55 = fadd double %42, %54
%56 = load double*, double** %11
%57 = load i32, i32* %18
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load double*, double** %15
%62 = load i32, i32* %19
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
%65 = load double, double* %64
%66 = fsub double %60, %65
%67 = call double @pow(double %66, i32 2)
%68 = fadd double %55, %67
%69 = fcmp ogt double %30, %68
br i1 %69, label %70, label %72
70: ; preds = %29
%71 = load double, double* %17
br label %111
72: ; preds = %29
%73 = load double*, double** %9
%74 = load i32, i32* %18
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = load double, double* %76
%78 = load double*, double** %13
%79 = load i32, i32* %19
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %78, i64 %80
%82 = load double, double* %81
%83 = fsub double %77, %82
%84 = call double @pow(double %83, i32 2)
%85 = load double*, double** %10
%86 = load i32, i32* %18
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
%89 = load double, double* %88
%90 = load double*, double** %14
%91 = load i32, i32* %19
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = fsub double %89, %94
%96 = call double @pow(double %95, i32 2)
%97 = fadd double %84, %96
%98 = load double*, double** %11
%99 = load i32, i32* %18
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
%103 = load double*, double** %15
%104 = load i32, i32* %19
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
%107 = load double, double* %106
%108 = fsub double %102, %107
%109 = call double @pow(double %108, i32 2)
%110 = fadd double %97, %109
br label %111
111: ; preds = %72, %70
%112 = phi double [ %71, %70 ], [ %110, %72 ]
store double %112, double* %17
br label %113
113: ; preds = %111
%114 = load i32, i32* %19
%115 = add nsw i32 %114, 1
store i32 %115, i32* %19
br label %25
116: ; preds = %25
br label %117
117: ; preds = %116
%118 = load i32, i32* %18
%119 = add nsw i32 %118, 1
store i32 %119, i32* %18
br label %20
120: ; preds = %20
%121 = load double, double* %17
%122 = call double @sqrt(double %121)
store double %122, double* %17
%123 = load double, double* %17
ret double %123
}

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