#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*/ CreateInitFile(char *, int, char **, int /*<<< orphan*/ *);
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
int main(int argc, char *argv[]) {
  FILE *file;
  FILE *fout;
  int numFiles = 0;
  char libName[250];
  char tmpVal[250];
  char *files[4000];
  if (argc < 3) {
    fprintf(stderr, "Usage: %s input_file output_file\n", argv[0]);
    return 1;
  }
  file = fopen(argv[1], "r");
  if (!file) {
    fprintf(stderr, "Input file %s could not be opened\n", argv[1]);
    return 1;
  }
  fout = fopen(argv[2], "w");
  if (!fout) {
    fclose(file);
    return 1;
  }
  fscanf(file, "%s", libName);
  while (fscanf(file, "%s", tmpVal) != EOF) {
    files[numFiles] = strdup(tmpVal);
    numFiles++;
  }
  fclose(file);
  if (strcmp(libName, "vtkCommonCorePython") == 0) {
    files[numFiles] = strdup("mutable");
    numFiles++;
  }
  CreateInitFile(libName, numFiles, files, fout);
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11c2 <main+0x52>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe4f(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1321 <main+0x1b1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe51(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    120e <main+0x9e>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe27(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1321 <main+0x1b1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe2a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1246 <main+0xd6>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1321 <main+0x1b1>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xdf1(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x220(%rbp),%rdx
lea    0xdda(%rip),%rsi
call   1050 <fscanf@plt>
mov    0x2d6d(%rip),%rcx
cmp    (%rcx),%rax
je     12ad <main+0x13d>
lea    -0x220(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
mov    %rcx,-0x7f20(%rbp,%rax,8)
ff
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    125d <main+0xed>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x120(%rbp),%rdi
lea    0xd88(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12f7 <main+0x187>
lea    0xd86(%rip),%rdi
call   1090 <strdup@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
mov    %rcx,-0x7f20(%rbp,%rax,8)
ff
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x7f20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <CreateInitFile@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7f20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7f08,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     11a1 <main+0x31>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe64(%rip),%rsi
jmp    12c2 <main+0x152>
mov    0x8(%rbx),%rdi
lea    0xe76(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     12ae <main+0x13e>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
lea    0xe7f(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     12de <main+0x16e>
mov    %rax,%r14
lea    0xe69(%rip),%rbx
mov    %rsp,%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <fscanf@plt>
lea    0x100(%rsp),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <fscanf@plt>
mov    0x2de0(%rip),%rbp
xor    %ebx,%ebx
cmp    0x0(%rbp),%rax
je     1258 <main+0xe8>
xor    %ebx,%ebx
lea    0x100(%rsp),%r12
lea    0xe28(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1090 <strdup@plt>
mov    %rax,0x200(%rsp,%rbx,8)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
cmp    0x0(%rbp),%rax
jne    1230 <main+0xc0>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xde5(%rip),%rsi
mov    %rsp,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    128d <main+0x11d>
lea    0xde5(%rip),%rdi
call   1090 <strdup@plt>
mov    %ebx,%ecx
mov    %rax,0x200(%rsp,%rcx,8)
add    $0x1,%ebx
mov    %rsp,%rdi
lea    0x200(%rsp),%rdx
mov    %ebx,%esi
mov    %r14,%rcx
call   1030 <CreateInitFile@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    12cc <main+0x15c>
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd62(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%eax
add    $0x7f08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
call   1040 <fclose@plt>
jmp    12c7 <main+0x157>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: %s input_file output_file\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [35 x i8] c"Input file %s could not be opened\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [20 x i8] c"vtkCommonCorePython\00"
@.str.6 = [8 x i8] c"mutable\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 [250 x i8]
%10 = alloca [250 x i8]
%11 = alloca [4000 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 1, i32* %3
br label %82
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = icmp ne i32* %25, null
br i1 %26, label %33, label %27
27: ; preds = %20
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %31)
store i32 1, i32* %3
br label %82
33: ; preds = %20
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %37, i32** %7
%38 = load i32*, i32** %7
%39 = icmp ne i32* %38, null
br i1 %39, label %43, label %40
40: ; preds = %33
%41 = load i32*, i32** %6
%42 = call i32 @fclose(i32* %41)
store i32 1, i32* %3
br label %82
43: ; preds = %33
%44 = load i32*, i32** %6
%45 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%46 = call i64 @fscanf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %53, %43
%48 = load i32*, i32** %6
%49 = getelementptr inbounds [250 x i8], [250 x i8]* %10, i64 0, i64 0
%50 = call i64 @fscanf(i32* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = load i64, i64* @EOF
%52 = icmp ne i64 %50, %51
br i1 %52, label %53, label %61
53: ; preds = %47
%54 = getelementptr inbounds [250 x i8], [250 x i8]* %10, i64 0, i64 0
%55 = call i8* @strdup(i8* %54)
%56 = load i32, i32* %8
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %11, i64 0, i64 %57
store i8* %55, i8** %58
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
store i32 %60, i32* %8
br label %47
61: ; preds = %47
%62 = load i32*, i32** %6
%63 = call i32 @fclose(i32* %62)
%64 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %74
67: ; preds = %61
%68 = call i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%69 = load i32, i32* %8
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %11, i64 0, i64 %70
store i8* %68, i8** %71
%72 = load i32, i32* %8
%73 = add nsw i32 %72, 1
store i32 %73, i32* %8
br label %74
74: ; preds = %67, %61
%75 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%76 = load i32, i32* %8
%77 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %11, i64 0, i64 0
%78 = load i32*, i32** %7
%79 = call i32 @CreateInitFile(i8* %75, i32 %76, i8** %77, i32* %78)
%80 = load i32*, i32** %7
%81 = call i32 @fclose(i32* %80)
store i32 0, i32* %3
br label %82
82: ; preds = %74, %40, %27, %14
%83 = load i32, i32* %3
ret i32 %83
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: %s input_file output_file\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [35 x i8] c"Input file %s could not be opened\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [20 x i8] c"vtkCommonCorePython\00"
@.str.6 = [8 x i8] c"mutable\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [250 x i8]
%4 = alloca [250 x i8]
%5 = alloca [4000 x i8*]
%6 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [250 x i8], [250 x i8]* %4, i64 0, i64 0
%8 = bitcast [4000 x i8*]* %5 to i8*
%9 = icmp slt i32 %0, 3
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %60
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %15
%22 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %60
23: ; preds = %14
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = tail call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = tail call i32 @fclose(i32* %17)
br label %60
30: ; preds = %23
%31 = call i64 @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%32 = call i64 @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%33 = load i64, i64* @EOF
%34 = icmp eq i64 %32, %33
br i1 %34, label %45, label %35
35: ; preds = %30, %35
%36 = phi i64 [ %39, %35 ], [ 0, %30 ]
%37 = call i8* @strdup(i8* %7)
%38 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %5, i64 0, i64 %36
store i8* %37, i8** %38
%39 = add nuw i64 %36, 1
%40 = call i64 @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%41 = load i64, i64* @EOF
%42 = icmp eq i64 %40, %41
br i1 %42, label %43, label %35
43: ; preds = %35
%44 = trunc i64 %39 to i32
br label %45
45: ; preds = %43, %30
%46 = phi i32 [ 0, %30 ], [ %44, %43 ]
%47 = call i32 @fclose(i32* %17)
%48 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %45
%51 = call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%52 = zext i32 %46 to i64
%53 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %5, i64 0, i64 %52
store i8* %51, i8** %53
%54 = add nuw nsw i32 %46, 1
br label %55
55: ; preds = %50, %45
%56 = phi i32 [ %54, %50 ], [ %46, %45 ]
%57 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %5, i64 0, i64 0
%58 = call i32 @CreateInitFile(i8* %6, i32 %56, i8** %57, i32* %26)
%59 = call i32 @fclose(i32* %26)
br label %60
60: ; preds = %55, %28, %19, %10
%61 = phi i32 [ 1, %10 ], [ 0, %55 ], [ 1, %28 ], [ 1, %19 ]
ret i32 %61
}