#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*/ bubbleSort(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int main(void) {
  int a[10] = {2, 6, 4, 8, 10, 12, 89, 68, 45, 37};
  size_t i;
  puts("Dati nell'ordine originario");
  for (i = 0; i < 10; ++i) {
    printf("%4d", a[i]);
  }
  bubbleSort(a, 10);
  puts("\nDati ordinati in modo crescente");
  for (i = 0; i < 10; ++i) {
    printf("%4d", a[i]);
  }
  puts("");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x38(%rbp)
cmpq   $0xa,-0x38(%rbp)
jae    11a8 <main+0x68>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1178 <main+0x38>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1050 <bubbleSort@plt>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x38(%rbp)
cmpq   $0xa,-0x38(%rbp)
jae    11fa <main+0xba>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11ca <main+0x8a>
lea    0xe46(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x59,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x44,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2d,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x25,%esi
call   1050 <printf@plt>
mov    %rsp,%rdi
mov    $0xa,%esi
call   1060 <bubbleSort@plt>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 2, i32 6, i32 4, i32 8, i32 10, i32 12, i32 89, i32 68, i32 45, i32 37]
@.str = [28 x i8] c"Dati nell'ordine originario\00"
@.str.1 = [4 x i8] c"%4d\00"
@.str.2 = [33 x i8] c"\0ADati ordinati in modo crescente\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i64
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %3
br label %6
6: ; preds = %14, %0
%7 = load i64, i64* %3
%8 = icmp ult i64 %7, 10
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i64, i64* %3
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %9
%15 = load i64, i64* %3
%16 = add i64 %15, 1
store i64 %16, i64* %3
br label %6
17: ; preds = %6
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%19 = call i32 @bubbleSort(i32* %18, i32 10)
%20 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i64 0, i64* %3
br label %21
21: ; preds = %29, %17
%22 = load i64, i64* %3
%23 = icmp ult i64 %22, 10
br i1 %23, label %24, label %32
24: ; preds = %21
%25 = load i64, i64* %3
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %24
%30 = load i64, i64* %3
%31 = add i64 %30, 1
store i64 %31, i64* %3
br label %21
32: ; preds = %21
%33 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 2, i32 6, i32 4, i32 8, i32 10, i32 12, i32 89, i32 68, i32 45, i32 37]
@.str = [28 x i8] c"Dati nell'ordine originario\00"
@.str.1 = [4 x i8] c"%4d\00"
@.str.2 = [33 x i8] c"\0ADati ordinati in modo crescente\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 12)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 89)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 68)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 45)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 37)
%24 = call i32 @bubbleSort(i32* %4, i32 10)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* %4
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %6
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %8
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %10
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %12
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %14
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %16
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %18
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %20
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %22
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = call i32 @putchar(i32 10)
ret i32 0
}