#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 */
void *atoi(char *);
int /*<<< orphan*/ check_arr_increase(int *, unsigned int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ initArr(int *, int, int, unsigned int);
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sortLoop(int *, unsigned int);
int main(int argc, char **argv) {
  if (argc != 4) {
    printf("usage: ./execfile lowV upV len\n");
    return 0;
  }
  int lowV = atoi(argv[1]);
  int upV = atoi(argv[2]);
  unsigned int len = atoi(argv[3]);
  int *arr = NULL;
  arr = (int *)malloc(len * sizeof(int));
  initArr(arr, lowV, upV, len);
  sortLoop(arr, len);
  check_arr_increase(arr, len);
  free(arr);
  arr = NULL;
  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     11a8 <main+0x38>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1234 <main+0xc4>
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)
movq   $0x0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1080 <initArr@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <sortLoop@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <check_arr_increase@plt>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    11e4 <main+0x74>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1090 <atoi@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1090 <atoi@plt>
mov    %rax,%r15
mov    0x18(%rbx),%rdi
call   1090 <atoi@plt>
mov    %rax,%r12
lea    0x0(,%rax,4),%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %r12d,%ecx
call   1080 <initArr@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
call   1060 <sortLoop@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
call   1030 <check_arr_increase@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
jmp    11f0 <main+0x80>
lea    0xe15(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"usage: ./execfile lowV upV len\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 %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %49
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i8* @atoi(i8* %17)
%19 = ptrtoint i8* %18 to i32
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i8* @atoi(i8* %22)
%24 = ptrtoint i8* %23 to i32
store i32 %24, i32* %7
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 3
%27 = load i8*, i8** %26
%28 = call i8* @atoi(i8* %27)
%29 = ptrtoint i8* %28 to i32
store i32 %29, i32* %8
store i32* null, i32** %9
%30 = load i32, i32* %8
%31 = zext i32 %30 to i64
%32 = mul i64 %31, 4
%33 = trunc i64 %32 to i32
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to i32*
store i32* %35, i32** %9
%36 = load i32*, i32** %9
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = call i32 @initArr(i32* %36, i32 %37, i32 %38, i32 %39)
%41 = load i32*, i32** %9
%42 = load i32, i32* %8
%43 = call i32 @sortLoop(i32* %41, i32 %42)
%44 = load i32*, i32** %9
%45 = load i32, i32* %8
%46 = call i32 @check_arr_increase(i32* %44, i32 %45)
%47 = load i32*, i32** %9
%48 = call i32 @free(i32* %47)
store i32* null, i32** %9
store i32 0, i32* %3
br label %49
49: ; preds = %14, %12
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@str = [31 x i8] c"usage: ./execfile lowV upV len\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %29
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i8* @atoi(i8* %8)
%10 = ptrtoint i8* %9 to i64
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i8* @atoi(i8* %13)
%15 = ptrtoint i8* %14 to i64
%16 = trunc i64 %15 to i32
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call i8* @atoi(i8* %18)
%20 = ptrtoint i8* %19 to i64
%21 = trunc i64 %20 to i32
%22 = shl i32 %21, 2
%23 = tail call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i32*
%25 = tail call i32 @initArr(i32* %24, i32 %11, i32 %16, i32 %21)
%26 = tail call i32 @sortLoop(i32* %24, i32 %21)
%27 = tail call i32 @check_arr_increase(i32* %24, i32 %21)
%28 = tail call i32 @free(i32* %24)
br label %29
29: ; preds = %6, %4
ret i32 0
}