double min1(double a, double b) {
  if (a >= 1 && b >= 1) {
    return 0;
  } else if (a <= 1 && a <= b) {
    return a;
  } else if (b <= 1 && b <= a) {
    return b;
  }
}


x86 assembly (clang, -O0):
<min1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xee5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1149 <min1+0x49>
movsd  -0x18(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1149 <min1+0x49>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11bf <min1+0xbf>
movsd  0xeaf(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     117f <min1+0x7f>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     117f <min1+0x7f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11bf <min1+0xbf>
movsd  0xe79(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11b5 <min1+0xb5>
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11b5 <min1+0xb5>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11bf <min1+0xbf>
jmp    11ba <min1+0xba>
jmp    11bf <min1+0xbf>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min1>:
movapd %xmm0,%xmm3
cmpnlesd %xmm1,%xmm3
movapd %xmm3,%xmm2
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm3
orpd   %xmm2,%xmm3
movsd  0xedf(%rip),%xmm2
movapd %xmm2,%xmm4
cmplesd %xmm0,%xmm4
cmpnlesd %xmm2,%xmm0
movapd %xmm0,%xmm5
andnpd %xmm3,%xmm5
andpd  %xmm1,%xmm0
orpd   %xmm5,%xmm0
cmplesd %xmm1,%xmm2
andnpd %xmm0,%xmm2
andpd  %xmm4,%xmm2
andnpd %xmm0,%xmm4
orpd   %xmm4,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @min1(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = fcmp oge double %6, 1.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load double, double* %5
%10 = fcmp oge double %9, 1.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store double 0.000000e+00, double* %3
br label %32
12: ; preds = %8, %2
%13 = load double, double* %4
%14 = fcmp ole double %13, 1.000000e+00
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load double, double* %4
%17 = load double, double* %5
%18 = fcmp ole double %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load double, double* %4
store double %20, double* %3
br label %32
21: ; preds = %15, %12
%22 = load double, double* %5
%23 = fcmp ole double %22, 1.000000e+00
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load double, double* %5
%26 = load double, double* %4
%27 = fcmp ole double %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load double, double* %5
store double %29, double* %3
br label %32
30: ; preds = %24, %21
br label %31
31: ; preds = %30
br label %32
32: ; preds = %11, %19, %28, %31
%33 = load double, double* %3
ret double %33
}

LLVM IR (-O2):
define double @min1(double %0, double %1) {
%3 = fcmp oge double %0, 1.000000e+00
%4 = fcmp oge double %1, 1.000000e+00
%5 = and i1 %3, %4
%6 = fcmp ugt double %0, 1.000000e+00
%7 = fcmp ugt double %0, %1
%8 = or i1 %6, %7
%9 = select i1 %8, double %1, double %0
%10 = select i1 %5, double 0.000000e+00, double %9
ret double %10
}