#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 n[10], i, j, min = 0, temp;
  printf("Enter %d Numbers: \n", 10);
  for (i = 0; i < 10; i++)
    scanf("%d", &n[i]);
  for (i = 0; i < 10; i++) {
    min = i;
    for (j = i; j < 10; j++)
      min = (n[min] > n[j]) ? j : min;
    temp = n[i];
    n[i] = n[min];
    n[min] = temp;
  }
  for (i = 0; i < 10; i++)
    printf("%d ", n[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xec3(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1183 <main+0x63>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea4(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1150 <main+0x30>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1219 <main+0xf9>
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11e5 <main+0xc5>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x38(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jle    11cb <main+0xab>
mov    -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    11d1 <main+0xb1>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11a0 <main+0x80>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x40(%rbp),%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118a <main+0x6a>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    124e <main+0x12e>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1220 <main+0x100>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xec2(%rip),%rdi
xor    %ebx,%ebx
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec1(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
jmp    11f9 <main+0xc9>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp,%rbx,4),%eax
movslq %edx,%rcx
mov    (%rsp,%rcx,4),%edx
mov    %edx,(%rsp,%rbx,4)
mov    %eax,(%rsp,%rcx,4)
add    $0x1,%rbx
cmp    $0xa,%rbx
je     121d <main+0xed>
mov    %rbx,%rax
mov    %ebx,%ecx
jmp    120c <main+0xdc>
add    $0x1,%rax
mov    %edx,%ecx
cmp    $0xa,%rax
je     11e0 <main+0xb0>
movslq %ecx,%rdx
mov    (%rsp,%rdx,4),%esi
mov    %eax,%edx
cmp    (%rsp,%rax,4),%esi
jg     1200 <main+0xd0>
mov    %ecx,%edx
jmp    1200 <main+0xd0>
mov    (%rsp),%esi
lea    0xdf0(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Enter %d Numbers: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
br label %24
24: ; preds = %40, %0
%25 = phi i64 [ 0, %0 ], [ %46, %40 ]
%26 = trunc i64 %25 to i32
br label %27
27: ; preds = %24, %27
%28 = phi i64 [ %25, %24 ], [ %38, %27 ]
%29 = phi i32 [ %26, %24 ], [ %37, %27 ]
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %28
%34 = load i32, i32* %33
%35 = icmp sgt i32 %32, %34
%36 = trunc i64 %28 to i32
%37 = select i1 %35, i32 %36, i32 %29
%38 = add nuw nsw i64 %28, 1
%39 = icmp eq i64 %38, 10
br i1 %39, label %40, label %27
40: ; preds = %27
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %25
%42 = load i32, i32* %41
%43 = sext i32 %37 to i64
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %43
%45 = load i32, i32* %44
store i32 %45, i32* %41
store i32 %42, i32* %44
%46 = add nuw nsw i64 %25, 1
%47 = icmp eq i64 %46, 10
br i1 %47, label %48, label %24
48: ; preds = %40
%49 = load i32, i32* %4
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %6
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %8
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %10
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %12
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %14
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %16
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %18
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = load i32, i32* %20
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %22
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %67)
%69 = call i32 @putchar(i32 10)
ret i32 0
}