#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 */
scalar_t__ legge(int **, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ quicksort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i, n, *A;
  if (legge(&A, &n))
    return 1;
  srand(time(NULL));
  quicksort(A, 0, n - 1);
  for (i = 0; i < n; i++)
    printf("%d ", A[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <legge@plt>
cmp    $0x0,%rax
je     1182 <main+0x32>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <main+0x92>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <quicksort@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11db <main+0x8b>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11aa <main+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1070 <legge@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    11ce <main+0x7e>
xor    %r14d,%r14d
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%edx
add    $0xffffffff,%edx
xor    %esi,%esi
call   1030 <quicksort@plt>
cmpl   $0x0,0x4(%rsp)
jle    11ce <main+0x7e>
xor    %r14d,%r14d
lea    0xe58(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
mov    (%rax,%rbx,4),%esi
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     11b0 <main+0x60>
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i64 @legge(i32** %4, i32* %3)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %1
br label %30
8: ; preds = %0
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
%11 = load i32*, i32** %4
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = call i32 @quicksort(i32* %11, i32 0, i32 %13)
store i32 0, i32* %2
br label %15
15: ; preds = %26, %8
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = load i32*, i32** %4
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %15
29: ; preds = %15
store i32 0, i32* %1
br label %30
30: ; preds = %29, %7
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32** %2 to i8*
%5 = call i64 @legge(i32** %2, i32* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %26
7: ; preds = %0
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = load i32*, i32** %2
%11 = load i32, i32* %1
%12 = add nsw i32 %11, -1
%13 = call i32 @quicksort(i32* %10, i32 0, i32 %12)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %7, %16
%17 = phi i64 [ %22, %16 ], [ 0, %7 ]
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i64 %17
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i64 %17, 1
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %16, label %26
26: ; preds = %16, %7, %0
%27 = phi i32 [ 1, %0 ], [ 0, %7 ], [ 0, %16 ]
ret i32 %27
}