#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 */
typedef int /*<<< orphan*/ list5;
typedef int /*<<< orphan*/ list4;
typedef int /*<<< orphan*/ list3;
typedef int /*<<< orphan*/ list2;
typedef int /*<<< orphan*/ list1;

/* Variables and functions */
int /*<<< orphan*/ printArr(int *, int);
int /*<<< orphan*/ selectionSort(int *, int);
int main(void) {
  int list1[] = {10};
  int size = ((int)sizeof(list1) / sizeof(int));
  printArr(list1, size);
  selectionSort(list1, size);
  printArr(list1, size);
  int list2[] = {10, 3};
  size = ((int)sizeof(list2) / sizeof(int));
  printArr(list2, size);
  selectionSort(list2, size);
  printArr(list2, size);
  int list3[] = {20, 3, 1};
  size = ((int)sizeof(list3) / sizeof(int));
  printArr(list3, size);
  selectionSort(list3, size);
  printArr(list3, size);
  int list4[] = {3, 10};
  size = ((int)sizeof(list4) / sizeof(int));
  printArr(list4, size);
  selectionSort(list4, size);
  printArr(list4, size);
  int list5[] = {3, 10, 20};
  size = ((int)sizeof(list5) / sizeof(int));
  printArr(list5, size);
  selectionSort(list5, size);
  printArr(list5, size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <selectionSort@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
mov    0xe9a(%rip),%rax
mov    %rax,-0x14(%rbp)
movl   $0x2,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
lea    -0x14(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <selectionSort@plt>
lea    -0x14(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
mov    0xe74(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe72(%rip),%eax
mov    %eax,-0x18(%rbp)
movl   $0x3,-0xc(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
lea    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <selectionSort@plt>
lea    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
mov    0xe2d(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x2,-0xc(%rbp)
lea    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
lea    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <selectionSort@plt>
lea    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
mov    0xe0b(%rip),%rax
mov    %rax,-0x34(%rbp)
mov    0xe09(%rip),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x3,-0xc(%rbp)
lea    -0x34(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
lea    -0x34(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <selectionSort@plt>
lea    -0x34(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <printArr@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movl   $0xa,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printArr@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <selectionSort@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printArr@plt>
movabs $0x30000000a,%rax
mov    %rax,0x38(%rsp)
lea    0x38(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printArr@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <selectionSort@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printArr@plt>
mov    0xe6e(%rip),%eax
mov    %eax,0x30(%rsp)
mov    0xe5b(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printArr@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <selectionSort@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printArr@plt>
movabs $0xa00000003,%rax
mov    %rax,0x20(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printArr@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <selectionSort@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printArr@plt>
mov    0xdfd(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xdea(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printArr@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <selectionSort@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printArr@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.list1 = [1 x i32] [i32 10]
@__const.main.list2 = [2 x i32] [i32 10, i32 3]
@__const.main.list3 = [3 x i32] [i32 20, i32 3, i32 1]
@__const.main.list4 = [2 x i32] [i32 3, i32 10]
@__const.main.list5 = [3 x i32] [i32 3, i32 10, i32 20]
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i32]
%3 = alloca i32
%4 = alloca [2 x i32]
%5 = alloca [3 x i32]
%6 = alloca [2 x i32]
%7 = alloca [3 x i32]
store i32 0, i32* %1
%8 = bitcast [1 x i32]* %2 to i8*
store i32 1, i32* %3
%9 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 @printArr(i32* %9, i32 %10)
%12 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = call i32 @selectionSort(i32* %12, i32 %13)
%15 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%16 = load i32, i32* %3
%17 = call i32 @printArr(i32* %15, i32 %16)
%18 = bitcast [2 x i32]* %4 to i8*
store i32 2, i32* %3
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%20 = load i32, i32* %3
%21 = call i32 @printArr(i32* %19, i32 %20)
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%23 = load i32, i32* %3
%24 = call i32 @selectionSort(i32* %22, i32 %23)
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%26 = load i32, i32* %3
%27 = call i32 @printArr(i32* %25, i32 %26)
%28 = bitcast [3 x i32]* %5 to i8*
store i32 3, i32* %3
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%30 = load i32, i32* %3
%31 = call i32 @printArr(i32* %29, i32 %30)
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%33 = load i32, i32* %3
%34 = call i32 @selectionSort(i32* %32, i32 %33)
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%36 = load i32, i32* %3
%37 = call i32 @printArr(i32* %35, i32 %36)
%38 = bitcast [2 x i32]* %6 to i8*
store i32 2, i32* %3
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%40 = load i32, i32* %3
%41 = call i32 @printArr(i32* %39, i32 %40)
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%43 = load i32, i32* %3
%44 = call i32 @selectionSort(i32* %42, i32 %43)
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%46 = load i32, i32* %3
%47 = call i32 @printArr(i32* %45, i32 %46)
%48 = bitcast [3 x i32]* %7 to i8*
store i32 3, i32* %3
%49 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%50 = load i32, i32* %3
%51 = call i32 @printArr(i32* %49, i32 %50)
%52 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%53 = load i32, i32* %3
%54 = call i32 @selectionSort(i32* %52, i32 %53)
%55 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%56 = load i32, i32* %3
%57 = call i32 @printArr(i32* %55, i32 %56)
ret i32 0
}

LLVM IR (-O2):
@__const.main.list3 = [3 x i32] [i32 20, i32 3, i32 1]
@__const.main.list5 = [3 x i32] [i32 3, i32 10, i32 20]
define i32 @main() {
%1 = alloca [1 x i32]
%2 = alloca i64
%3 = alloca [3 x i32]
%4 = alloca i64
%5 = alloca [3 x i32]
%6 = bitcast [1 x i32]* %1 to i8*
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 10, i32* %7
%8 = call i32 @printArr(i32* %7, i32 1)
%9 = call i32 @selectionSort(i32* %7, i32 1)
%10 = call i32 @printArr(i32* %7, i32 1)
%11 = bitcast i64* %2 to i8*
store i64 12884901898, i64* %2
%12 = bitcast i64* %2 to i32*
%13 = call i32 @printArr(i32* %12, i32 2)
%14 = call i32 @selectionSort(i32* %12, i32 2)
%15 = call i32 @printArr(i32* %12, i32 2)
%16 = bitcast [3 x i32]* %3 to i8*
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%18 = call i32 @printArr(i32* %17, i32 3)
%19 = call i32 @selectionSort(i32* %17, i32 3)
%20 = call i32 @printArr(i32* %17, i32 3)
%21 = bitcast i64* %4 to i8*
store i64 42949672963, i64* %4
%22 = bitcast i64* %4 to i32*
%23 = call i32 @printArr(i32* %22, i32 2)
%24 = call i32 @selectionSort(i32* %22, i32 2)
%25 = call i32 @printArr(i32* %22, i32 2)
%26 = bitcast [3 x i32]* %5 to i8*
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%28 = call i32 @printArr(i32* %27, i32 3)
%29 = call i32 @selectionSort(i32* %27, i32 3)
%30 = call i32 @printArr(i32* %27, i32 3)
ret i32 0
}