#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;
  printf("Please enter 3 numbers separated by spaces  > ");
  scanf("%d%d%d", &a, &b, &c);
  if ((a < c) && (a > b))
    printf("%d is the median\n", a);
  else if ((a < b) && (a > c))
    printf("%d is the median\n", a);
  if ((b < a) && (b > c))
    printf("%d is the median\n", b);
  else if ((b > a) && (b < c))
    printf("%d is the median\n", b);
  if ((c > a) && (c < b))
    printf("%d is the median\n", c);
  else if ((c < a) && (c > b))
    printf("%d is the median\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1183 <main+0x63>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1183 <main+0x63>
mov    -0x8(%rbp),%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ac <main+0x8c>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11ac <main+0x8c>
mov    -0x8(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <main+0x91>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11df <main+0xbf>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11df <main+0xbf>
mov    -0xc(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120d <main+0xed>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1208 <main+0xe8>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1208 <main+0xe8>
mov    -0xc(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120d <main+0xed>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    123b <main+0x11b>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    123b <main+0x11b>
mov    -0x10(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1269 <main+0x149>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1264 <main+0x144>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1264 <main+0x144>
mov    -0x10(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1269 <main+0x149>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0xc(%rsp),%eax
mov    0x10(%rsp),%ecx
cmp    %eax,%esi
jge    1161 <main+0x41>
cmp    %ecx,%esi
jg     1169 <main+0x49>
cmp    %ecx,%esi
jge    1177 <main+0x57>
cmp    %eax,%esi
jle    1177 <main+0x57>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%ecx
mov    0xc(%rsp),%eax
cmp    %ecx,%esi
jge    118b <main+0x6b>
cmp    %eax,%esi
jg     1193 <main+0x73>
cmp    %ecx,%esi
jle    11a1 <main+0x81>
cmp    %eax,%esi
jge    11a1 <main+0x81>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%eax
cmp    %ecx,%esi
jle    11b5 <main+0x95>
cmp    %eax,%esi
jl     11bd <main+0x9d>
cmp    %ecx,%esi
jge    11cb <main+0xab>
cmp    %eax,%esi
jle    11cb <main+0xab>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [47 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
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %2
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %29
17: ; preds = %10, %0
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %21, %17
br label %29
29: ; preds = %28, %14
%30 = load i32, i32* %3
%31 = load i32, i32* %2
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* %3
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %52
40: ; preds = %33, %29
%41 = load i32, i32* %3
%42 = load i32, i32* %2
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %51
44: ; preds = %40
%45 = load i32, i32* %3
%46 = load i32, i32* %4
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = load i32, i32* %3
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48, %44, %40
br label %52
52: ; preds = %51, %37
%53 = load i32, i32* %4
%54 = load i32, i32* %2
%55 = icmp sgt i32 %53, %54
br i1 %55, label %56, label %63
56: ; preds = %52
%57 = load i32, i32* %4
%58 = load i32, i32* %3
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = load i32, i32* %4
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %61)
br label %75
63: ; preds = %56, %52
%64 = load i32, i32* %4
%65 = load i32, i32* %2
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %74
67: ; preds = %63
%68 = load i32, i32* %4
%69 = load i32, i32* %3
%70 = icmp sgt i32 %68, %69
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = load i32, i32* %4
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %72)
br label %74
74: ; preds = %71, %67, %63
br label %75
75: ; preds = %74, %60
ret i32 0
}

LLVM IR (-O2):
@.str = [47 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 ([47 x i8], [47 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* %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
%12 = load i32, i32* %2
%13 = icmp sgt i32 %9, %12
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %19, label %15
15: ; preds = %0
%16 = icmp slt i32 %9, %12
%17 = icmp sgt i32 %9, %10
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %19, label %21
19: ; preds = %15, %0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* %2
%23 = load i32, i32* %1
%24 = icmp slt i32 %22, %23
%25 = load i32, i32* %3
%26 = icmp sgt i32 %22, %25
%27 = select i1 %24, i1 %26, i1 false
br i1 %27, label %32, label %28
28: ; preds = %21
%29 = icmp sgt i32 %22, %23
%30 = icmp slt i32 %22, %25
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %32, label %34
32: ; preds = %28, %21
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %34
34: ; preds = %32, %28
%35 = load i32, i32* %3
%36 = load i32, i32* %1
%37 = icmp sgt i32 %35, %36
%38 = load i32, i32* %2
%39 = icmp slt i32 %35, %38
%40 = select i1 %37, i1 %39, i1 false
br i1 %40, label %45, label %41
41: ; preds = %34
%42 = icmp slt i32 %35, %36
%43 = icmp sgt i32 %35, %38
%44 = select i1 %42, i1 %43, i1 false
br i1 %44, label %45, label %47
45: ; preds = %41, %34
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %47
47: ; preds = %45, %41
ret i32 0
}