#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 __VERIFIER_nondet_int();
scalar_t__ alloca(int);
int /*<<< orphan*/ insertionSort(int *, int);
int main() {
  int array_size = __VERIFIER_nondet_int();
  if (array_size < 1 || array_size >= 2147483647 / sizeof(int)) {
    array_size = 1;
  }
  int *a = (int *)alloca(array_size * sizeof(int));
  for (int i = 0; i < array_size; i++) {
    a[i] = __VERIFIER_nondet_int();
  }
  insertionSort(a, array_size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     1163 <main+0x33>
movslq -0x8(%rbp),%rax
cmp    $0x1fffffff,%rax
jb     116a <main+0x3a>
movl   $0x1,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b2 <main+0x82>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1184 <main+0x54>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <insertionSort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
lea    -0x1fffffff(%rax),%ecx
cmp    $0xe0000002,%ecx
mov    $0x1,%r14d
cmovae %eax,%r14d
lea    0x0(,%r14,4),%edi
call   1030 <alloca@plt>
mov    %rax,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1170 <main+0x40>
mov    %r15,%rdi
mov    %r14d,%esi
call   1050 <insertionSort@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1
br i1 %7, label %12, label %8
8: ; preds = %0
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = icmp uge i64 %10, 536870911
br i1 %11, label %12, label %13
12: ; preds = %8, %0
store i32 1, i32* %2
br label %13
13: ; preds = %12, %8
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 4
%17 = trunc i64 %16 to i32
%18 = call i64 @alloca(i32 %17)
%19 = inttoptr i64 %18 to i32*
store i32* %19, i32** %3
store i32 0, i32* %4
br label %20
20: ; preds = %30, %13
%21 = load i32, i32* %4
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = call i32 (...) @__VERIFIER_nondet_int()
%26 = load i32*, i32** %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
store i32 %25, i32* %29
br label %30
30: ; preds = %24
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %20
33: ; preds = %20
%34 = load i32*, i32** %3
%35 = load i32, i32* %2
%36 = call i32 @insertionSort(i32* %34, i32 %35)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = add i32 %1, -536870911
%3 = icmp ult i32 %2, -536870910
%4 = select i1 %3, i32 1, i32 %1
%5 = shl nuw nsw i32 %4, 2
%6 = tail call i64 @alloca(i32 %5)
%7 = inttoptr i64 %6 to i32*
%8 = zext i32 %4 to i64
br label %11
9: ; preds = %11
%10 = tail call i32 @insertionSort(i32* %7, i32 %4)
ret i32 0
11: ; preds = %0, %11
%12 = phi i64 [ 0, %0 ], [ %15, %11 ]
%13 = tail call i32 (...) @__VERIFIER_nondet_int()
%14 = getelementptr inbounds i32, i32* %7, i64 %12
store i32 %13, i32* %14
%15 = add nuw nsw i64 %12, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %9, label %11
}