double reduce(double m[]) {
  int i;
  double min = 0;
  for (i = 0; i < 8; i++) {
    min = (m[i] < min) ? m[i] : min;
  }
  return min;
}


x86 assembly (clang, -O0):
<reduce>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1176 <reduce+0x76>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1154 <reduce+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    115e <reduce+0x5e>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <reduce+0x17>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<reduce>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
xorpd  %xmm2,%xmm2
minsd  %xmm2,%xmm0
minsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
minsd  %xmm1,%xmm0
movsd  0x18(%rdi),%xmm1
minsd  %xmm0,%xmm1
movsd  0x20(%rdi),%xmm0
minsd  %xmm1,%xmm0
movsd  0x28(%rdi),%xmm1
minsd  %xmm0,%xmm1
movsd  0x30(%rdi),%xmm2
minsd  %xmm1,%xmm2
movsd  0x38(%rdi),%xmm0
minsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @reduce(double* %0) {
%2 = alloca double*
%3 = alloca i32
%4 = alloca double
store double* %0, double** %2
store double 0.000000e+00, double* %4
store i32 0, i32* %3
br label %5
5: ; preds = %26, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %29
8: ; preds = %5
%9 = load double*, double** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds double, double* %9, i64 %11
%13 = load double, double* %12
%14 = load double, double* %4
%15 = fcmp olt double %13, %14
br i1 %15, label %16, label %22
16: ; preds = %8
%17 = load double*, double** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
br label %24
22: ; preds = %8
%23 = load double, double* %4
br label %24
24: ; preds = %22, %16
%25 = phi double [ %21, %16 ], [ %23, %22 ]
store double %25, double* %4
br label %26
26: ; preds = %24
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %5
29: ; preds = %5
%30 = load double, double* %4
ret double %30
}

LLVM IR (-O2):
define double @reduce(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp olt double %2, 0.000000e+00
%4 = select i1 %3, double %2, double 0.000000e+00
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = fcmp olt double %6, %4
%8 = select i1 %7, double %6, double %4
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = fcmp olt double %10, %8
%12 = select i1 %11, double %10, double %8
%13 = getelementptr inbounds double, double* %0, i64 3
%14 = load double, double* %13
%15 = fcmp olt double %14, %12
%16 = select i1 %15, double %14, double %12
%17 = getelementptr inbounds double, double* %0, i64 4
%18 = load double, double* %17
%19 = fcmp olt double %18, %16
%20 = select i1 %19, double %18, double %16
%21 = getelementptr inbounds double, double* %0, i64 5
%22 = load double, double* %21
%23 = fcmp olt double %22, %20
%24 = select i1 %23, double %22, double %20
%25 = getelementptr inbounds double, double* %0, i64 6
%26 = load double, double* %25
%27 = fcmp olt double %26, %24
%28 = select i1 %27, double %26, double %24
%29 = getelementptr inbounds double, double* %0, i64 7
%30 = load double, double* %29
%31 = fcmp olt double %30, %28
%32 = select i1 %31, double %30, double %28
ret double %32
}