#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 */
typedef scalar_t__ int8_t;

/* Variables and functions */
float get_cube_offset_float(scalar_t__, float *, float *);
float get_min_dist_float(float *point_coord, int8_t no_dims, float *bbox) {
  float cube_offset = 0, cube_offset_dim;
  for (int8_t i = 0; i < no_dims; i++) {
    cube_offset_dim = get_cube_offset_float(i, point_coord, bbox);
    cube_offset += cube_offset_dim * cube_offset_dim;
  }
  return cube_offset;
}


x86 assembly (clang, -O0):
<get_min_dist_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1185 <get_min_dist_float+0x75>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_cube_offset_float@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1134 <get_min_dist_float+0x24>
movss  -0x1c(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_min_dist_float>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
jle    1169 <get_min_dist_float+0x59>
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <get_cube_offset_float@plt>
mulss  %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x4(%rsp),%xmm0
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <get_min_dist_float+0x20>
jmp    116c <get_min_dist_float+0x5c>
xorps  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @get_min_dist_float(float* %0, i64 %1, float* %2) {
%4 = alloca float*
%5 = alloca i64
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca i64
store float* %0, float** %4
store i64 %1, i64* %5
store float* %2, float** %6
store float 0.000000e+00, float* %7
store i64 0, i64* %9
br label %10
10: ; preds = %23, %3
%11 = load i64, i64* %9
%12 = load i64, i64* %5
%13 = icmp slt i64 %11, %12
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i64, i64* %9
%16 = load float*, float** %4
%17 = load float*, float** %6
%18 = call float @get_cube_offset_float(i64 %15, float* %16, float* %17)
store float %18, float* %8
%19 = load float, float* %8
%20 = load float, float* %8
%21 = load float, float* %7
%22 = call float @llvm.fmuladd.f32(float %19, float %20, float %21)
store float %22, float* %7
br label %23
23: ; preds = %14
%24 = load i64, i64* %9
%25 = add nsw i64 %24, 1
store i64 %25, i64* %9
br label %10
26: ; preds = %10
%27 = load float, float* %7
ret float %27
}

LLVM IR (-O2):
define float @get_min_dist_float(float* %0, i64 %1, float* %2) {
%4 = icmp sgt i64 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %7, %3
%6 = phi float [ 0.000000e+00, %3 ], [ %11, %7 ]
ret float %6
7: ; preds = %3, %7
%8 = phi i64 [ %12, %7 ], [ 0, %3 ]
%9 = phi float [ %11, %7 ], [ 0.000000e+00, %3 ]
%10 = tail call float @get_cube_offset_float(i64 %8, float* %0, float* %2)
%11 = tail call float @llvm.fmuladd.f32(float %10, float %10, float %9)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %1
br i1 %13, label %5, label %7
}