#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 buildSuffixArraysInMem(char *, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int main(int argc, char *argv[]) {
  char inputFileNamePrefix[500];
  int algorithmType = 1;
  int result;
  int totalInputFiles;
  if (argc < 3) {
    printf("./sortsasimple <inputfilenamefullpathprefix> <total_files> \n");
    return 1;
  }
  sprintf(inputFileNamePrefix, "%s", argv[1]);
  totalInputFiles = atoi(argv[2]);
  result = buildSuffixArraysInMem(inputFileNamePrefix, algorithmType,
                                  totalInputFiles);
  if (result != 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x214(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1185 <main+0x45>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <main+0xb1>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xea2(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x21c(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
mov    -0x21c(%rbp),%edx
call   1050 <buildSuffixArraysInMem@plt>
mov    %eax,-0x218(%rbp)
cmpl   $0x0,-0x218(%rbp)
je     11ea <main+0xaa>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <main+0xb1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1f8,%rsp
cmp    $0x2,%edi
jg     1162 <main+0x22>
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
jmp    1195 <main+0x55>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1060 <buildSuffixArraysInMem@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
add    $0x1f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [61 x i8] c"./sortsasimple <inputfilenamefullpathprefix> <total_files> \0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [500 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %32
14: ; preds = %2
%15 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %9
%24 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%25 = load i32, i32* %7
%26 = load i32, i32* %9
%27 = call i32 @buildSuffixArraysInMem(i8* %24, i32 %25, i32 %26)
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %14
store i32 1, i32* %3
br label %32
31: ; preds = %14
store i32 0, i32* %3
br label %32
32: ; preds = %31, %30, %12
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@str = [60 x i8] c"./sortsasimple <inputfilenamefullpathprefix> <total_files> \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [500 x i8]
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
br label %18
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i8* @strcpy(i8* %4, i8* dereferenceable(1) %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
%15 = call i32 @buildSuffixArraysInMem(i8* %4, i32 1, i32 %14)
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %8, %6
%19 = phi i32 [ 1, %6 ], [ %17, %8 ]
ret i32 %19
}