#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 EXIT_SUCCESS;
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ selection_sort(int *, int);
int main(int argc, char **argv) {
  int array[20] = {9,  71, 2,  84, 12, 23, 99, 26, 1,  76,
                   67, 4,  53, 42, 10, 38, 66, 7,  80, 2};
  print_array(array, 20);
  selection_sort(array, 20);
  print_array(array, 20);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1040 <print_array@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1030 <selection_sort@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1040 <print_array@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0xf14(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1030 <selection_sort@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1040 <print_array@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [20 x i32] [i32 9, i32 71, i32 2, i32 84, i32 12, i32 23, i32 99, i32 26, i32 1, i32 76, i32 67, i32 4, i32 53, i32 42, i32 10, i32 38, i32 66, i32 7, i32 80, i32 2]
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [20 x i32]* %6 to i8*
%8 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%9 = call i32 @print_array(i32* %8, i32 20)
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%11 = call i32 @selection_sort(i32* %10, i32 20)
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%13 = call i32 @print_array(i32* %12, i32 20)
%14 = load i32, i32* @EXIT_SUCCESS
ret i32 %14
}

LLVM IR (-O2):
@__const.main.array = [20 x i32] [i32 9, i32 71, i32 2, i32 84, i32 12, i32 23, i32 99, i32 26, i32 1, i32 76, i32 67, i32 4, i32 53, i32 42, i32 10, i32 38, i32 66, i32 7, i32 80, i32 2]
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i32]
%4 = bitcast [20 x i32]* %3 to i8*
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%6 = call i32 @print_array(i32* %5, i32 20)
%7 = call i32 @selection_sort(i32* %5, i32 20)
%8 = call i32 @print_array(i32* %5, i32 20)
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}