#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 *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double first, second, third;
  printf("Please enter 3 numbers seperated by spaces > ");
  scanf("%lf", &first);
  scanf("%lf", &second);
  scanf("%lf", &third);
  if ((first > second && first < third) || (first < second && first > third))
    printf("%.0lf is the median\n", first);
  if ((second > first && second < third) || (second < first && second > third))
    printf("%.0lf is the median\n", second);
  if ((third > first && third < second) || (third < first && third > second))
    printf("%.0lf is the median\n", third);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeda(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeca(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1191 <main+0x71>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     11b5 <main+0x95>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c8 <main+0xa8>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11c8 <main+0xa8>
movsd  -0x10(%rbp),%xmm0
lea    0xe71(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11ec <main+0xcc>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     1210 <main+0xf0>
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1223 <main+0x103>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1223 <main+0x103>
movsd  -0x18(%rbp),%xmm0
lea    0xe16(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1247 <main+0x127>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     126b <main+0x14b>
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    127e <main+0x15e>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    127e <main+0x15e>
movsd  -0x20(%rbp),%xmm0
lea    0xdbb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rbx
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm2
movsd  0x8(%rsp),%xmm0
jbe    117f <main+0x5f>
ucomisd %xmm2,%xmm0
ja     118b <main+0x6b>
ucomisd %xmm2,%xmm1
jbe    11af <main+0x8f>
ucomisd %xmm0,%xmm2
jbe    11af <main+0x8f>
lea    0xea0(%rip),%rdi
movapd %xmm2,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x8(%rsp),%xmm0
ucomisd %xmm2,%xmm1
jbe    11bb <main+0x9b>
ucomisd %xmm1,%xmm0
ja     11c7 <main+0xa7>
ucomisd %xmm1,%xmm2
jbe    11eb <main+0xcb>
ucomisd %xmm0,%xmm1
jbe    11eb <main+0xcb>
lea    0xe64(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
ucomisd %xmm2,%xmm0
jbe    11f7 <main+0xd7>
ucomisd %xmm0,%xmm1
ja     1203 <main+0xe3>
ucomisd %xmm0,%xmm2
jbe    1211 <main+0xf1>
ucomisd %xmm1,%xmm0
jbe    1211 <main+0xf1>
lea    0xe28(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Please enter 3 numbers seperated by spaces > \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [21 x i8] c"%.0lf is the median\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%9 = load double, double* %2
%10 = load double, double* %3
%11 = fcmp ogt double %9, %10
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load double, double* %2
%14 = load double, double* %4
%15 = fcmp olt double %13, %14
br i1 %15, label %24, label %16
16: ; preds = %12, %0
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fcmp olt double %17, %18
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load double, double* %2
%22 = load double, double* %4
%23 = fcmp ogt double %21, %22
br i1 %23, label %24, label %27
24: ; preds = %20, %12
%25 = load double, double* %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %25)
br label %27
27: ; preds = %24, %20, %16
%28 = load double, double* %3
%29 = load double, double* %2
%30 = fcmp ogt double %28, %29
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = load double, double* %3
%33 = load double, double* %4
%34 = fcmp olt double %32, %33
br i1 %34, label %43, label %35
35: ; preds = %31, %27
%36 = load double, double* %3
%37 = load double, double* %2
%38 = fcmp olt double %36, %37
br i1 %38, label %39, label %46
39: ; preds = %35
%40 = load double, double* %3
%41 = load double, double* %4
%42 = fcmp ogt double %40, %41
br i1 %42, label %43, label %46
43: ; preds = %39, %31
%44 = load double, double* %3
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %44)
br label %46
46: ; preds = %43, %39, %35
%47 = load double, double* %4
%48 = load double, double* %2
%49 = fcmp ogt double %47, %48
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = load double, double* %4
%52 = load double, double* %3
%53 = fcmp olt double %51, %52
br i1 %53, label %62, label %54
54: ; preds = %50, %46
%55 = load double, double* %4
%56 = load double, double* %2
%57 = fcmp olt double %55, %56
br i1 %57, label %58, label %65
58: ; preds = %54
%59 = load double, double* %4
%60 = load double, double* %3
%61 = fcmp ogt double %59, %60
br i1 %61, label %62, label %65
62: ; preds = %58, %50
%63 = load double, double* %4
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %63)
br label %65
65: ; preds = %62, %58, %54
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"Please enter 3 numbers seperated by spaces > \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [21 x i8] c"%.0lf is the median\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%11 = load double, double* %1
%12 = load double, double* %2
%13 = fcmp ogt double %11, %12
%14 = load double, double* %3
%15 = fcmp olt double %11, %14
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %21, label %17
17: ; preds = %0
%18 = fcmp olt double %11, %12
%19 = fcmp ogt double %11, %14
%20 = select i1 %18, i1 %19, i1 false
br i1 %20, label %21, label %26
21: ; preds = %17, %0
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %11)
%23 = load double, double* %2
%24 = load double, double* %1
%25 = load double, double* %3
br label %26
26: ; preds = %21, %17
%27 = phi double [ %25, %21 ], [ %14, %17 ]
%28 = phi double [ %24, %21 ], [ %11, %17 ]
%29 = phi double [ %23, %21 ], [ %12, %17 ]
%30 = fcmp ogt double %29, %28
%31 = fcmp olt double %29, %27
%32 = select i1 %30, i1 %31, i1 false
br i1 %32, label %37, label %33
33: ; preds = %26
%34 = fcmp olt double %29, %28
%35 = fcmp ogt double %29, %27
%36 = select i1 %34, i1 %35, i1 false
br i1 %36, label %37, label %42
37: ; preds = %33, %26
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %29)
%39 = load double, double* %3
%40 = load double, double* %1
%41 = load double, double* %2
br label %42
42: ; preds = %37, %33
%43 = phi double [ %41, %37 ], [ %29, %33 ]
%44 = phi double [ %40, %37 ], [ %28, %33 ]
%45 = phi double [ %39, %37 ], [ %27, %33 ]
%46 = fcmp ogt double %45, %44
%47 = fcmp olt double %45, %43
%48 = select i1 %46, i1 %47, i1 false
br i1 %48, label %53, label %49
49: ; preds = %42
%50 = fcmp olt double %45, %44
%51 = fcmp ogt double %45, %43
%52 = select i1 %50, i1 %51, i1 false
br i1 %52, label %53, label %55
53: ; preds = %49, %42
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %45)
br label %55
55: ; preds = %53, %49
ret i32 0
}