#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 /*<<< orphan*/ d7bddist(double *, int);
double fabs(int /*<<< orphan*/);
double d7minbddist(double gvec[7]) {
  int ii;
  double dists[9];
  double minbd;
  dists[0] = fabs(d7bddist(gvec, 0));
  dists[1] = fabs(d7bddist(gvec, 1));
  dists[2] = fabs(d7bddist(gvec, 2));
  dists[3] = fabs(d7bddist(gvec, 3));
  dists[4] = fabs(d7bddist(gvec, 4));
  dists[5] = fabs(d7bddist(gvec, 5));
  dists[6] = fabs(d7bddist(gvec, 6));
  dists[7] = fabs(d7bddist(gvec, 7));
  dists[8] = fabs(d7bddist(gvec, 8));
  minbd = dists[0];
  for (ii = 1; ii < 9; ii++) {
    minbd = (((minbd) < (dists[ii])) ? (minbd) : (dists[ii]));
  }
  return minbd;
}


x86 assembly (clang, -O0):
<d7minbddist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    127d <d7minbddist+0x15d>
movsd  -0x68(%rbp),%xmm1
movslq -0xc(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1256 <d7minbddist+0x136>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1265 <d7minbddist+0x145>
movslq -0xc(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1224 <d7minbddist+0x104>
movsd  -0x68(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d7minbddist>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
xor    %esi,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,0x38(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,0x30(%rsp)
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,0x28(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <d7bddist@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  0x38(%rsp),%xmm1
minsd  0x30(%rsp),%xmm1
minsd  0x28(%rsp),%xmm1
minsd  0x20(%rsp),%xmm1
minsd  0x18(%rsp),%xmm1
minsd  0x10(%rsp),%xmm1
minsd  0x8(%rsp),%xmm1
minsd  (%rsp),%xmm1
minsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @d7minbddist(double* %0) {
%2 = alloca double*
%3 = alloca i32
%4 = alloca [9 x double]
%5 = alloca double
store double* %0, double** %2
%6 = load double*, double** %2
%7 = call i32 @d7bddist(double* %6, i32 0)
%8 = call double @fabs(i32 %7)
%9 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 0
store double %8, double* %9
%10 = load double*, double** %2
%11 = call i32 @d7bddist(double* %10, i32 1)
%12 = call double @fabs(i32 %11)
%13 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 1
store double %12, double* %13
%14 = load double*, double** %2
%15 = call i32 @d7bddist(double* %14, i32 2)
%16 = call double @fabs(i32 %15)
%17 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 2
store double %16, double* %17
%18 = load double*, double** %2
%19 = call i32 @d7bddist(double* %18, i32 3)
%20 = call double @fabs(i32 %19)
%21 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 3
store double %20, double* %21
%22 = load double*, double** %2
%23 = call i32 @d7bddist(double* %22, i32 4)
%24 = call double @fabs(i32 %23)
%25 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 4
store double %24, double* %25
%26 = load double*, double** %2
%27 = call i32 @d7bddist(double* %26, i32 5)
%28 = call double @fabs(i32 %27)
%29 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 5
store double %28, double* %29
%30 = load double*, double** %2
%31 = call i32 @d7bddist(double* %30, i32 6)
%32 = call double @fabs(i32 %31)
%33 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 6
store double %32, double* %33
%34 = load double*, double** %2
%35 = call i32 @d7bddist(double* %34, i32 7)
%36 = call double @fabs(i32 %35)
%37 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 7
store double %36, double* %37
%38 = load double*, double** %2
%39 = call i32 @d7bddist(double* %38, i32 8)
%40 = call double @fabs(i32 %39)
%41 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 8
store double %40, double* %41
%42 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 0
%43 = load double, double* %42
store double %43, double* %5
store i32 1, i32* %3
br label %44
44: ; preds = %63, %1
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 9
br i1 %46, label %47, label %66
47: ; preds = %44
%48 = load double, double* %5
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 %50
%52 = load double, double* %51
%53 = fcmp olt double %48, %52
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = load double, double* %5
br label %61
56: ; preds = %47
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 %58
%60 = load double, double* %59
br label %61
61: ; preds = %56, %54
%62 = phi double [ %55, %54 ], [ %60, %56 ]
store double %62, double* %5
br label %63
63: ; preds = %61
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1
store i32 %65, i32* %3
br label %44
66: ; preds = %44
%67 = load double, double* %5
ret double %67
}

LLVM IR (-O2):
define double @d7minbddist(double* %0) {
%2 = tail call i32 @d7bddist(double* %0, i32 0)
%3 = tail call double @fabs(i32 %2)
%4 = tail call i32 @d7bddist(double* %0, i32 1)
%5 = tail call double @fabs(i32 %4)
%6 = tail call i32 @d7bddist(double* %0, i32 2)
%7 = tail call double @fabs(i32 %6)
%8 = tail call i32 @d7bddist(double* %0, i32 3)
%9 = tail call double @fabs(i32 %8)
%10 = tail call i32 @d7bddist(double* %0, i32 4)
%11 = tail call double @fabs(i32 %10)
%12 = tail call i32 @d7bddist(double* %0, i32 5)
%13 = tail call double @fabs(i32 %12)
%14 = tail call i32 @d7bddist(double* %0, i32 6)
%15 = tail call double @fabs(i32 %14)
%16 = tail call i32 @d7bddist(double* %0, i32 7)
%17 = tail call double @fabs(i32 %16)
%18 = tail call i32 @d7bddist(double* %0, i32 8)
%19 = tail call double @fabs(i32 %18)
%20 = fcmp olt double %3, %5
%21 = select i1 %20, double %3, double %5
%22 = fcmp olt double %21, %7
%23 = select i1 %22, double %21, double %7
%24 = fcmp olt double %23, %9
%25 = select i1 %24, double %23, double %9
%26 = fcmp olt double %25, %11
%27 = select i1 %26, double %25, double %11
%28 = fcmp olt double %27, %13
%29 = select i1 %28, double %27, double %13
%30 = fcmp olt double %29, %15
%31 = select i1 %30, double %29, double %15
%32 = fcmp olt double %31, %17
%33 = select i1 %32, double %31, double %17
%34 = fcmp olt double %33, %19
%35 = select i1 %34, double %33, double %19
ret double %35
}