#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;
  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 (z < x) {
    x = x + z;
    z = x - z;
    x = x - z;
  }
  if (x > y) {
    x = x + y;
    y = x - y;
    x = x - y;
  }
  if (y > z) {
    y = y + z;
    z = y - z;
    y = y - z;
  }
  printf("\n\nNumeri riordinati in ordine crescente: %d %d %d", x, y, z);
  printf("\nNumeri riordinati in ordine decrescente: %d %d %d", z, y, x);
  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    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf31(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11be <main+0x9e>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11e5 <main+0xc5>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    120c <main+0xec>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2f(%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    0x4(%rsp),%eax
mov    0xc(%rsp),%ecx
cmp    %ecx,%eax
jge    11b1 <main+0x81>
mov    %ecx,0x4(%rsp)
mov    %eax,0xc(%rsp)
mov    %ecx,%edx
jmp    11b5 <main+0x85>
mov    %eax,%edx
mov    %ecx,%eax
mov    0x8(%rsp),%ecx
cmp    %ecx,%eax
jle    11d1 <main+0xa1>
mov    %eax,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %ecx,%esi
cmp    %edx,%eax
jg     11d9 <main+0xa9>
mov    %edx,%ecx
mov    %eax,%edx
jmp    11e3 <main+0xb3>
mov    %eax,%esi
mov    %ecx,%eax
cmp    %edx,%eax
jle    11cb <main+0x9b>
mov    %eax,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %eax,%ecx
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe84(%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 = [50 x i8] c"\0A\0ANumeri riordinati in ordine crescente: %d %d %d\00"
@.str.6 = [51 x i8] c"\0ANumeri riordinati in ordine decrescente: %d %d %d\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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %0
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = add nsw i32 %16, %17
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %4
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = sub nsw i32 %22, %23
store i32 %24, i32* %2
br label %25
25: ; preds = %15, %0
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %39
29: ; preds = %25
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = add nsw i32 %30, %31
store i32 %32, i32* %2
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = sub nsw i32 %33, %34
store i32 %35, i32* %3
%36 = load i32, i32* %2
%37 = load i32, i32* %3
%38 = sub nsw i32 %36, %37
store i32 %38, i32* %2
br label %39
39: ; preds = %29, %25
%40 = load i32, i32* %3
%41 = load i32, i32* %4
%42 = icmp sgt i32 %40, %41
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load i32, i32* %3
%45 = load i32, i32* %4
%46 = add nsw i32 %44, %45
store i32 %46, i32* %3
%47 = load i32, i32* %3
%48 = load i32, i32* %4
%49 = sub nsw i32 %47, %48
store i32 %49, i32* %4
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = sub nsw i32 %50, %51
store i32 %52, i32* %3
br label %53
53: ; preds = %43, %39
%54 = load i32, i32* %2
%55 = load i32, i32* %3
%56 = load i32, i32* %4
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %54, i32 %55, i32 %56)
%58 = load i32, i32* %4
%59 = load i32, i32* %3
%60 = load i32, i32* %2
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 %58, i32 %59, i32 %60)
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 = [50 x i8] c"\0A\0ANumeri riordinati in ordine crescente: %d %d %d\00"
@.str.6 = [51 x i8] c"\0ANumeri 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* %3
%15 = load i32, i32* %1
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %0
store i32 %15, i32* %3
store i32 %14, i32* %1
br label %18
18: ; preds = %17, %0
%19 = phi i32 [ %15, %17 ], [ %14, %0 ]
%20 = phi i32 [ %14, %17 ], [ %15, %0 ]
%21 = load i32, i32* %2
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 %20, i32* %2
store i32 %21, i32* %1
br label %24
24: ; preds = %23, %18
%25 = phi i32 [ %21, %23 ], [ %20, %18 ]
%26 = phi i32 [ %20, %23 ], [ %21, %18 ]
%27 = icmp sgt i32 %26, %19
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 %26, i32* %3
store i32 %19, i32* %2
br label %29
29: ; preds = %28, %24
%30 = phi i32 [ %26, %28 ], [ %19, %24 ]
%31 = phi i32 [ %19, %28 ], [ %26, %24 ]
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %25, i32 %31, i32 %30)
%33 = load i32, i32* %3
%34 = load i32, i32* %2
%35 = load i32, i32* %1
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 %33, i32 %34, i32 %35)
ret i32 0
}