void points_to_range(double p[2][3], double xr[2], double yr[2]) {
  if (p[0][0] <= p[1][0]) {
    xr[0] = p[0][0];
    xr[1] = p[1][0];
  } else {
    xr[0] = p[1][0];
    xr[1] = p[0][0];
  }
  if (p[0][1] <= p[1][1]) {
    yr[0] = p[0][1];
    yr[1] = p[1][1];
  } else {
    yr[0] = p[1][1];
    yr[1] = p[0][1];
  }
}


x86 assembly (clang, -O0):
<points_to_range>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1152 <points_to_range+0x52>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    1174 <points_to_range+0x74>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     11b8 <points_to_range+0xb8>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    11db <points_to_range+0xdb>
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<points_to_range>:
lea    0x18(%rdi),%rax
movsd  (%rdi),%xmm0
movsd  0x18(%rdi),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm0,%xmm2
cmpnlesd %xmm1,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movlpd %xmm2,(%rsi)
cmovb  %rdi,%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x8(%rsi)
lea    0x8(%rdi),%rax
lea    0x20(%rdi),%rcx
movsd  0x8(%rdi),%xmm0
movsd  0x20(%rdi),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm0,%xmm2
cmpnlesd %xmm1,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movlpd %xmm2,(%rdx)
cmovb  %rax,%rcx
movsd  (%rcx),%xmm0
movsd  %xmm0,0x8(%rdx)
ret

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

LLVM IR (-O2):
define void @points_to_range([3 x double]* nocapture %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%5 = load double, double* %4
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%7 = load double, double* %6
%8 = fcmp ugt double %5, %7
%9 = select i1 %8, double %7, double %5
store double %9, double* %1
%10 = load double, double* %4
%11 = load double, double* %6
%12 = select i1 %8, double %10, double %11
%13 = getelementptr inbounds double, double* %1, i64 1
store double %12, double* %13
%14 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%15 = load double, double* %14
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%17 = load double, double* %16
%18 = fcmp ugt double %15, %17
%19 = select i1 %18, double %17, double %15
store double %19, double* %2
%20 = load double, double* %14
%21 = load double, double* %16
%22 = select i1 %18, double %20, double %21
%23 = getelementptr inbounds double, double* %2, i64 1
store double %22, double* %23
ret void
}