unsigned geom_imin4d(const double v[4]) {
  unsigned i = 0;
  if (v[1] < v[i]) {
    i = 1;
  }
  if (v[2] < v[i]) {
    i = 2;
  }
  if (v[3] < v[i]) {
    i = 3;
  }
  return i;
}


x86 assembly (clang, -O0):
<geom_imin4d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1135 <geom_imin4d+0x35>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    115b <geom_imin4d+0x5b>
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1181 <geom_imin4d+0x81>
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_imin4d>:
movsd  (%rdi),%xmm0
xor    %eax,%eax
ucomisd 0x8(%rdi),%xmm0
seta   %al
movsd  (%rdi,%rax,8),%xmm0
ucomisd 0x10(%rdi),%xmm0
mov    $0x2,%ecx
cmovbe %eax,%ecx
movsd  (%rdi,%rcx,8),%xmm0
ucomisd 0x18(%rdi),%xmm0
mov    $0x3,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @geom_imin4d(double* %0) {
%2 = alloca double*
%3 = alloca i32
store double* %0, double** %2
store i32 0, i32* %3
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 1
%6 = load double, double* %5
%7 = load double*, double** %2
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds double, double* %7, i64 %9
%11 = load double, double* %10
%12 = fcmp olt double %6, %11
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 1, i32* %3
br label %14
14: ; preds = %13, %1
%15 = load double*, double** %2
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
%18 = load double*, double** %2
%19 = load i32, i32* %3
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = fcmp olt double %17, %22
br i1 %23, label %24, label %25
24: ; preds = %14
store i32 2, i32* %3
br label %25
25: ; preds = %24, %14
%26 = load double*, double** %2
%27 = getelementptr inbounds double, double* %26, i64 3
%28 = load double, double* %27
%29 = load double*, double** %2
%30 = load i32, i32* %3
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = fcmp olt double %28, %33
br i1 %34, label %35, label %36
35: ; preds = %25
store i32 3, i32* %3
br label %36
36: ; preds = %35, %25
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @geom_imin4d(double* nocapture %0) {
%2 = getelementptr inbounds double, double* %0, i64 1
%3 = load double, double* %2
%4 = load double, double* %0
%5 = fcmp olt double %3, %4
%6 = zext i1 %5 to i32
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = zext i1 %5 to i64
%10 = getelementptr inbounds double, double* %0, i64 %9
%11 = load double, double* %10
%12 = fcmp olt double %8, %11
%13 = select i1 %12, i32 2, i32 %6
%14 = getelementptr inbounds double, double* %0, i64 3
%15 = load double, double* %14
%16 = zext i32 %13 to i64
%17 = getelementptr inbounds double, double* %0, i64 %16
%18 = load double, double* %17
%19 = fcmp olt double %15, %18
%20 = select i1 %19, i32 3, i32 %13
ret i32 %20
}