#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 buildSuffixArraysForAllFiles(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int main(int argc, char *argv[]) {
  char inputFileNamePrefix[500];
  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 = buildSuffixArraysForAllFiles(inputFileNamePrefix, 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)
cmpl   $0x3,-0x8(%rbp)
jge    117b <main+0x3b>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <main+0xa1>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xeac(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x218(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%esi
call   1040 <buildSuffixArraysForAllFiles@plt>
mov    %eax,-0x214(%rbp)
cmpl   $0x0,-0x214(%rbp)
je     11da <main+0x9a>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <main+0xa1>
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    1190 <main+0x50>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <buildSuffixArraysForAllFiles@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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %30
13: ; preds = %2
%14 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %8
%23 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%24 = load i32, i32* %8
%25 = call i32 @buildSuffixArraysForAllFiles(i8* %23, i32 %24)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %13
store i32 1, i32* %3
br label %30
29: ; preds = %13
store i32 0, i32* %3
br label %30
30: ; preds = %29, %28, %11
%31 = load i32, i32* %3
ret i32 %31
}

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 @buildSuffixArraysForAllFiles(i8* %4, 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
}