#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, int *);
void insertionSort(int size, int *numbers) {
  int i, j, tmp;
  for (i = 1; i < size; i++) {
    j = i;
    while (j > 0 && numbers[j] < numbers[j - 1]) {
      swap(j, j - 1, numbers);
      j--;
    }
  }
}


x86 assembly (clang, -O0):
<insertionSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ab <insertionSort+0x9b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
jle    1168 <insertionSort+0x58>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
setl   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1178 <insertionSort+0x68>
jmp    1198 <insertionSort+0x88>
mov    -0x18(%rbp),%edi
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
call   1030 <swap@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <insertionSort+0x28>
jmp    119d <insertionSort+0x8d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <insertionSort+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertionSort>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%edi
jl     1164 <insertionSort+0x54>
mov    %rsi,%r15
mov    %edi,%r14d
mov    $0x1,%r12d
jmp    1139 <insertionSort+0x29>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %r14d,%r12d
je     1164 <insertionSort+0x54>
mov    %r12d,%ebx
nopl   0x0(%rax)
mov    %ebx,%eax
mov    (%r15,%rax,4),%eax
lea    -0x1(%rbx),%ebp
cmp    (%r15,%rbp,4),%eax
jge    1130 <insertionSort+0x20>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15,%rdx
call   1030 <swap@plt>
cmp    $0x1,%ebx
mov    %ebp,%ebx
jg     1140 <insertionSort+0x30>
jmp    1130 <insertionSort+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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