#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;
  int max, min, mid;
  printf("Please input three numbers:");
  scanf("%d%d%d", &a, &b, &c);
  if (a > b) {
    max = a;
    min = b;
  } else {
    max = b;
    min = a;
  }
  if (max < c) {
    max = c;
  }
  if (min > c) {
    min = c;
  }
  mid = a + b + c - max - min;
  printf("The numbers are:%d, %d, %d\n", a, b, c);
  printf("Output in descending order:%d, %d, %d\n", min, mid, max);
  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    0xed8(%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    1172 <main+0x52>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    117e <main+0x5e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1190 <main+0x70>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11a2 <main+0x82>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
cmp    %edx,%esi
mov    %esi,%r14d
cmovg  %edx,%r14d
mov    %edx,%ebx
cmovg  %esi,%ebx
mov    0x4(%rsp),%ecx
cmp    %ecx,%ebx
cmovl  %ecx,%ebx
cmp    %ecx,%r14d
cmovg  %ecx,%r14d
lea    (%rdx,%rsi,1),%ebp
add    %ecx,%ebp
sub    %r14d,%ebp
sub    %ebx,%ebp
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Please input three numbers:\00"
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [28 x i8] c"The numbers are:%d, %d, %d\0A\00"
@.str.3 = [39 x i8] c"Output in descending order:%d, %d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%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* %5
%15 = load i32, i32* %3
store i32 %15, i32* %6
br label %19
16: ; preds = %0
%17 = load i32, i32* %3
store i32 %17, i32* %5
%18 = load i32, i32* %2
store i32 %18, i32* %6
br label %19
19: ; preds = %16, %13
%20 = load i32, i32* %5
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %4
store i32 %24, i32* %5
br label %25
25: ; preds = %23, %19
%26 = load i32, i32* %6
%27 = load i32, i32* %4
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %4
store i32 %30, i32* %6
br label %31
31: ; preds = %29, %25
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = add nsw i32 %32, %33
%35 = load i32, i32* %4
%36 = add nsw i32 %34, %35
%37 = load i32, i32* %5
%38 = sub nsw i32 %36, %37
%39 = load i32, i32* %6
%40 = sub nsw i32 %38, %39
store i32 %40, i32* %7
%41 = load i32, i32* %2
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %41, i32 %42, i32 %43)
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = load i32, i32* %5
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %45, i32 %46, i32 %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Please input three numbers:\00"
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [28 x i8] c"The numbers are:%d, %d, %d\0A\00"
@.str.3 = [39 x i8] c"Output in descending order:%d, %d, %d\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 ([28 x i8], [28 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 sgt i32 %9, %10
%12 = select i1 %11, i32 %10, i32 %9
%13 = select i1 %11, i32 %9, i32 %10
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
%16 = select i1 %15, i32 %14, i32 %13
%17 = icmp sgt i32 %12, %14
%18 = select i1 %17, i32 %14, i32 %12
%19 = add i32 %10, %9
%20 = add i32 %19, %14
%21 = add i32 %18, %16
%22 = sub i32 %20, %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10, i32 %14)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %18, i32 %22, i32 %16)
ret i32 0
}