#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 *);
void main() {
  int input, a, b, c;
  printf("Please enter an integer: ");
  scanf("%d", &input);
  a = input;
  printf("Please enter an integer: ");
  scanf("%d", &input);
  if (input > a) {
    b = a;
    a = input;
  } else {
    b = input;
  }
  printf("Please enter an integer: ");
  scanf("%d", &input);
  if (input > a) {
    c = b;
    b = a;
    a = input;
  } else if (input > b) {
    c = b;
    b = input;
  } else {
    c = b;
    b = input;
  }
  printf("The largest integer is %d.", a);
  printf("\nThe variables in order of least to greatest are: %d, %d, %d.", c, b,
         a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1187 <main+0x67>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    118d <main+0x6d>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11ce <main+0xae>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11fc <main+0xdc>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11eb <main+0xcb>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11f7 <main+0xd7>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11fc <main+0xdc>
mov    -0x8(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%r15
lea    0x4(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r13d
cmp    %ebp,%r13d
mov    %ebp,%ebx
cmovg  %r13d,%ebx
cmovg  %ebp,%r13d
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
mov    %ebx,%ebp
cmovg  %eax,%ebp
cmovle %eax,%ebx
lea    0xe75(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"The largest integer is %d.\00"
@.str.3 = [62 x i8] c"\0AThe variables in order of least to greatest are: %d, %d, %d.\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
store i32 %7, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* %2
store i32 %14, i32* %3
%15 = load i32, i32* %1
store i32 %15, i32* %2
br label %18
16: ; preds = %0
%17 = load i32, i32* %1
store i32 %17, i32* %3
br label %18
18: ; preds = %16, %13
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %18
%25 = load i32, i32* %3
store i32 %25, i32* %4
%26 = load i32, i32* %2
store i32 %26, i32* %3
%27 = load i32, i32* %1
store i32 %27, i32* %2
br label %39
28: ; preds = %18
%29 = load i32, i32* %1
%30 = load i32, i32* %3
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load i32, i32* %3
store i32 %33, i32* %4
%34 = load i32, i32* %1
store i32 %34, i32* %3
br label %38
35: ; preds = %28
%36 = load i32, i32* %3
store i32 %36, i32* %4
%37 = load i32, i32* %1
store i32 %37, i32* %3
br label %38
38: ; preds = %35, %32
br label %39
39: ; preds = %38, %24
%40 = load i32, i32* %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %4
%43 = load i32, i32* %3
%44 = load i32, i32* %2
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i32 %42, i32 %43, i32 %44)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"The largest integer is %d.\00"
@.str.3 = [62 x i8] c"\0AThe variables in order of least to greatest are: %d, %d, %d.\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, %5
%10 = select i1 %9, i32 %8, i32 %5
%11 = select i1 %9, i32 %5, i32 %8
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, %10
%16 = select i1 %15, i32 %14, i32 %10
%17 = select i1 %15, i32 %10, i32 %14
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %17, i32 %16)
ret void
}