#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);
  while (a < b && a < c) {
    if (b < c) {
      printf("%d is the median\n", b);
      break;
    } else {
      printf("%d is the median\n", c);
      break;
    }
  }
  while (b < a && b < c) {
    if (a < c) {
      printf("%d is the median\n", a);
      break;
    } else {
      printf("%d is the median\n", c);
      break;
    }
  }
  while (c < a && c < b) {
    if (b < a) {
      printf("%d is the median\n", b);
      break;
    } else {
      printf("%d is the median\n", a);
      break;
    }
  }
  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    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x11(%rbp)
jge    1172 <main+0x52>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1182 <main+0x62>
jmp    11b5 <main+0x95>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a4 <main+0x84>
mov    -0xc(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0x95>
mov    -0x10(%rbp),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ba <main+0x9a>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x12(%rbp)
jge    11d7 <main+0xb7>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setl   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    11e7 <main+0xc7>
jmp    121a <main+0xfa>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1209 <main+0xe9>
mov    -0x8(%rbp),%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121a <main+0xfa>
mov    -0x10(%rbp),%esi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121f <main+0xff>
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x13(%rbp)
jge    123c <main+0x11c>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
test   $0x1,%al
jne    124c <main+0x12c>
jmp    127f <main+0x15f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    126e <main+0x14e>
mov    -0xc(%rbp),%esi
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127f <main+0x15f>
mov    -0x8(%rbp),%esi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%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
cmp    %eax,%ecx
jge    1174 <main+0x54>
mov    0xc(%rsp),%esi
cmp    %esi,%ecx
jge    1174 <main+0x54>
cmp    %esi,%eax
cmovl  %eax,%esi
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%ecx
mov    0x14(%rsp),%eax
cmp    %eax,%ecx
jge    119b <main+0x7b>
mov    0xc(%rsp),%esi
cmp    %esi,%ecx
jge    119b <main+0x7b>
cmp    %esi,%eax
cmovl  %eax,%esi
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%ecx
mov    0x14(%rsp),%esi
cmp    %esi,%ecx
jge    11c2 <main+0xa2>
mov    0x10(%rsp),%eax
cmp    %eax,%ecx
jge    11c2 <main+0xa2>
cmp    %esi,%eax
cmovl  %eax,%esi
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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