#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;
  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)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12e0 <dist_between_boxes+0x1c0>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    12cd <dist_between_boxes+0x1ad>
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    1222 <dist_between_boxes+0x102>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    12b5 <dist_between_boxes+0x195>
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    1160 <dist_between_boxes+0x40>
jmp    12d2 <dist_between_boxes+0x1b2>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    114d <dist_between_boxes+0x2d>
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,0x28(%rsp)
mov    %r8,0x20(%rsp)
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
mov    0x78(%rsp),%eax
mov    %rax,0x18(%rsp)
mov    0x70(%rsp),%rbp
mov    %ecx,%eax
mov    %rax,0x30(%rsp)
xor    %r14d,%r14d
jmp    116f <dist_between_boxes+0x4f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    0x30(%rsp),%r14
je     1276 <dist_between_boxes+0x156>
cmpl   $0x0,0x18(%rsp)
jle    1160 <dist_between_boxes+0x40>
xor    %r15d,%r15d
jmp    1191 <dist_between_boxes+0x71>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
add    $0x1,%r15
cmp    %r15,0x18(%rsp)
je     1160 <dist_between_boxes+0x40>
movsd  (%rbx,%r14,8),%xmm0
mov    0x20(%rsp),%rax
subsd  (%rax,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x0(%r13,%r14,8),%xmm0
mov    0x28(%rsp),%rax
subsd  (%rax,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%r12,%r14,8),%xmm0
subsd  0x0(%rbp,%r15,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
addsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
ja     1180 <dist_between_boxes+0x60>
movsd  (%rbx,%r14,8),%xmm0
mov    0x20(%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    0x28(%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
jmp    1180 <dist_between_boxes+0x60>
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     129d <dist_between_boxes+0x17d>
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 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
%10 = icmp sgt i32 %7, 0
%11 = zext i32 %3 to i64
%12 = zext i32 %7 to i64
br label %13
13: ; preds = %8, %60
%14 = phi i64 [ 0, %8 ], [ %62, %60 ]
%15 = phi double [ undef, %8 ], [ %61, %60 ]
br i1 %10, label %16, label %60
16: ; preds = %13
%17 = getelementptr inbounds double, double* %0, i64 %14
%18 = getelementptr inbounds double, double* %1, i64 %14
%19 = getelementptr inbounds double, double* %2, i64 %14
br label %20
20: ; preds = %16, %56
%21 = phi i64 [ 0, %16 ], [ %58, %56 ]
%22 = phi double [ %15, %16 ], [ %57, %56 ]
%23 = load double, double* %17
%24 = getelementptr inbounds double, double* %4, i64 %21
%25 = load double, double* %24
%26 = fsub double %23, %25
%27 = tail call double @pow(double %26, i32 2)
%28 = load double, double* %18
%29 = getelementptr inbounds double, double* %5, i64 %21
%30 = load double, double* %29
%31 = fsub double %28, %30
%32 = tail call double @pow(double %31, i32 2)
%33 = fadd double %27, %32
%34 = load double, double* %19
%35 = getelementptr inbounds double, double* %6, i64 %21
%36 = load double, double* %35
%37 = fsub double %34, %36
%38 = tail call double @pow(double %37, i32 2)
%39 = fadd double %33, %38
%40 = fcmp ogt double %22, %39
br i1 %40, label %56, label %41
41: ; preds = %20
%42 = load double, double* %17
%43 = load double, double* %24
%44 = fsub double %42, %43
%45 = tail call double @pow(double %44, i32 2)
%46 = load double, double* %18
%47 = load double, double* %29
%48 = fsub double %46, %47
%49 = tail call double @pow(double %48, i32 2)
%50 = fadd double %45, %49
%51 = load double, double* %19
%52 = load double, double* %35
%53 = fsub double %51, %52
%54 = tail call double @pow(double %53, i32 2)
%55 = fadd double %50, %54
br label %56
56: ; preds = %20, %41
%57 = phi double [ %55, %41 ], [ %22, %20 ]
%58 = add nuw nsw i64 %21, 1
%59 = icmp eq i64 %58, %12
br i1 %59, label %60, label %20
60: ; preds = %56, %13
%61 = phi double [ %15, %13 ], [ %57, %56 ]
%62 = add nuw nsw i64 %14, 1
%63 = icmp eq i64 %62, %11
br i1 %63, label %64, label %13
64: ; preds = %60
%65 = tail call double @sqrt(double %61)
ret double %65
}