#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 num1, num2, num3;
  printf("Please enter 3 numbers separated by spaces > ");
  scanf("%i %i %i", &num1, &num2, &num3);
  if ((((num1 > num2) && (num1 < num3))) || ((num1 > num3) && (num1 < num2))) {
    printf("%i is the median\n", num1);
    return 0;
  } else if ((((num2 > num1) && (num2 < num3))) ||
             ((num2 > num3) && (num2 < num1))) {
    printf("%i is the median\n", num2);
    return 0;
  } else if ((((num3 > num2) && (num3 < num1))) ||
             ((num3 > num1) && (num3 < num2))) {
    printf("%i is the median\n", num3);
    return 0;
  }
  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
jle    116d <main+0x4d>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1185 <main+0x65>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11a2 <main+0x82>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a2 <main+0x82>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124d <main+0x12d>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11ba <main+0x9a>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     11d2 <main+0xb2>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11ef <main+0xcf>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ef <main+0xcf>
mov    -0xc(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124d <main+0x12d>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1207 <main+0xe7>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     121f <main+0xff>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    123c <main+0x11c>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    123c <main+0x11c>
mov    -0x10(%rbp),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124d <main+0x12d>
jmp    1241 <main+0x121>
jmp    1246 <main+0x126>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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),%ecx
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%esi
cmp    %eax,%ecx
jle    1161 <main+0x41>
cmp    %esi,%ecx
jl     1169 <main+0x49>
cmp    %esi,%ecx
jle    1180 <main+0x60>
cmp    %eax,%ecx
jge    1180 <main+0x60>
mov    %ecx,%esi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
cmp    %eax,%ecx
jge    1188 <main+0x68>
cmp    %esi,%eax
jl     1190 <main+0x70>
cmp    %esi,%eax
jle    1194 <main+0x74>
cmp    %eax,%ecx
jle    1194 <main+0x74>
mov    %eax,%esi
jmp    116b <main+0x4b>
cmp    %esi,%eax
jge    119c <main+0x7c>
cmp    %esi,%ecx
jg     116b <main+0x4b>
cmp    %esi,%ecx
jge    1179 <main+0x59>
cmp    %esi,%eax
jg     116b <main+0x4b>
jmp    1179 <main+0x59>

LLVM IR (-O0):
@.str = [46 x i8] c"Please enter 3 numbers separated by spaces > \00"
@.str.1 = [9 x i8] c"%i %i %i\00"
@.str.2 = [18 x i8] c"%i 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 ([9 x i8], [9 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 sgt i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %22, label %14
14: ; preds = %10, %0
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = icmp sgt i32 %15, %16
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %18, %10
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %23)
store i32 0, i32* %1
br label %66
25: ; preds = %18, %14
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = icmp slt i32 %30, %31
br i1 %32, label %41, label %33
33: ; preds = %29, %25
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = load i32, i32* %3
%39 = load i32, i32* %2
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %44
41: ; preds = %37, %29
%42 = load i32, i32* %3
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %42)
store i32 0, i32* %1
br label %66
44: ; preds = %37, %33
%45 = load i32, i32* %4
%46 = load i32, i32* %3
%47 = icmp sgt i32 %45, %46
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = load i32, i32* %4
%50 = load i32, i32* %2
%51 = icmp slt i32 %49, %50
br i1 %51, label %60, label %52
52: ; preds = %48, %44
%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, %48
%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)
store i32 0, i32* %1
br label %66
63: ; preds = %56, %52
br label %64
64: ; preds = %63
br label %65
65: ; preds = %64
store i32 0, i32* %1
br label %66
66: ; preds = %65, %60, %41, %22
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@.str = [46 x i8] c"Please enter 3 numbers separated by spaces > \00"
@.str.1 = [9 x i8] c"%i %i %i\00"
@.str.2 = [18 x i8] c"%i 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 ([9 x i8], [9 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 sgt i32 %9, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %9, %12
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %29, label %15
15: ; preds = %0
%16 = icmp sgt i32 %9, %12
%17 = icmp slt i32 %9, %10
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %29, label %19
19: ; preds = %15
%20 = icmp slt i32 %10, %12
%21 = select i1 %17, i1 %20, i1 false
br i1 %21, label %29, label %22
22: ; preds = %19
%23 = icmp sgt i32 %10, %12
%24 = select i1 %23, i1 %11, i1 false
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = select i1 %20, i1 %16, i1 false
br i1 %26, label %29, label %27
27: ; preds = %25
%28 = select i1 %13, i1 %23, i1 false
br i1 %28, label %29, label %32
29: ; preds = %25, %27, %19, %22, %0, %15
%30 = phi i32 [ %9, %15 ], [ %9, %0 ], [ %10, %22 ], [ %10, %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
ret i32 0
}