int i_min(a1, a2, a3, a4, a5, a6, a7, a8, a9)
double a1, a2, a3, a4, a5, a6, a7, a8, a9;
{
  int ii;
  double dmin;
  if (a2 < a1) {
    dmin = a2;
    ii = 2;
  } else {
    dmin = a1;
    ii = 1;
  }
  if (a3 < dmin) {
    dmin = a3;
    ii = 3;
  }
  if (a4 < dmin) {
    dmin = a4;
    ii = 4;
  }
  if (a5 < dmin) {
    dmin = a5;
    ii = 5;
  }
  if (a6 < dmin) {
    dmin = a6;
    ii = 6;
  }
  if (a7 < dmin) {
    dmin = a7;
    ii = 7;
  }
  if (a8 < dmin) {
    dmin = a8;
    ii = 8;
  }
  if (a9 < dmin) {
    dmin = a9;
    ii = 9;
  }
  return ii;
}


x86 assembly (clang, -O0):
<i_min>:
push   %rbp
mov    %rsp,%rbp
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    115c <i_min+0x5c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x2,-0x44(%rbp)
jmp    116d <i_min+0x6d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x44(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1192 <i_min+0x92>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x3,-0x44(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b7 <i_min+0xb7>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x4,-0x44(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11dc <i_min+0xdc>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x5,-0x44(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1201 <i_min+0x101>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x6,-0x44(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1226 <i_min+0x126>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x7,-0x44(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    124b <i_min+0x14b>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x8,-0x44(%rbp)
movsd  0x10(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1270 <i_min+0x170>
movsd  0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x9,-0x44(%rbp)
mov    -0x44(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_min>:
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
add    $0x1,%eax
minsd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
mov    $0x3,%ecx
cmovbe %eax,%ecx
minsd  %xmm1,%xmm2
ucomisd %xmm3,%xmm2
mov    $0x4,%eax
cmovbe %ecx,%eax
minsd  %xmm2,%xmm3
ucomisd %xmm4,%xmm3
mov    $0x5,%ecx
cmovbe %eax,%ecx
minsd  %xmm3,%xmm4
ucomisd %xmm5,%xmm4
mov    $0x6,%eax
cmovbe %ecx,%eax
minsd  %xmm4,%xmm5
ucomisd %xmm6,%xmm5
mov    $0x7,%ecx
cmovbe %eax,%ecx
minsd  %xmm5,%xmm6
ucomisd %xmm7,%xmm6
mov    $0x8,%edx
cmovbe %ecx,%edx
minsd  %xmm6,%xmm7
ucomisd 0x8(%rsp),%xmm7
mov    $0x9,%eax
cmovbe %edx,%eax
ret

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

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