#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*/ swap(int *, int *);
void insertion_sort(int paramArr[]) {
  int sdx = 0;
  int tdx = sdx + 1;
  for (int i = 0; i < 15; i++) {
    while ((paramArr[tdx] < paramArr[tdx - 1]) && (tdx > 0) && (tdx < 15)) {
      swap(&paramArr[tdx], &paramArr[tdx - 1]);
      tdx--;
    }
    sdx++;
    tdx = sdx + 1;
  }
}


x86 assembly (clang, -O0):
<insertion_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xf,-0x14(%rbp)
jge    11e6 <insertion_sort+0xd6>
jmp    1142 <insertion_sort+0x32>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rsi
xor    %eax,%eax
cmp    (%rdx,%rsi,4),%ecx
mov    %al,-0x15(%rbp)
jge    1181 <insertion_sort+0x71>
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x15(%rbp)
jle    1181 <insertion_sort+0x71>
cmpl   $0xf,-0x10(%rbp)
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1191 <insertion_sort+0x81>
jmp    11c6 <insertion_sort+0xb6>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <swap@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <insertion_sort+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <insertion_sort+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertion_sort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x1,%r15d
xor    %r12d,%r12d
mov    %rdi,%r13
jmp    1142 <insertion_sort+0x32>
nopl   0x0(%rax)
add    $0x1,%r12
add    $0x1,%r15
add    $0x4,%r13
cmp    $0xf,%r12
je     1185 <insertion_sort+0x75>
mov    (%r14,%r15,4),%eax
cmp    -0x4(%r14,%r15,4),%eax
jge    1130 <insertion_sort+0x20>
mov    %r13,%rbx
mov    %r12,%rbp
cmp    $0xe,%r15
ja     1130 <insertion_sort+0x20>
nopl   0x0(%rax)
lea    0x4(%rbx),%rdi
mov    %rbx,%rsi
call   1030 <swap@plt>
mov    (%rbx),%eax
cmp    -0x4(%rbx),%eax
jge    1130 <insertion_sort+0x20>
lea    -0x1(%rbp),%rax
add    $0xfffffffffffffffc,%rbx
test   %rbp,%rbp
mov    %rax,%rbp
jg     1160 <insertion_sort+0x50>
jmp    1130 <insertion_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @insertion_sort(i32* %0) {
br label %2
2: ; preds = %1, %27
%3 = phi i64 [ 1, %1 ], [ %29, %27 ]
%4 = phi i64 [ 0, %1 ], [ %28, %27 ]
%5 = getelementptr inbounds i32, i32* %0, i64 %3
%6 = load i32, i32* %5
%7 = add nsw i64 %3, -1
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = icmp slt i32 %6, %9
%11 = icmp ult i64 %3, 15
%12 = select i1 %10, i1 %11, i1 false
br i1 %12, label %14, label %27
13: ; preds = %27
ret void
14: ; preds = %2, %14
%15 = phi i64 [ %21, %14 ], [ %4, %2 ]
%16 = phi i32* [ %22, %14 ], [ %8, %2 ]
%17 = phi i32* [ %19, %14 ], [ %5, %2 ]
%18 = tail call i32 @swap(i32* %17, i32* %16)
%19 = getelementptr inbounds i32, i32* %0, i64 %15
%20 = load i32, i32* %19
%21 = add nsw i64 %15, -1
%22 = getelementptr inbounds i32, i32* %0, i64 %21
%23 = load i32, i32* %22
%24 = icmp slt i32 %20, %23
%25 = icmp sgt i64 %15, 0
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %14, label %27
27: ; preds = %14, %2
%28 = add nuw nsw i64 %4, 1
%29 = add nuw nsw i64 %3, 1
%30 = icmp eq i64 %28, 15
br i1 %30, label %13, label %2
}