#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(void) {
  int A, B, C;
  printf("Please enter 3 numbers separated by spaces > ");
  scanf("%d%d%d", &A, &B, &C);
  if (A == B && A == C)
    printf("%d is the median\n", A);
  else if (A > B && A < C)
    printf("%d is the median\n", A);
  else if (A > C && A < B)
    printf("%d is the median\n", A);
  else if (B > C && B < A)
    printf("%d is the median\n", B);
  else if (B > A && B < C)
    printf("%d is the median\n", B);
  else if (C > A && C < B)
    printf("%d is the median\n", C);
  else if (C > B && C < A)
    printf("%d is the median\n", C);
  else if (A == B)
    printf("%d is the median\n", B);
  else if (A == C)
    printf("%d is the median\n", C);
  else if (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    0xeea(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1183 <main+0x63>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1183 <main+0x63>
mov    -0x8(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1325 <main+0x205>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b1 <main+0x91>
mov    -0x8(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1320 <main+0x200>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11df <main+0xbf>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11df <main+0xbf>
mov    -0x8(%rbp),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    131b <main+0x1fb>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    120d <main+0xed>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120d <main+0xed>
mov    -0xc(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1316 <main+0x1f6>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    123b <main+0x11b>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    123b <main+0x11b>
mov    -0xc(%rbp),%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1311 <main+0x1f1>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1269 <main+0x149>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1269 <main+0x149>
mov    -0x10(%rbp),%esi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130c <main+0x1ec>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1297 <main+0x177>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1297 <main+0x177>
mov    -0x10(%rbp),%esi
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1307 <main+0x1e7>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    12b9 <main+0x199>
mov    -0xc(%rbp),%esi
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1302 <main+0x1e2>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    12db <main+0x1bb>
mov    -0x10(%rbp),%esi
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12fd <main+0x1dd>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    12f8 <main+0x1d8>
mov    -0x10(%rbp),%esi
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12fd <main+0x1dd>
jmp    1302 <main+0x1e2>
jmp    1307 <main+0x1e7>
jmp    130c <main+0x1ec>
jmp    1311 <main+0x1f1>
jmp    1316 <main+0x1f6>
jmp    131b <main+0x1fb>
jmp    1320 <main+0x200>
jmp    1325 <main+0x205>
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    0xef5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ecx
cmp    %eax,%edx
jne    1161 <main+0x41>
cmp    %ecx,%edx
je     1171 <main+0x51>
cmp    %eax,%edx
jle    1169 <main+0x49>
cmp    %ecx,%edx
jl     1171 <main+0x51>
cmp    %ecx,%edx
jle    1188 <main+0x68>
cmp    %eax,%edx
jge    1188 <main+0x68>
mov    %edx,%esi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
cmp    %ecx,%eax
jle    1190 <main+0x70>
cmp    %eax,%edx
jg     1198 <main+0x78>
cmp    %eax,%edx
jge    119c <main+0x7c>
cmp    %ecx,%eax
jge    119c <main+0x7c>
mov    %eax,%esi
jmp    1173 <main+0x53>
cmp    %ecx,%edx
jge    11a8 <main+0x88>
cmp    %ecx,%eax
jle    11a8 <main+0x88>
mov    %ecx,%esi
jmp    1173 <main+0x53>
cmp    %ecx,%eax
setl   %dil
cmp    %ecx,%edx
setg   %r8b
mov    %edx,%esi
test   %r8b,%dil
cmovne %ecx,%esi
jne    1173 <main+0x53>
cmp    %eax,%edx
je     1173 <main+0x53>
cmp    %ecx,%edx
je     1173 <main+0x53>
mov    %eax,%esi
cmp    %eax,%ecx
jne    1181 <main+0x61>
jmp    1173 <main+0x53>

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
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 ([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* %3
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %0
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = icmp eq 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 %113
17: ; preds = %10, %0
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = icmp sgt 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 slt 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 %112
28: ; preds = %21, %17
%29 = load i32, i32* %2
%30 = load i32, i32* %4
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %39
32: ; preds = %28
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i32, i32* %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %37)
br label %111
39: ; preds = %32, %28
%40 = load i32, i32* %3
%41 = load i32, i32* %4
%42 = icmp sgt i32 %40, %41
br i1 %42, label %43, label %50
43: ; preds = %39
%44 = load i32, i32* %3
%45 = load i32, i32* %2
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i32, i32* %3
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %48)
br label %110
50: ; preds = %43, %39
%51 = load i32, i32* %3
%52 = load i32, i32* %2
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %61
54: ; preds = %50
%55 = load i32, i32* %3
%56 = load i32, i32* %4
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* %3
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %59)
br label %109
61: ; preds = %54, %50
%62 = load i32, i32* %4
%63 = load i32, i32* %2
%64 = icmp sgt i32 %62, %63
br i1 %64, label %65, label %72
65: ; preds = %61
%66 = load i32, i32* %4
%67 = load i32, i32* %3
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = load i32, i32* %4
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %70)
br label %108
72: ; preds = %65, %61
%73 = load i32, i32* %4
%74 = load i32, i32* %3
%75 = icmp sgt i32 %73, %74
br i1 %75, label %76, label %83
76: ; preds = %72
%77 = load i32, i32* %4
%78 = load i32, i32* %2
%79 = icmp slt i32 %77, %78
br i1 %79, label %80, label %83
80: ; preds = %76
%81 = load i32, i32* %4
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %81)
br label %107
83: ; preds = %76, %72
%84 = load i32, i32* %2
%85 = load i32, i32* %3
%86 = icmp eq i32 %84, %85
br i1 %86, label %87, label %90
87: ; preds = %83
%88 = load i32, i32* %3
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %88)
br label %106
90: ; preds = %83
%91 = load i32, i32* %2
%92 = load i32, i32* %4
%93 = icmp eq i32 %91, %92
br i1 %93, label %94, label %97
94: ; preds = %90
%95 = load i32, i32* %4
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %95)
br label %105
97: ; preds = %90
%98 = load i32, i32* %4
%99 = load i32, i32* %3
%100 = icmp eq i32 %98, %99
br i1 %100, label %101, label %104
101: ; preds = %97
%102 = load i32, i32* %4
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %102)
br label %104
104: ; preds = %101, %97
br label %105
105: ; preds = %104, %94
br label %106
106: ; preds = %105, %87
br label %107
107: ; preds = %106, %80
br label %108
108: ; preds = %107, %69
br label %109
109: ; preds = %108, %58
br label %110
110: ; preds = %109, %47
br label %111
111: ; preds = %110, %36
br label %112
112: ; preds = %111, %25
br label %113
113: ; preds = %112, %14
ret i32 0
}

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