#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 atoi(char *);
int /*<<< orphan*/ check_is_inc_arr(int *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ initArr(int *, int, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ print_arr(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quick_sort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ srand(int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  if (argc != 4) {
    printf("input array length and the random value range.\n");
    exit(0);
  }
  srand((int)time(NULL));
  int length = atoi(argv[1]);
  int lowV = atoi(argv[2]);
  int upV = atoi(argv[3]);
  int *arr = (int *)malloc(sizeof(int) * (length));
  initArr(arr, lowV, upV, length);
  print_arr(arr, length);
  quick_sort(arr, 0, length - 1);
  print_arr(arr, length);
  check_is_inc_arr(arr, length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11d3 <main+0x33>
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1080 <initArr@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <print_arr@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1090 <quick_sort@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <print_arr@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10c0 <check_is_inc_arr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    123b <main+0x9b>
mov    %rsi,%r14
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    0x8(%r14),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r14),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%r14),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
lea    0x0(,%rbx,4),%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1080 <initArr@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
call   1040 <print_arr@plt>
lea    -0x1(%rbx),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1090 <quick_sort@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
call   1040 <print_arr@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
call   10c0 <check_is_inc_arr@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdbe(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"input array length and the random value range.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 4
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %2
%16 = call i64 @time(i32* null)
%17 = trunc i64 %16 to i32
%18 = call i32 @srand(i32 %17)
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %7
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %8
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = mul i64 4, %32
%34 = trunc i64 %33 to i32
%35 = call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to i32*
store i32* %36, i32** %9
%37 = load i32*, i32** %9
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = load i32, i32* %6
%41 = call i32 @initArr(i32* %37, i32 %38, i32 %39, i32 %40)
%42 = load i32*, i32** %9
%43 = load i32, i32* %6
%44 = call i32 @print_arr(i32* %42, i32 %43)
%45 = load i32*, i32** %9
%46 = load i32, i32* %6
%47 = sub nsw i32 %46, 1
%48 = call i32 @quick_sort(i32* %45, i32 0, i32 %47)
%49 = load i32*, i32** %9
%50 = load i32, i32* %6
%51 = call i32 @print_arr(i32* %49, i32 %50)
%52 = load i32*, i32** %9
%53 = load i32, i32* %6
%54 = call i32 @check_is_inc_arr(i32* %52, i32 %53)
ret i32 0
}

LLVM IR (-O2):
@str = [47 x i8] c"input array length and the random value range.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %2
%8 = tail call i64 @time(i32* null)
%9 = trunc i64 %8 to i32
%10 = tail call i32 @srand(i32 %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = shl i32 %13, 2
%21 = tail call i64 @malloc(i32 %20)
%22 = inttoptr i64 %21 to i32*
%23 = tail call i32 @initArr(i32* %22, i32 %16, i32 %19, i32 %13)
%24 = tail call i32 @print_arr(i32* %22, i32 %13)
%25 = add nsw i32 %13, -1
%26 = tail call i32 @quick_sort(i32* %22, i32 0, i32 %25)
%27 = tail call i32 @print_arr(i32* %22, i32 %13)
%28 = tail call i32 @check_is_inc_arr(i32* %22, i32 %13)
ret i32 0
}