#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 */
typedef int /*<<< orphan*/ file4;
typedef int /*<<< orphan*/ file3;
typedef int /*<<< orphan*/ file2;
typedef int /*<<< orphan*/ file1;

/* Variables and functions */
int /*<<< orphan*/ create_data(char *, int);
int /*<<< orphan*/ delete_file(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printClusters(char *);
int /*<<< orphan*/ printFileMetadata(char *);
int /*<<< orphan*/ read_file(char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usage();
int /*<<< orphan*/ write_file(char *, int, char *);
int main(int argc, const char *argv[]) {
  char file1[1000];
  char file2[2000];
  char file3[3000];
  char file4[4000];
  create_data(file1, sizeof(file1));
  create_data(file2, sizeof(file2));
  create_data(file3, sizeof(file3));
  create_data(file4, sizeof(file4));
  if (argc > 1)
    usage();
  write_file("file1.txt", sizeof(file1), file1);
  write_file("file2.txt", sizeof(file2), file2);
  write_file("file3.txt", sizeof(file3), file3);
  delete_file("file2.txt");
  write_file("file4.txt", sizeof(file4), file4);
  printClusters("file1.txt");
  printClusters("file2.txt");
  printClusters("file3.txt");
  printClusters("file4.txt");
  fprintf(stdout, "-- FILE DIRECTORY --\n");
  printFileMetadata("file1.txt");
  printFileMetadata("file2.txt");
  printFileMetadata("file3.txt");
  printFileMetadata("file4.txt");
  fprintf(stdout, "\n");
  read_file("file1.txt");
  read_file("file2.txt");
  read_file("file3.txt");
  read_file("file4.txt");
  fprintf(stdout, "\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   10a0 <create_data@plt>
lea    -0xbd0(%rbp),%rdi
mov    $0x7d0,%esi
call   10a0 <create_data@plt>
lea    -0x1790(%rbp),%rdi
mov    $0xbb8,%esi
call   10a0 <create_data@plt>
lea    -0x2730(%rbp),%rdi
mov    $0xfa0,%esi
call   10a0 <create_data@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11ee <main+0x6e>
mov    $0x0,%al
call   1080 <usage@plt>
lea    -0x400(%rbp),%rdx
lea    0xe04(%rip),%rdi
mov    $0x3e8,%esi
call   1050 <write_file@plt>
lea    -0xbd0(%rbp),%rdx
lea    0xdf6(%rip),%rdi
mov    $0x7d0,%esi
call   1050 <write_file@plt>
lea    -0x1790(%rbp),%rdx
lea    0xde8(%rip),%rdi
mov    $0xbb8,%esi
call   1050 <write_file@plt>
lea    0xdcd(%rip),%rdi
call   1030 <delete_file@plt>
lea    -0x2730(%rbp),%rdx
lea    0xdce(%rip),%rdi
mov    $0xfa0,%esi
call   1050 <write_file@plt>
lea    0xd9f(%rip),%rdi
call   1090 <printClusters@plt>
lea    0xd9d(%rip),%rdi
call   1090 <printClusters@plt>
lea    0xd9b(%rip),%rdi
call   1090 <printClusters@plt>
lea    0xd99(%rip),%rdi
call   1090 <printClusters@plt>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
lea    0xd8e(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xd5a(%rip),%rdi
call   1040 <printFileMetadata@plt>
lea    0xd58(%rip),%rdi
call   1040 <printFileMetadata@plt>
lea    0xd56(%rip),%rdi
call   1040 <printFileMetadata@plt>
lea    0xd54(%rip),%rdi
call   1040 <printFileMetadata@plt>
mov    0x2d0a(%rip),%rax
mov    (%rax),%edi
lea    0xd5d(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xd15(%rip),%rdi
call   1070 <read_file@plt>
lea    0xd13(%rip),%rdi
call   1070 <read_file@plt>
lea    0xd11(%rip),%rdi
call   1070 <read_file@plt>
lea    0xd0f(%rip),%rdi
call   1070 <read_file@plt>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
lea    0xd18(%rip),%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2728,%rsp
mov    %edi,%ebx
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   10a0 <create_data@plt>
lea    0x3f0(%rsp),%rdi
mov    $0x7d0,%esi
call   10a0 <create_data@plt>
lea    0xbc0(%rsp),%rdi
mov    $0xbb8,%esi
call   10a0 <create_data@plt>
lea    0x1780(%rsp),%rdi
mov    $0xfa0,%esi
call   10a0 <create_data@plt>
cmp    $0x2,%ebx
jl     11e2 <main+0x62>
xor    %eax,%eax
call   1080 <usage@plt>
lea    0xe17(%rip),%r14
mov    %rsp,%rdx
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1050 <write_file@plt>
lea    0xe0a(%rip),%r13
lea    0x3f0(%rsp),%rdx
mov    %r13,%rdi
mov    $0x7d0,%esi
call   1050 <write_file@plt>
lea    0xdf8(%rip),%r15
lea    0xbc0(%rsp),%rdx
mov    %r15,%rdi
mov    $0xbb8,%esi
call   1050 <write_file@plt>
mov    %r13,%rdi
call   1030 <delete_file@plt>
lea    0xdde(%rip),%r12
lea    0x1780(%rsp),%rdx
mov    %r12,%rdi
mov    $0xfa0,%esi
call   1050 <write_file@plt>
mov    %r14,%rdi
call   1090 <printClusters@plt>
mov    %r13,%rdi
call   1090 <printClusters@plt>
mov    %r15,%rdi
call   1090 <printClusters@plt>
mov    %r12,%rdi
call   1090 <printClusters@plt>
mov    0x2d64(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xda2(%rip),%rsi
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1040 <printFileMetadata@plt>
mov    %r13,%rdi
call   1040 <printFileMetadata@plt>
mov    %r15,%rdi
call   1040 <printFileMetadata@plt>
mov    %r12,%rdi
call   1040 <printFileMetadata@plt>
mov    0x0(%rbp),%edi
lea    0xd87(%rip),%rbx
mov    %rbx,%rsi
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1070 <read_file@plt>
mov    %r13,%rdi
call   1070 <read_file@plt>
mov    %r15,%rdi
call   1070 <read_file@plt>
mov    %r12,%rdi
call   1070 <read_file@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"file1.txt\00"
@.str.1 = [10 x i8] c"file2.txt\00"
@.str.2 = [10 x i8] c"file3.txt\00"
@.str.3 = [10 x i8] c"file4.txt\00"
@stdout = global i32 0
@.str.4 = [22 x i8] c"-- FILE DIRECTORY --\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i8]
%7 = alloca [2000 x i8]
%8 = alloca [3000 x i8]
%9 = alloca [4000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%11 = call i32 @create_data(i8* %10, i32 1000)
%12 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%13 = call i32 @create_data(i8* %12, i32 2000)
%14 = getelementptr inbounds [3000 x i8], [3000 x i8]* %8, i64 0, i64 0
%15 = call i32 @create_data(i8* %14, i32 3000)
%16 = getelementptr inbounds [4000 x i8], [4000 x i8]* %9, i64 0, i64 0
%17 = call i32 @create_data(i8* %16, i32 4000)
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @usage()
br label %22
22: ; preds = %20, %2
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%24 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1000, i8* %23)
%25 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%26 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 2000, i8* %25)
%27 = getelementptr inbounds [3000 x i8], [3000 x i8]* %8, i64 0, i64 0
%28 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 3000, i8* %27)
%29 = call i32 @delete_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%30 = getelementptr inbounds [4000 x i8], [4000 x i8]* %9, i64 0, i64 0
%31 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 4000, i8* %30)
%32 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%33 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%36 = load i32, i32* @stdout
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%38 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%39 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* @stdout
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%44 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%45 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%46 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%47 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%48 = load i32, i32* @stdout
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"file1.txt\00"
@.str.1 = [10 x i8] c"file2.txt\00"
@.str.2 = [10 x i8] c"file3.txt\00"
@.str.3 = [10 x i8] c"file4.txt\00"
@stdout = global i32 0
@.str.4 = [22 x i8] c"-- FILE DIRECTORY --\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x i8]
%4 = alloca [2000 x i8]
%5 = alloca [3000 x i8]
%6 = alloca [4000 x i8]
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [3000 x i8], [3000 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [4000 x i8], [4000 x i8]* %6, i64 0, i64 0
%11 = call i32 @create_data(i8* %7, i32 1000)
%12 = call i32 @create_data(i8* %8, i32 2000)
%13 = call i32 @create_data(i8* %9, i32 3000)
%14 = call i32 @create_data(i8* %10, i32 4000)
%15 = icmp sgt i32 %0, 1
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (...) @usage()
br label %18
18: ; preds = %16, %2
%19 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1000, i8* %7)
%20 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 2000, i8* %8)
%21 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 3000, i8* %9)
%22 = call i32 @delete_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @write_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 4000, i8* %10)
%24 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @printClusters(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* @stdout
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 @printFileMetadata(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%34 = load i32, i32* @stdout
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%37 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 @read_file(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* @stdout
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}