#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double, double);
int /*<<< orphan*/ swap(double *, double *);
void sort(double *a, double *b, double *c) {
  if (*a < *b)
    swap(a, b);
  if (*b < *c)
    swap(b, c);
  if (*a < *b)
    swap(a, b);
  printf("%f, %f, %f\n", *a, *b, *c);
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    115b <sort+0x3b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <swap@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1182 <sort+0x62>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <swap@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a9 <sort+0x89>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <swap@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movsd  (%rsi),%xmm1
ucomisd (%rdi),%xmm1
jbe    1147 <sort+0x27>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <swap@plt>
movsd  (%rbx),%xmm1
movsd  (%r14),%xmm0
ucomisd %xmm1,%xmm0
jbe    1161 <sort+0x41>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
movsd  (%rbx),%xmm1
movsd  (%r15),%xmm0
ucomisd %xmm0,%xmm1
jbe    1180 <sort+0x60>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <swap@plt>
movsd  (%r15),%xmm0
movsd  (%rbx),%xmm1
movsd  (%r14),%xmm2
lea    0xe74(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%f, %f, %f\0A\00"
define void @sort(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = load double*, double** %5
%10 = load double, double* %9
%11 = fcmp olt double %8, %10
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load double*, double** %4
%14 = load double*, double** %5
%15 = call i32 @swap(double* %13, double* %14)
br label %16
16: ; preds = %12, %3
%17 = load double*, double** %5
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = load double, double* %19
%21 = fcmp olt double %18, %20
br i1 %21, label %22, label %26
22: ; preds = %16
%23 = load double*, double** %5
%24 = load double*, double** %6
%25 = call i32 @swap(double* %23, double* %24)
br label %26
26: ; preds = %22, %16
%27 = load double*, double** %4
%28 = load double, double* %27
%29 = load double*, double** %5
%30 = load double, double* %29
%31 = fcmp olt double %28, %30
br i1 %31, label %32, label %36
32: ; preds = %26
%33 = load double*, double** %4
%34 = load double*, double** %5
%35 = call i32 @swap(double* %33, double* %34)
br label %36
36: ; preds = %32, %26
%37 = load double*, double** %4
%38 = load double, double* %37
%39 = load double*, double** %5
%40 = load double, double* %39
%41 = load double*, double** %6
%42 = load double, double* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %38, double %40, double %42)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%f, %f, %f\0A\00"
define void @sort(double* %0, double* %1, double* %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fcmp olt double %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 @swap(double* %0, double* %1)
%9 = load double, double* %1
br label %10
10: ; preds = %7, %3
%11 = phi double [ %9, %7 ], [ %5, %3 ]
%12 = load double, double* %2
%13 = fcmp olt double %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = tail call i32 @swap(double* %1, double* %2)
%16 = load double, double* %1
br label %17
17: ; preds = %14, %10
%18 = phi double [ %16, %14 ], [ %11, %10 ]
%19 = load double, double* %0
%20 = fcmp olt double %19, %18
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = tail call i32 @swap(double* %0, double* %1)
%23 = load double, double* %0
%24 = load double, double* %1
br label %25
25: ; preds = %21, %17
%26 = phi double [ %24, %21 ], [ %18, %17 ]
%27 = phi double [ %23, %21 ], [ %19, %17 ]
%28 = load double, double* %2
%29 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %27, double %26, double %28)
ret void
}