#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void main() {
  FILE *fptr, *fptr1, *fptr2;
  int num;
  int i;
  fptr = fopen("IdentifyControllerDataStructure.txt", "w");
  fptr1 = fopen("IdentifyNamespaceDataStructure.txt", "w");
  fptr2 = fopen("LBARangeDataStructure.txt", "w");
  if (fptr == NULL) {
    printf(" FILE does not exist ");
    return;
  }
  for (i = 0; i < 1024; i++) {
    fprintf(fptr, "%x\n ", 0);
    fprintf(fptr1, "%x\n ", 0);
    fprintf(fptr2, "%x\n ", 0);
  }
  fclose(fptr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
lea    0xece(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xec0(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xecc(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11a9 <main+0x69>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
jmp    120a <main+0xca>
movl   $0x0,-0x20(%rbp)
cmpl   $0x400,-0x20(%rbp)
jge    1201 <main+0xc1>
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
xor    %edx,%edx
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
xor    %edx,%edx
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe8d(%rip),%rsi
xor    %edx,%edx
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b0 <main+0x70>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xeb1(%rip),%rdi
lea    0xece(%rip),%rbx
mov    %rbx,%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
call   1060 <fopen@plt>
test   %r14,%r14
je     11dc <main+0x9c>
mov    %rax,%r12
mov    $0x400,%ebp
lea    0xee3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <fprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <fprintf@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x60>
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>
lea    0xe80(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"IdentifyControllerDataStructure.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [35 x i8] c"IdentifyNamespaceDataStructure.txt\00"
@.str.3 = [26 x i8] c"LBARangeDataStructure.txt\00"
@.str.4 = [22 x i8] c" FILE does not exist \00"
@.str.5 = [5 x i8] c"%x\0A \00"
define void @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = call i32* @fopen(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
%8 = call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %3
%9 = load i32*, i32** %1
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %30
13: ; preds = %0
store i32 0, i32* %5
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 1024
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32*, i32** %1
%19 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 0)
%20 = load i32*, i32** %2
%21 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 0)
%22 = load i32*, i32** %3
%23 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 0)
br label %24
24: ; preds = %17
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %14
27: ; preds = %14
%28 = load i32*, i32** %1
%29 = call i32 @fclose(i32* %28)
br label %30
30: ; preds = %27, %11
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"IdentifyControllerDataStructure.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [35 x i8] c"IdentifyNamespaceDataStructure.txt\00"
@.str.3 = [26 x i8] c"LBARangeDataStructure.txt\00"
@.str.4 = [22 x i8] c" FILE does not exist \00"
@.str.5 = [5 x i8] c"%x\0A \00"
define void @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %1, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %16
7: ; preds = %0, %7
%8 = phi i32 [ %12, %7 ], [ 0, %0 ]
%9 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 0)
%10 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 0)
%11 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 0)
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, 1024
br i1 %13, label %14, label %7
14: ; preds = %7
%15 = tail call i32 @fclose(i32* %1)
br label %16
16: ; preds = %14, %5
ret void
}