#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*/ lprintf(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ qsort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ qsort2(int *, int /*<<< orphan*/, int);
int main() {
  int array[] = {9, 2, 3, 4, 5, 6, 7, 10};
  int array2[] = {9, 2, 3, 4, 5, 6, 7, 10};
  lprintf(array, 8);
  printf("\n");
  qsort(array, 0, 7);
  printf("--------\n");
  lprintf(array, 8);
  printf("********************************\n\n");
  lprintf(array2, 8);
  printf("\n");
  qsort2(array2, 0, 7);
  printf("--------\n");
  lprintf(array2, 8);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe7b(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe78(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1060 <lprintf@plt>
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <qsort@plt>
lea    0xe48(%rip),%rdi
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1060 <lprintf@plt>
lea    0xe38(%rip),%rdi
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1060 <lprintf@plt>
lea    0xe3f(%rip),%rdi
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1030 <qsort2@plt>
lea    0xdf8(%rip),%rdi
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1060 <lprintf@plt>
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe96(%rip),%xmm1
movaps %xmm1,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm1,(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1070 <lprintf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1060 <qsort@plt>
lea    0xe98(%rip),%r14
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1070 <lprintf@plt>
lea    0xe5a(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1070 <lprintf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <qsort2@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1070 <lprintf@plt>
mov    $0x1,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.array = [8 x i32] [i32 9, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 10]
@__const.main.array2 = [8 x i32] [i32 9, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 10]
@.str = [2 x i8] c"\0A\00"
@.str.1 = [10 x i8] c"--------\0A\00"
@.str.2 = [35 x i8] c"********************************\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca [8 x i32]
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
%5 = bitcast [8 x i32]* %3 to i8*
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%7 = call i32 @lprintf(i32* %6, i32 8)
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%10 = call i32 @qsort(i32* %9, i32 0, i32 7)
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%13 = call i32 @lprintf(i32* %12, i32 8)
%14 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%16 = call i32 @lprintf(i32* %15, i32 8)
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%19 = call i32 @qsort2(i32* %18, i32 0, i32 7)
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%21 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%22 = call i32 @lprintf(i32* %21, i32 8)
ret i32 1
}

LLVM IR (-O2):
@__const.main.array2 = [8 x i32] [i32 9, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 10]
@str.3 = [34 x i8] c"********************************\0A\00"
@str.4 = [9 x i8] c"--------\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [8 x i32]
%3 = bitcast [8 x i32]* %1 to i8*
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%6 = call i32 @lprintf(i32* %5, i32 8)
%7 = call i32 @putchar(i32 10)
%8 = call i32 @qsort(i32* %5, i32 0, i32 7)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
%10 = call i32 @lprintf(i32* %5, i32 8)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0))
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%13 = call i32 @lprintf(i32* %12, i32 8)
%14 = call i32 @putchar(i32 10)
%15 = call i32 @qsort2(i32* %12, i32 0, i32 7)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
%17 = call i32 @lprintf(i32* %12, i32 8)
ret i32 1
}