#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 main() {
  int x, y, z;
  int temp;
  printf("Riordinatore di tre numeri\n");
  printf("Inserisci il primo numero: ");
  scanf("%d", &x);
  printf("Inserisci il secondo numero: ");
  scanf("%d", &y);
  printf("Inserisci il terzo numero: ");
  scanf("%d", &z);
  if (x < y && y > z) {
    temp = z;
    z = y;
    y = temp;
  }
  if (x > y && y < z) {
    temp = x;
    x = y;
    y = temp;
  }
  if (x > y && y > z) {
    temp = x;
    x = z;
    z = temp;
  }
  printf("Numeri riordinati in ordine crescente: %d %d %d", x, y, z);
  printf("Numeri riordinati in ordine decrescente: %d %d %d", z, y, x);
  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
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf2f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c1 <main+0xa1>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11c1 <main+0xa1>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11eb <main+0xcb>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11eb <main+0xcb>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1215 <main+0xf5>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1215 <main+0xf5>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf7c(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2d(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%eax
cmp    %edx,%ecx
jge    11bd <main+0x8d>
cmp    %eax,%edx
jle    11bd <main+0x8d>
mov    %edx,0x4(%rsp)
mov    %eax,0x8(%rsp)
mov    %edx,%esi
cmp    %eax,%ecx
jg     11c5 <main+0x95>
jmp    11d9 <main+0xa9>
mov    %eax,%esi
mov    %edx,%eax
cmp    %eax,%ecx
jle    11d9 <main+0xa9>
cmp    %esi,%eax
jge    11d9 <main+0xa9>
mov    %eax,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    %ecx,%edx
cmp    %edx,%eax
jg     11e1 <main+0xb1>
jmp    11f1 <main+0xc1>
mov    %eax,%edx
mov    %ecx,%eax
cmp    %edx,%eax
jle    11f1 <main+0xc1>
cmp    %esi,%edx
jle    11f1 <main+0xc1>
mov    %esi,0xc(%rsp)
mov    %eax,0x4(%rsp)
mov    %eax,%ecx
jmp    11f5 <main+0xc5>
mov    %esi,%ecx
mov    %eax,%esi
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Riordinatore di tre numeri\0A\00"
@.str.1 = [28 x i8] c"Inserisci il primo numero: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [30 x i8] c"Inserisci il secondo numero: \00"
@.str.4 = [28 x i8] c"Inserisci il terzo numero: \00"
@.str.5 = [48 x i8] c"Numeri riordinati in ordine crescente: %d %d %d\00"
@.str.6 = [50 x i8] c"Numeri riordinati in ordine decrescente: %d %d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %0
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %4
store i32 %21, i32* %5
%22 = load i32, i32* %3
store i32 %22, i32* %4
%23 = load i32, i32* %5
store i32 %23, i32* %3
br label %24
24: ; preds = %20, %16, %0
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = icmp sgt i32 %25, %26
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i32, i32* %2
store i32 %33, i32* %5
%34 = load i32, i32* %3
store i32 %34, i32* %2
%35 = load i32, i32* %5
store i32 %35, i32* %3
br label %36
36: ; preds = %32, %28, %24
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = icmp sgt i32 %37, %38
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i32, i32* %2
store i32 %45, i32* %5
%46 = load i32, i32* %4
store i32 %46, i32* %2
%47 = load i32, i32* %5
store i32 %47, i32* %4
br label %48
48: ; preds = %44, %40, %36
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %49, i32 %50, i32 %51)
%53 = load i32, i32* %4
%54 = load i32, i32* %3
%55 = load i32, i32* %2
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i32 %53, i32 %54, i32 %55)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"Inserisci il primo numero: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [30 x i8] c"Inserisci il secondo numero: \00"
@.str.4 = [28 x i8] c"Inserisci il terzo numero: \00"
@.str.5 = [48 x i8] c"Numeri riordinati in ordine crescente: %d %d %d\00"
@.str.6 = [50 x i8] c"Numeri riordinati in ordine decrescente: %d %d %d\00"
@str = [27 x i8] c"Riordinatore di tre numeri\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
%17 = load i32, i32* %3
%18 = icmp sgt i32 %15, %17
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %20, label %21
20: ; preds = %0
store i32 %15, i32* %3
store i32 %17, i32* %2
br label %21
21: ; preds = %0, %20
%22 = phi i32 [ %15, %20 ], [ %17, %0 ]
%23 = phi i32 [ %17, %20 ], [ %15, %0 ]
%24 = icmp sgt i32 %14, %23
%25 = icmp slt i32 %23, %22
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 %23, i32* %1
store i32 %14, i32* %2
br label %28
28: ; preds = %27, %21
%29 = phi i32 [ %14, %27 ], [ %23, %21 ]
%30 = phi i32 [ %23, %27 ], [ %14, %21 ]
%31 = icmp sgt i32 %30, %29
%32 = icmp sgt i32 %29, %22
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %34, label %35
34: ; preds = %28
store i32 %22, i32* %1
store i32 %30, i32* %3
br label %35
35: ; preds = %34, %28
%36 = phi i32 [ %30, %34 ], [ %22, %28 ]
%37 = phi i32 [ %22, %34 ], [ %30, %28 ]
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %37, i32 %29, i32 %36)
%39 = load i32, i32* %3
%40 = load i32, i32* %2
%41 = load i32, i32* %1
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i32 %39, i32 %40, i32 %41)
ret i32 0
}