#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);
void swapIfGreater(double *a, double *b) {
  if (*a > *b) {
    double temp = *a;
    *a = *b;
    *b = temp;
    printf("Agter change: a = %.1lf and b = %.1lf\n", *a, *b);
  } else {
    printf("Nothing has change! - a = %.1lf and b = %.1lf\n", *a, *b);
  }
}


x86 assembly (clang, -O0):
<swapIfGreater>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1181 <swapIfGreater+0x71>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    119d <swapIfGreater+0x8d>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapIfGreater>:
movsd  (%rdi),%xmm2
movsd  (%rsi),%xmm1
ucomisd %xmm1,%xmm2
jbe    113a <swapIfGreater+0x2a>
movsd  %xmm1,(%rdi)
movsd  %xmm2,(%rsi)
movsd  (%rdi),%xmm0
lea    0xecf(%rip),%rdi
movapd %xmm2,%xmm1
jmp    1030 <printf@plt>
lea    0xee6(%rip),%rdi
movapd %xmm2,%xmm0
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Agter change: a = %.1lf and b = %.1lf\0A\00"
@.str.1 = [47 x i8] c"Nothing has change! - a = %.1lf and b = %.1lf\0A\00"
define void @swapIfGreater(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = load double, double* %8
%10 = fcmp ogt double %7, %9
br i1 %10, label %11, label %24
11: ; preds = %2
%12 = load double*, double** %3
%13 = load double, double* %12
store double %13, double* %5
%14 = load double*, double** %4
%15 = load double, double* %14
%16 = load double*, double** %3
store double %15, double* %16
%17 = load double, double* %5
%18 = load double*, double** %4
store double %17, double* %18
%19 = load double*, double** %3
%20 = load double, double* %19
%21 = load double*, double** %4
%22 = load double, double* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %20, double %22)
br label %30
24: ; preds = %2
%25 = load double*, double** %3
%26 = load double, double* %25
%27 = load double*, double** %4
%28 = load double, double* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), double %26, double %28)
br label %30
30: ; preds = %24, %11
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"Agter change: a = %.1lf and b = %.1lf\0A\00"
@.str.1 = [47 x i8] c"Nothing has change! - a = %.1lf and b = %.1lf\0A\00"
define void @swapIfGreater(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp ogt double %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
store double %4, double* %0
store double %3, double* %1
%7 = load double, double* %0
%8 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %7, double %3)
br label %11
9: ; preds = %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), double %3, double %4)
br label %11
11: ; preds = %9, %6
ret void
}