#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 */
struct stat {
  scalar_t__ st_size;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
size_t fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stat(char *, struct stat *);
int main(int argc, char **argv) {
  FILE *fout;
  FILE *fin;
  int ii;
  int nbytes;
  struct stat astat;
  unsigned char c;
  unsigned char buf[1024];
  if (argc < 3) {
    printf("ERROR:  usage is: "
           "\"%s OUTPUT_FILE INPUT_FILE [...INPUT_FILES...]\"\n",
           argv[0]);
    return 1;
  }
  fout = fopen(argv[1], "w");
  if (!fout) {
    printf("ERROR: cannot open \"%s\" for output\n", argv[1]);
    return 1;
  }
  fprintf(fout, "struct embeded_file {\n    char * name;\n"
                "    int ndat;\n    char * dat;\n};\n");
  fprintf(fout, "const int n_flist = %d;\n", argc - 2);
  fprintf(fout, "struct embeded_file flist[] = {\n");
  for (ii = 2; ii < argc; ii++) {
    printf("  encoding:  \"%s\"\n", argv[ii]);
    if (!stat(argv[ii], &astat)) {
      nbytes = (int)(astat.st_size);
    } else {
      printf("    ERROR:  cannot stat() \"%s\"\n", argv[ii]);
      return 3;
    }
    fin = fopen(argv[ii], "r");
    if (!fin) {
      printf("    ERROR:  cannot fopen() \"%s\"\n", argv[ii]);
      return 4;
    }
    fprintf(fout, "  %s{ \"%s\", %d,", ((ii == 2) ? " " : ","), argv[ii],
            nbytes);
    while (fin) {
      size_t ir;
      size_t nread;
      nread = fread(buf, sizeof(char), 200, fin);
      if (nread < 1)
        break;
      fprintf(fout, "\n\"");
      for (ir = 0; ir < nread; ir++) {
        fprintf(fout, "\\x%02x", buf[ir]);
      }
      fprintf(fout, "\"");
    }
    fclose(fin);
    fprintf(fout, "  }\n");
  }
  fprintf(fout, "  };\n");
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11a2 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1429 <main+0x2c9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe92(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11e5 <main+0x85>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe71(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1429 <main+0x2c9>
mov    -0x18(%rbp),%rdi
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%edx
sub    $0x2,%edx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x2,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1407 <main+0x2a7>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xea5(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x30(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
jne    1276 <main+0x116>
mov    -0x30(%rbp),%rax
mov    %eax,-0x28(%rbp)
jmp    129a <main+0x13a>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe76(%rip),%rdi
call   1050 <printf@plt>
movl   $0x3,-0x4(%rbp)
jmp    1429 <main+0x2c9>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe72(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12e5 <main+0x185>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe4d(%rip),%rdi
call   1050 <printf@plt>
movl   $0x4,-0x4(%rbp)
jmp    1429 <main+0x2c9>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%ecx
lea    0xe5d(%rip),%rdx
lea    0xe58(%rip),%rax
cmp    $0x2,%ecx
cmove  %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x28(%rbp),%r8d
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpq   $0x0,-0x20(%rbp)
je     13de <main+0x27e>
lea    -0x440(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0xc8,%edx
call   1030 <fread@plt>
mov    %rax,-0x450(%rbp)
cmpq   $0x1,-0x450(%rbp)
01
jae    135e <main+0x1fe>
jmp    13de <main+0x27e>
mov    -0x18(%rbp),%rdi
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movq   $0x0,-0x448(%rbp)
mov    -0x448(%rbp),%rax
cmp    -0x450(%rbp),%rax
jae    13c7 <main+0x267>
mov    -0x18(%rbp),%rdi
mov    -0x448(%rbp),%rax
movzbl -0x440(%rbp,%rax,1),%edx
ff
lea    0xdae(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x448(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x448(%rbp)
jmp    137b <main+0x21b>
mov    -0x18(%rbp),%rdi
lea    0xd83(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    131f <main+0x1bf>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1228 <main+0xc8>
mov    -0x18(%rbp),%rdi
lea    0xd51(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jg     11a8 <main+0x28>
mov    (%r14),%rsi
lea    0xe5d(%rip),%rdi
jmp    1377 <main+0x1f7>
mov    %edi,%ebp
mov    0x8(%r14),%rdi
lea    0xe8e(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     136c <main+0x1ec>
mov    %rax,%rbx
lea    0xe9c(%rip),%rdi
mov    $0x48,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10a0 <fwrite@plt>
lea    -0x2(%rbp),%edx
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xed1(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    %ebp,%eax
mov    %rax,0x8(%rsp)
mov    $0x2,%r13d
lea    0xf37(%rip),%r15
mov    %r14,0x10(%rsp)
jmp    1265 <main+0xe5>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    $0x4,%esi
mov    $0x1,%edx
lea    0xf15(%rip),%rdi
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
add    $0x1,%r13
cmp    0x8(%rsp),%r13
mov    0x10(%rsp),%r14
je     13c1 <main+0x241>
mov    (%r14,%r13,8),%rsi
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
mov    (%r14,%r13,8),%rdi
lea    0x18(%rsp),%rsi
call   1080 <stat@plt>
test   %eax,%eax
jne    1393 <main+0x213>
mov    0x18(%rsp),%rbp
mov    (%r14,%r13,8),%rdi
lea    0xe84(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     13aa <main+0x22a>
mov    %rax,%r12
cmp    $0x2,%r13
lea    0xe99(%rip),%rdx
lea    0xe94(%rip),%rax
cmove  %rax,%rdx
mov    (%r14,%r13,8),%rcx
mov    %rbx,%rdi
lea    0xe72(%rip),%rsi
mov    %ebp,%r8d
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0xc8,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
test   %rax,%rax
je     1230 <main+0xb0>
mov    %rax,%r14
nopl   (%rax)
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe43(%rip),%rdi
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl 0x20(%rsp,%rbp,1),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1320 <main+0x1a0>
mov    $0x22,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0xc8,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1300 <main+0x180>
jmp    1230 <main+0xb0>
mov    0x8(%r14),%rsi
lea    0xcce(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14,%r13,8),%rsi
lea    0xd61(%rip),%rdi
call   1050 <printf@plt>
mov    $0x3,%eax
jmp    1381 <main+0x201>
mov    (%r14,%r13,8),%rsi
lea    0xd6c(%rip),%rdi
call   1050 <printf@plt>
mov    $0x4,%eax
jmp    1381 <main+0x201>
lea    0xd9b(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1381 <main+0x201>

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [67 x i8] c"ERROR: usage is: \22%s OUTPUT_FILE INPUT_FILE [...INPUT_FILES...]\22\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [36 x i8] c"ERROR: cannot open \22%s\22 for output\0A\00"
@.str.3 = [73 x i8] c"struct embeded_file {\0A char * name;\0A int ndat;\0A char * dat;\0A};\0A\00"
@.str.4 = [25 x i8] c"const int n_flist = %d;\0A\00"
@.str.5 = [33 x i8] c"struct embeded_file flist[] = {\0A\00"
@.str.6 = [19 x i8] c" encoding: \22%s\22\0A\00"
@.str.7 = [32 x i8] c" ERROR: cannot stat() \22%s\22\0A\00"
@.str.8 = [2 x i8] c"r\00"
@.str.9 = [33 x i8] c" ERROR: cannot fopen() \22%s\22\0A\00"
@.str.10 = [16 x i8] c" %s{ \22%s\22, %d,\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [2 x i8] c",\00"
@.str.13 = [3 x i8] c"\0A\22\00"
@.str.14 = [7 x i8] c"\\x%02x\00"
@.str.15 = [2 x i8] c"\22\00"
@.str.16 = [5 x i8] c" }\0A\00"
@.str.17 = [6 x i8] c" };\0A\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 i32
%10 = alloca %struct.stat
%11 = alloca i8
%12 = alloca [1024 x i8]
%13 = alloca i64
%14 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 1, i32* %3
br label %144
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %6
%27 = load i32*, i32** %6
%28 = icmp ne i32* %27, null
br i1 %28, label %34, label %29
29: ; preds = %22
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %32)
store i32 1, i32* %3
br label %144
34: ; preds = %22
%35 = load i32*, i32** %6
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.3, i64 0, i64 0))
%37 = load i32*, i32** %6
%38 = load i32, i32* %4
%39 = sub nsw i32 %38, 2
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = load i32*, i32** %6
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %8
br label %43
43: ; preds = %136, %34
%44 = load i32, i32* %8
%45 = load i32, i32* %4
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %139
47: ; preds = %43
%48 = load i8**, i8*** %5
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %48, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %52)
%54 = load i8**, i8*** %5
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 @stat(i8* %58, %struct.stat* %10)
%60 = icmp ne i32 %59, 0
br i1 %60, label %65, label %61
61: ; preds = %47
%62 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%63 = load i64, i64* %62
%64 = trunc i64 %63 to i32
store i32 %64, i32* %9
br label %72
65: ; preds = %47
%66 = load i8**, i8*** %5
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %70)
store i32 3, i32* %3
br label %144
72: ; preds = %61
%73 = load i8**, i8*** %5
%74 = load i32, i32* %8
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %73, i64 %75
%77 = load i8*, i8** %76
%78 = call i32* @fopen(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %78, i32** %7
%79 = load i32*, i32** %7
%80 = icmp ne i32* %79, null
br i1 %80, label %88, label %81
81: ; preds = %72
%82 = load i8**, i8*** %5
%83 = load i32, i32* %8
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %82, i64 %84
%86 = load i8*, i8** %85
%87 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %86)
store i32 4, i32* %3
br label %144
88: ; preds = %72
%89 = load i32*, i32** %6
%90 = load i32, i32* %8
%91 = icmp eq i32 %90, 2
%92 = zext i1 %91 to i64
%93 = select i1 %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0)
%94 = load i8**, i8*** %5
%95 = load i32, i32* %8
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8*, i8** %94, i64 %96
%98 = load i8*, i8** %97
%99 = load i32, i32* %9
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %89, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %93, i8* %98, i32 %99)
br label %101
101: ; preds = %128, %88
%102 = load i32*, i32** %7
%103 = icmp ne i32* %102, null
br i1 %103, label %104, label %131
104: ; preds = %101
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%106 = load i32*, i32** %7
%107 = call i64 @fread(i8* %105, i32 1, i32 200, i32* %106)
store i64 %107, i64* %14
%108 = load i64, i64* %14
%109 = icmp ult i64 %108, 1
br i1 %109, label %110, label %111
110: ; preds = %104
br label %131
111: ; preds = %104
%112 = load i32*, i32** %6
%113 = call i32 (i32*, i8*, ...) @fprintf(i32* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
store i64 0, i64* %13
br label %114
114: ; preds = %125, %111
%115 = load i64, i64* %13
%116 = load i64, i64* %14
%117 = icmp ult i64 %115, %116
br i1 %117, label %118, label %128
118: ; preds = %114
%119 = load i32*, i32** %6
%120 = load i64, i64* %13
%121 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %120
%122 = load i8, i8* %121
%123 = zext i8 %122 to i32
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 %123)
br label %125
125: ; preds = %118
%126 = load i64, i64* %13
%127 = add i64 %126, 1
store i64 %127, i64* %13
br label %114
128: ; preds = %114
%129 = load i32*, i32** %6
%130 = call i32 (i32*, i8*, ...) @fprintf(i32* %129, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
br label %101
131: ; preds = %110, %101
%132 = load i32*, i32** %7
%133 = call i32 @fclose(i32* %132)
%134 = load i32*, i32** %6
%135 = call i32 (i32*, i8*, ...) @fprintf(i32* %134, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0))
br label %136
136: ; preds = %131
%137 = load i32, i32* %8
%138 = add nsw i32 %137, 1
store i32 %138, i32* %8
br label %43
139: ; preds = %43
%140 = load i32*, i32** %6
%141 = call i32 (i32*, i8*, ...) @fprintf(i32* %140, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0))
%142 = load i32*, i32** %6
%143 = call i32 @fclose(i32* %142)
store i32 0, i32* %3
br label %144
144: ; preds = %139, %81, %65, %29, %17
%145 = load i32, i32* %3
ret i32 %145
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [67 x i8] c"ERROR: usage is: \22%s OUTPUT_FILE INPUT_FILE [...INPUT_FILES...]\22\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [36 x i8] c"ERROR: cannot open \22%s\22 for output\0A\00"
@.str.3 = [73 x i8] c"struct embeded_file {\0A char * name;\0A int ndat;\0A char * dat;\0A};\0A\00"
@.str.4 = [25 x i8] c"const int n_flist = %d;\0A\00"
@.str.5 = [33 x i8] c"struct embeded_file flist[] = {\0A\00"
@.str.6 = [19 x i8] c" encoding: \22%s\22\0A\00"
@.str.7 = [32 x i8] c" ERROR: cannot stat() \22%s\22\0A\00"
@.str.8 = [2 x i8] c"r\00"
@.str.9 = [33 x i8] c" ERROR: cannot fopen() \22%s\22\0A\00"
@.str.10 = [16 x i8] c" %s{ \22%s\22, %d,\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [2 x i8] c",\00"
@.str.13 = [3 x i8] c"\0A\22\00"
@.str.14 = [7 x i8] c"\\x%02x\00"
@.str.16 = [5 x i8] c" }\0A\00"
@.str.17 = [6 x i8] c" };\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca [1024 x i8]
%5 = bitcast %struct.stat* %3 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %76
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i8*, i8** %12
%18 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %76
19: ; preds = %11
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.3, i64 0, i64 0), i64 72, i64 1, i32* %14)
%21 = add nsw i32 %0, -2
%22 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i64 32, i64 1, i32* %14)
%24 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%25 = zext i32 %0 to i64
br label %26
26: ; preds = %19, %68
%27 = phi i64 [ 2, %19 ], [ %71, %68 ]
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %28
%32 = call i32 @stat(i8* %31, %struct.stat* %3)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %26
%35 = load i64, i64* %24
%36 = load i8*, i8** %28
%37 = tail call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %42, label %45
39: ; preds = %26
%40 = load i8*, i8** %28
%41 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %40)
br label %76
42: ; preds = %34
%43 = load i8*, i8** %28
%44 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %43)
br label %76
45: ; preds = %34
%46 = trunc i64 %35 to i32
%47 = icmp eq i64 %27, 2
%48 = select i1 %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0)
%49 = load i8*, i8** %28
%50 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %48, i8* %49, i32 %46)
%51 = call i64 @fread(i8* %6, i32 1, i32 200, i32* %37)
%52 = icmp eq i64 %51, 0
br i1 %52, label %68, label %53
53: ; preds = %45, %64
%54 = phi i64 [ %66, %64 ], [ %51, %45 ]
%55 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i64 2, i64 1, i32* %14)
br label %56
56: ; preds = %53, %56
%57 = phi i64 [ 0, %53 ], [ %62, %56 ]
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 %60)
%62 = add nuw i64 %57, 1
%63 = icmp eq i64 %62, %54
br i1 %63, label %64, label %56
64: ; preds = %56
%65 = tail call i32 @fputc(i32 34, i32* %14)
%66 = call i64 @fread(i8* %6, i32 1, i32 200, i32* %37)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %53
68: ; preds = %64, %45
%69 = tail call i32 @fclose(i32* %37)
%70 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i64 4, i64 1, i32* %14)
%71 = add nuw nsw i64 %27, 1
%72 = icmp eq i64 %71, %25
br i1 %72, label %73, label %26
73: ; preds = %68
%74 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i64 5, i64 1, i32* %14)
%75 = tail call i32 @fclose(i32* %14)
br label %76
76: ; preds = %73, %42, %39, %16, %8
%77 = phi i32 [ 1, %8 ], [ 3, %39 ], [ 4, %42 ], [ 0, %73 ], [ 1, %16 ]
ret i32 %77
}