void sort(double *a, double *b, double *c) {
  double temp[3], exch;
  int i, j;
  temp[0] = *a;
  temp[1] = *b;
  temp[2] = *c;
  for (i = 1; i >= 0; i--)
    for (j = 0; j <= i; j++)
      if (temp[j] > temp[j + 1]) {
        exch = temp[j];
        temp[j] = temp[j + 1];
        temp[j + 1] = exch;
      }
  *a = temp[0];
  *b = temp[1];
  *c = temp[2];
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jl     11d9 <sort+0xd9>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     11c6 <sort+0xc6>
movslq -0x40(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mov    -0x40(%rbp),%eax
add    $0x1,%eax
cltq
ucomisd -0x30(%rbp,%rax,8),%xmm0
jbe    11b3 <sort+0xb3>
movslq -0x40(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
cltq
movsd  -0x30(%rbp,%rax,8),%xmm0
movslq -0x40(%rbp),%rax
movsd  %xmm0,-0x30(%rbp,%rax,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x40(%rbp),%eax
add    $0x1,%eax
cltq
movsd  %xmm0,-0x30(%rbp,%rax,8)
jmp    11b8 <sort+0xb8>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    114f <sort+0x4f>
jmp    11cb <sort+0xcb>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    113e <sort+0x3e>
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movsd  (%rdx),%xmm2
movapd %xmm1,%xmm3
minsd  %xmm0,%xmm3
maxsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
maxsd  %xmm2,%xmm1
minsd  %xmm0,%xmm2
movapd %xmm3,%xmm0
maxsd  %xmm2,%xmm0
minsd  %xmm3,%xmm2
movsd  %xmm2,(%rdi)
movsd  %xmm0,(%rsi)
movsd  %xmm1,(%rdx)
ret

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

LLVM IR (-O2):
define void @sort(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = load double, double* %2
%7 = fcmp ogt double %4, %5
%8 = select i1 %7, double %5, double %4
%9 = select i1 %7, double %4, double %5
%10 = fcmp ogt double %9, %6
%11 = select i1 %10, double %9, double %6
%12 = select i1 %10, double %6, double %9
%13 = fcmp ogt double %8, %12
%14 = select i1 %13, double %8, double %12
%15 = select i1 %13, double %12, double %8
store double %15, double* %0
store double %14, double* %1
store double %11, double* %2
ret void
}