#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*/ bucket_sort(int *, int);
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*/ printf(char *);
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));
  int i = 1000;
  for (; i > 0; i--) {
    initArr(arr, lowV, upV, length);
    bucket_sort(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     11c3 <main+0x33>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x3e8,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    125f <main+0xcf>
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   1050 <bucket_sort@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10b0 <check_is_inc_arr@plt>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    121d <main+0x8d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x4,%edi
jne    122a <main+0x9a>
mov    %rsi,%rbp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    0x8(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%r12d
mov    0x10(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%r15d
mov    %r12d,%edi
shl    $0x2,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    $0x3e9,%ebx
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %r12d,%ecx
call   1080 <initArr@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
call   1050 <bucket_sort@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
call   10b0 <check_is_inc_arr@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     11f0 <main+0x60>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdcf(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <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*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 4
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %2
%17 = call i64 @time(i32* null)
%18 = trunc i64 %17 to i32
%19 = call i32 @srand(i32 %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %7
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %8
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = mul i64 4, %33
%35 = trunc i64 %34 to i32
%36 = call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i32*
store i32* %37, i32** %9
store i32 1000, i32* %10
br label %38
38: ; preds = %53, %16
%39 = load i32, i32* %10
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %56
41: ; preds = %38
%42 = load i32*, i32** %9
%43 = load i32, i32* %7
%44 = load i32, i32* %8
%45 = load i32, i32* %6
%46 = call i32 @initArr(i32* %42, i32 %43, i32 %44, i32 %45)
%47 = load i32*, i32** %9
%48 = load i32, i32* %6
%49 = call i32 @bucket_sort(i32* %47, i32 %48)
%50 = load i32*, i32** %9
%51 = load i32, i32* %6
%52 = call i32 @check_is_inc_arr(i32* %50, i32 %51)
br label %53
53: ; preds = %41
%54 = load i32, i32* %10
%55 = add nsw i32 %54, -1
store i32 %55, i32* %10
br label %38
56: ; preds = %38
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*
br label %23
23: ; preds = %7, %23
%24 = phi i32 [ 1000, %7 ], [ %28, %23 ]
%25 = tail call i32 @initArr(i32* %22, i32 %16, i32 %19, i32 %13)
%26 = tail call i32 @bucket_sort(i32* %22, i32 %13)
%27 = tail call i32 @check_is_inc_arr(i32* %22, i32 %13)
%28 = add nsw i32 %24, -1
%29 = icmp ugt i32 %24, 1
br i1 %29, label %23, label %30
30: ; preds = %23
ret i32 0
}