#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 array[100], temp;
  int n, i, j;
  printf("Enter n: ");
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    printf("Enter %d number: ", i + 1);
    scanf("%d", &array[i]);
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (array[i] > array[j]) {
        temp = array[i];
        array[i] = array[j];
        array[j] = temp;
      }
    }
  }
  for (i = 0; i < n; i++) {
    printf("%d ", array[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    11bb <main+0x9b>
mov    -0x1ac(%rbp),%esi
add    $0x1,%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x1ac(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe68(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    115d <main+0x3d>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1290 <main+0x170>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1277 <main+0x157>
movslq -0x1ac(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
movslq -0x1b0(%rbp),%rcx
cmp    -0x1a0(%rbp,%rcx,4),%eax
jle    125e <main+0x13e>
movslq -0x1ac(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
mov    %eax,-0x1a4(%rbp)
movslq -0x1b0(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%ecx
movslq -0x1ac(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%ecx
movslq -0x1b0(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
jmp    1263 <main+0x143>
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
jmp    11e6 <main+0xc6>
jmp    127c <main+0x15c>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    11c5 <main+0xa5>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    12dc <main+0x1bc>
movslq -0x1ac(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    129a <main+0x17a>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    121c <main+0xfc>
lea    0x10(%rsp),%r12
lea    0xea9(%rip),%r14
lea    0xe9f(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jl     1170 <main+0x50>
mov    %eax,%r8d
test   %r8d,%r8d
jle    121c <main+0xfc>
lea    0x10(%rsp),%rcx
xor    %r9d,%r9d
mov    %r8,%rdx
jmp    11bd <main+0x9d>
xchg   %ax,%ax
add    $0x4,%rcx
add    $0xffffffffffffffff,%rdx
cmp    %r8,%r9
je     11ed <main+0xcd>
mov    %r9,%rdi
add    $0x1,%r9
cmp    %r8,%r9
jae    11b0 <main+0x90>
mov    $0x1,%ebx
jmp    11d9 <main+0xb9>
add    $0x1,%rbx
cmp    %rbx,%rdx
je     11b0 <main+0x90>
mov    0x10(%rsp,%rdi,4),%eax
mov    (%rcx,%rbx,4),%esi
cmp    %esi,%eax
jle    11d0 <main+0xb0>
mov    %esi,0x10(%rsp,%rdi,4)
mov    %eax,(%rcx,%rbx,4)
jmp    11d0 <main+0xb0>
test   %r8d,%r8d
jle    121c <main+0xfc>
lea    0xe26(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1200 <main+0xe0>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Enter n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Enter %d number: \00"
@.str.3 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %9
9: ; preds = %21, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %24
13: ; preds = %9
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %13
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %9
24: ; preds = %9
store i32 0, i32* %5
br label %25
25: ; preds = %67, %24
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %70
29: ; preds = %25
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %32
32: ; preds = %63, %29
%33 = load i32, i32* %6
%34 = load i32, i32* %4
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %66
36: ; preds = %32
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = icmp sgt i32 %40, %44
br i1 %45, label %46, label %62
46: ; preds = %36
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %48
%50 = load i32, i32* %49
store i32 %50, i32* %3
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %56
store i32 %54, i32* %57
%58 = load i32, i32* %3
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %60
store i32 %58, i32* %61
br label %62
62: ; preds = %46, %36
br label %63
63: ; preds = %62
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %32
66: ; preds = %32
br label %67
67: ; preds = %66
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 1
store i32 %69, i32* %5
br label %25
70: ; preds = %25
store i32 0, i32* %5
br label %71
71: ; preds = %81, %70
%72 = load i32, i32* %5
%73 = load i32, i32* %4
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %84
75: ; preds = %71
%76 = load i32, i32* %5
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %77
%79 = load i32, i32* %78
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %79)
br label %81
81: ; preds = %75
%82 = load i32, i32* %5
%83 = add nsw i32 %82, 1
store i32 %83, i32* %5
br label %71
84: ; preds = %71
%85 = load i32, i32* %1
ret i32 %85
}

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