#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 scanf(char *, int *);
int main() {
  int arr[10] = {14, 54, 1, -565, 1, 65, 6, 0, 19, 44};
  bubblesort(arr, 10);
  int i;
  for (i = 0; i < 10; i++) {
    printf("%d ", arr[i]);
  }
  printf("\n");
  printf("Give 10 integers: ");
  int arr1[10 + 1];
  for (i = 0; i < 10; i++) {
    arr1[10] = scanf("%d", &arr1[i]);
  }
  bubblesort(arr1, 10);
  for (i = 0; i < 10; i++) {
    printf("%d ", arr1[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1060 <bubblesort@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11a7 <main+0x67>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1179 <main+0x39>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1200 <main+0xc0>
movslq -0x34(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe57(%rip),%rdi
call   1050 <scanf@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ca <main+0x8a>
lea    -0x60(%rbp),%rdi
mov    $0xa,%esi
call   1060 <bubblesort@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1243 <main+0x103>
movslq -0x34(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1215 <main+0xd5>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    0xed0(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
mov    $0xa,%esi
call   1060 <bubblesort@plt>
mov    0x30(%rsp),%esi
lea    0xea1(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x34(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x40(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x44(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x48(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x50(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x54(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe11(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,0x28(%rsp)
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <bubblesort@plt>
mov    (%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.arr = [10 x i32] [i32 14, i32 54, i32 1, i32 -565, i32 1, i32 65, i32 6, i32 0, i32 19, i32 44]
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [19 x i8] c"Give 10 integers: \00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca [11 x i32]
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @bubblesort(i32* %6, i32 10)
store i32 0, i32* %3
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %11
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %8
20: ; preds = %8
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %23
23: ; preds = %32, %20
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 10
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %28
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %29)
%31 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 10
store i32 %30, i32* %31
br label %32
32: ; preds = %26
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %23
35: ; preds = %23
%36 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 0
%37 = call i32 @bubblesort(i32* %36, i32 10)
store i32 0, i32* %3
br label %38
38: ; preds = %47, %35
%39 = load i32, i32* %3
%40 = icmp slt i32 %39, 10
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %41
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %38
50: ; preds = %38
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [10 x i32] [i32 14, i32 54, i32 1, i32 -565, i32 1, i32 65, i32 6, i32 0, i32 19, i32 44]
@.str = [4 x i8] c"%d \00"
@.str.2 = [19 x i8] c"Give 10 integers: \00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [11 x i32]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @bubblesort(i32* %4, i32 10)
%6 = load i32, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = call i32 @putchar(i32 10)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%37 = bitcast [11 x i32]* %2 to i8*
%38 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 10
%39 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %39)
store i32 %40, i32* %38
%41 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 1
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %41)
store i32 %42, i32* %38
%43 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 2
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %43)
store i32 %44, i32* %38
%45 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 3
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %45)
store i32 %46, i32* %38
%47 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 4
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %47)
store i32 %48, i32* %38
%49 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 5
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %49)
store i32 %50, i32* %38
%51 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 6
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %51)
store i32 %52, i32* %38
%53 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 7
%54 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %53)
store i32 %54, i32* %38
%55 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 8
%56 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %55)
store i32 %56, i32* %38
%57 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 9
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %57)
store i32 %58, i32* %38
%59 = call i32 @bubblesort(i32* %39, i32 10)
%60 = load i32, i32* %39
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %41
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %43
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %45
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %47
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %49
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %51
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %53
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %74)
%76 = load i32, i32* %55
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %57
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %78)
%80 = call i32 @putchar(i32 10)
ret i32 0
}