#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 *, int *, int *, int *);
int main() {
  int a, b, c, median;
  printf("Please enter 3 numbers separated by spaces > ");
  scanf("%d%d%d", &a, &b, &c);
  if ((b >= a && a >= c) || (c >= a && a >= b))
    printf("%d is the median\n", a);
  else if ((a >= b && b >= c) || (a <= b && b <= c))
    printf("%d is the median\n", b);
  else if ((a >= c && c >= b) || (a <= c && c <= b))
    printf("%d is the median\n", c);
  else
    return 1;
  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    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     116d <main+0x4d>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1185 <main+0x65>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     119b <main+0x7b>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     119b <main+0x7b>
mov    -0x8(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x11d>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11b3 <main+0x93>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11cb <main+0xab>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11e1 <main+0xc1>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11e1 <main+0xc1>
mov    -0xc(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1238 <main+0x118>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     11f9 <main+0xd9>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1211 <main+0xf1>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1227 <main+0x107>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1227 <main+0x107>
mov    -0x10(%rbp),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1233 <main+0x113>
movl   $0x1,-0x4(%rbp)
jmp    1244 <main+0x124>
jmp    1238 <main+0x118>
jmp    123d <main+0x11d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    0xc(%rsp),%ecx
mov    0x4(%rsp),%esi
cmp    %ecx,%eax
jl     1162 <main+0x42>
cmp    %esi,%ecx
jge    116a <main+0x4a>
cmp    %ecx,%esi
jl     1184 <main+0x64>
cmp    %eax,%ecx
jl     1184 <main+0x64>
mov    %ecx,%esi
lea    0xec2(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
cmp    %eax,%ecx
jl     118c <main+0x6c>
cmp    %esi,%eax
jge    1194 <main+0x74>
cmp    %ecx,%eax
jl     1198 <main+0x78>
cmp    %esi,%eax
jg     1198 <main+0x78>
mov    %eax,%esi
jmp    116c <main+0x4c>
cmp    %esi,%ecx
jl     11a0 <main+0x80>
cmp    %esi,%eax
jle    116c <main+0x4c>
mov    $0x1,%ebx
cmp    %ecx,%esi
jl     117c <main+0x5c>
cmp    %esi,%eax
jge    116c <main+0x4c>
jmp    117c <main+0x5c>

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

LLVM IR (-O2):
@.str = [46 x i8] c"Please enter 3 numbers separated by spaces > \00"
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [18 x i8] c"%d is the median\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %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 ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %1
%11 = icmp slt i32 %9, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %10, %12
%14 = select i1 %11, i1 true, i1 %13
br i1 %14, label %15, label %29
15: ; preds = %0
%16 = icmp slt i32 %12, %10
%17 = icmp slt i32 %10, %9
%18 = select i1 %16, i1 true, i1 %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = icmp slt i32 %9, %12
%21 = select i1 %17, i1 true, i1 %20
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = icmp sgt i32 %9, %12
%24 = select i1 %11, i1 true, i1 %23
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = select i1 %13, i1 true, i1 %23
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = select i1 %16, i1 true, i1 %20
br i1 %28, label %32, label %29
29: ; preds = %25, %27, %19, %22, %0, %15
%30 = phi i32 [ %10, %15 ], [ %10, %0 ], [ %9, %22 ], [ %9, %19 ], [ %12, %27 ], [ %12, %25 ]
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %27
%33 = phi i32 [ 1, %27 ], [ 0, %29 ]
ret i32 %33
}