#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*/ checkAscending(int *, int);
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *);
int randomIntArray(int **, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ sort(int *, int /*<<< orphan*/, int);
int main() {
  int numbers[] = {0};
  int size = randomIntArray(&numbers, 200, 0, 1000);
  printArray(numbers, size);
  checkAscending(numbers, size);
  printf("After sorting:\n***********************\n");
  sort(numbers, 0, size - 1);
  printArray(numbers, size);
  checkAscending(numbers, size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    -0x8(%rbp),%rdi
mov    $0xc8,%esi
xor    %edx,%edx
mov    $0x3e8,%ecx
call   1030 <randomIntArray@plt>
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <printArray@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <checkAscending@plt>
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1050 <sort@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <printArray@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <checkAscending@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    %r14,%rdi
mov    $0xc8,%esi
xor    %edx,%edx
mov    $0x3e8,%ecx
call   1030 <randomIntArray@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printArray@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1070 <checkAscending@plt>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
lea    -0x1(%rbx),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <sort@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <printArray@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1070 <checkAscending@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [40 x i8] c"After sorting:\0A***********************\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [1 x i32]* %2 to i8*
%5 = bitcast [1 x i32]* %2 to i32**
%6 = call i32 @randomIntArray(i32** %5, i32 200, i32 0, i32 1000)
store i32 %6, i32* %3
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call i32 @printArray(i32* %7, i32 %8)
%10 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%11 = load i32, i32* %3
%12 = call i32 @checkAscending(i32* %10, i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, 1
%17 = call i32 @sort(i32* %14, i32 0, i32 %16)
%18 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%19 = load i32, i32* %3
%20 = call i32 @printArray(i32* %18, i32 %19)
%21 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%22 = load i32, i32* %3
%23 = call i32 @checkAscending(i32* %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@str = [39 x i8] c"After sorting:\0A***********************\00"
define i32 @main() {
%1 = alloca [1 x i32]
%2 = bitcast [1 x i32]* %1 to i8*
%3 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 0, i32* %3
%4 = bitcast [1 x i32]* %1 to i32**
%5 = call i32 @randomIntArray(i32** %4, i32 200, i32 0, i32 1000)
%6 = call i32 @printArray(i32* %3, i32 %5)
%7 = call i32 @checkAscending(i32* %3, i32 %5)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%9 = add nsw i32 %5, -1
%10 = call i32 @sort(i32* %3, i32 0, i32 %9)
%11 = call i32 @printArray(i32* %3, i32 %5)
%12 = call i32 @checkAscending(i32* %3, i32 %5)
ret i32 0
}