#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 scalar_t__ int64_t;
typedef int /*<<< orphan*/ dst;

/* Variables and functions */
void sorter_selection_sort(int64_t *dst, const size_t size) {
  if (size <= 1) {
    return;
  }
  size_t i;
  size_t j;
  for (i = 0; i < size; i++) {
    for (j = i + 1; j < size; j++) {
      if (((dst[j]) - (dst[i])) < 0) {
        {
          int64_t _sort_swap_temp = (dst[i]);
          (dst[i]) = (dst[j]);
          (dst[j]) = _sort_swap_temp;
        };
      }
    }
  }
}


x86 assembly (clang, -O0):
<sorter_selection_sort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
ja     111c <sorter_selection_sort+0x1c>
jmp    11d2 <sorter_selection_sort+0xd2>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11d2 <sorter_selection_sort+0xd2>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11bc <sorter_selection_sort+0xbc>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
sub    (%rcx,%rdx,8),%rax
cmp    $0x0,%rax
jge    11a6 <sorter_selection_sort+0xa6>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    11ab <sorter_selection_sort+0xab>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113e <sorter_selection_sort+0x3e>
jmp    11c1 <sorter_selection_sort+0xc1>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <sorter_selection_sort+0x24>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sorter_selection_sort>:
cmp    $0x2,%rsi
jb     1150 <sorter_selection_sort+0x50>
xor    %r8d,%r8d
jmp    1115 <sorter_selection_sort+0x15>
nopl   0x0(%rax,%rax,1)
cmp    %rsi,%r8
je     1150 <sorter_selection_sort+0x50>
mov    %r8,%r9
add    $0x1,%r8
cmp    %rsi,%r8
jae    1110 <sorter_selection_sort+0x10>
mov    %r8,%rdx
jmp    1139 <sorter_selection_sort+0x39>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rdx
cmp    %rsi,%rdx
jae    1110 <sorter_selection_sort+0x10>
mov    (%rdi,%rdx,8),%rax
mov    (%rdi,%r9,8),%rcx
cmp    %rcx,%rax
jge    1130 <sorter_selection_sort+0x30>
mov    %rax,(%rdi,%r9,8)
mov    %rcx,(%rdi,%rdx,8)
jmp    1130 <sorter_selection_sort+0x30>
ret

LLVM IR (-O0):
define void @sorter_selection_sort(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = icmp ule i64 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
br label %58
11: ; preds = %2
store i64 0, i64* %5
br label %12
12: ; preds = %55, %11
%13 = load i64, i64* %5
%14 = load i64, i64* %4
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %58
16: ; preds = %12
%17 = load i64, i64* %5
%18 = add i64 %17, 1
store i64 %18, i64* %6
br label %19
19: ; preds = %51, %16
%20 = load i64, i64* %6
%21 = load i64, i64* %4
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %54
23: ; preds = %19
%24 = load i64*, i64** %3
%25 = load i64, i64* %6
%26 = getelementptr inbounds i64, i64* %24, i64 %25
%27 = load i64, i64* %26
%28 = load i64*, i64** %3
%29 = load i64, i64* %5
%30 = getelementptr inbounds i64, i64* %28, i64 %29
%31 = load i64, i64* %30
%32 = sub nsw i64 %27, %31
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %50
34: ; preds = %23
%35 = load i64*, i64** %3
%36 = load i64, i64* %5
%37 = getelementptr inbounds i64, i64* %35, i64 %36
%38 = load i64, i64* %37
store i64 %38, i64* %7
%39 = load i64*, i64** %3
%40 = load i64, i64* %6
%41 = getelementptr inbounds i64, i64* %39, i64 %40
%42 = load i64, i64* %41
%43 = load i64*, i64** %3
%44 = load i64, i64* %5
%45 = getelementptr inbounds i64, i64* %43, i64 %44
store i64 %42, i64* %45
%46 = load i64, i64* %7
%47 = load i64*, i64** %3
%48 = load i64, i64* %6
%49 = getelementptr inbounds i64, i64* %47, i64 %48
store i64 %46, i64* %49
br label %50
50: ; preds = %34, %23
br label %51
51: ; preds = %50
%52 = load i64, i64* %6
%53 = add i64 %52, 1
store i64 %53, i64* %6
br label %19
54: ; preds = %19
br label %55
55: ; preds = %54
%56 = load i64, i64* %5
%57 = add i64 %56, 1
store i64 %57, i64* %5
br label %12
58: ; preds = %10, %12
ret void
}

LLVM IR (-O2):
define void @sorter_selection_sort(i64* nocapture %0, i64 %1) {
%3 = icmp ugt i64 %1, 1
br i1 %3, label %6, label %22
4: ; preds = %19, %6
%5 = icmp eq i64 %8, %1
br i1 %5, label %22, label %6
6: ; preds = %2, %4
%7 = phi i64 [ %8, %4 ], [ 0, %2 ]
%8 = add nuw i64 %7, 1
%9 = icmp ult i64 %8, %1
br i1 %9, label %10, label %4
10: ; preds = %6
%11 = getelementptr inbounds i64, i64* %0, i64 %7
br label %12
12: ; preds = %10, %19
%13 = phi i64 [ %8, %10 ], [ %20, %19 ]
%14 = getelementptr inbounds i64, i64* %0, i64 %13
%15 = load i64, i64* %14
%16 = load i64, i64* %11
%17 = icmp slt i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store i64 %15, i64* %11
store i64 %16, i64* %14
br label %19
19: ; preds = %12, %18
%20 = add nuw i64 %13, 1
%21 = icmp ult i64 %20, %1
br i1 %21, label %12, label %4
22: ; preds = %4, %2
ret void
}