#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ stderr;
size_t strlen(char *);
int main(int argc, char *argv[]) {
  FILE *in, *out;
  int i;
  char *str;
  char *strp;
  size_t len;
  if (argc < 4) {
    fprintf(stderr, "Usage: %s <string> <outfile> <file> [<file> ...]\n",
            argv[0]);
    return EXIT_FAILURE;
  }
  out = fopen(argv[2], "wt");
  if (!out) {
    fprintf(stderr, "Could not open `%s'.\n", argv[2]);
    return EXIT_FAILURE;
  }
  str = malloc(1024);
  fprintf(out,
          "/* This file auto-generated from %s by genstring.c"
          " - don't edit it */\n\n"
          "static const char *%s[] = {\n",
          argv[3], argv[1]);
  for (i = 3; i < argc; i++) {
    in = fopen(argv[i], "rt");
    if (!in) {
      fprintf(stderr, "Could not open `%s'.\n", argv[i]);
      fclose(out);
      remove(argv[2]);
      return EXIT_FAILURE;
    }
    while (fgets(str, 1024, in)) {
      strp = str;
      len = strlen(strp);
      while (len > 0 && (strp[len - 1] == ' ' || strp[len - 1] == '\t' ||
                         strp[len - 1] == '\n')) {
        strp[len - 1] = '\0';
        len--;
      }
      fprintf(out, "    \"");
      while (*strp != '\0') {
        if (*strp == '\\' || *strp == '"')
          fputc('\\', out);
        fputc(*strp, out);
        strp++;
      }
      fprintf(out, "\",\n");
    }
    fclose(in);
  }
  fprintf(out, "};\n");
  fclose(out);
  free(str);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11e0 <main+0x50>
mov    0x2e29(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    148c <main+0x2fc>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe43(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1234 <main+0xa4>
mov    0x2dd6(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2dae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    148c <main+0x2fc>
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x3,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    145c <main+0x2cc>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe25(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12e9 <main+0x159>
mov    0x2d3b(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd7a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <remove@plt>
mov    0x2cf9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    148c <main+0x2fc>
jmp    12ee <main+0x15e>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1445 <main+0x2b5>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x40(%rbp)
mov    %al,-0x41(%rbp)
jbe    138a <main+0x1fa>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x42(%rbp)
je     1384 <main+0x1f4>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x42(%rbp)
je     1384 <main+0x1f4>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    139a <main+0x20a>
jmp    13bb <main+0x22b>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
jmp    131f <main+0x18f>
mov    -0x20(%rbp),%rdi
lea    0xcec(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     142e <main+0x29e>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     13fd <main+0x26d>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    140b <main+0x27b>
mov    -0x20(%rbp),%rsi
mov    $0x5c,%edi
call   1070 <fputc@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1070 <fputc@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    13cd <main+0x23d>
mov    -0x20(%rbp),%rdi
lea    0xc7f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    12ee <main+0x15e>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    126b <main+0xdb>
mov    -0x20(%rbp),%rdi
lea    0xc55(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    0x2b49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
cmp    $0x3,%edi
jg     11cf <main+0x2f>
mov    0x2e23(%rip),%rax
movslq (%rax),%rdi
mov    (%r15),%rdx
lea    0xe36(%rip),%rsi
jmp    134f <main+0x1af>
mov    %edi,%ebp
mov    0x10(%r15),%rdi
lea    0xe56(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     133a <main+0x19a>
mov    %rax,%rbx
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,%r13
mov    0x8(%r15),%rcx
mov    0x18(%r15),%rdx
lea    0xe42(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %ebp,%eax
mov    %rax,0x8(%rsp)
mov    $0x3,%eax
lea    0xe92(%rip),%rbp
movabs $0x100000600,%r14
mov    %r15,0x10(%rsp)
jmp    1260 <main+0xc0>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    (%rsp),%rax
add    $0x1,%rax
cmp    0x8(%rsp),%rax
mov    0x10(%rsp),%r15
je     136e <main+0x1ce>
mov    %rax,(%rsp)
mov    (%r15,%rax,8),%rdi
lea    0xe40(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13a0 <main+0x200>
mov    %rax,%r12
mov    %r13,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1240 <main+0xa0>
mov    %r13,%rdi
call   1060 <strlen@plt>
test   %rax,%rax
je     12ce <main+0x12e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl -0x1(%r13,%rax,1),%ecx
cmp    $0x20,%rcx
ja     12ce <main+0x12e>
bt     %rcx,%r14
jae    12ce <main+0x12e>
movb   $0x0,-0x1(%r13,%rax,1)
add    $0xffffffffffffffff,%rax
jne    12b0 <main+0x110>
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xdd3(%rip),%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %r13,%r15
jmp    1310 <main+0x170>
nopl   0x0(%rax)
mov    $0x5c,%edi
mov    %rbx,%rsi
call   1070 <fputc@plt>
movzbl (%r15),%eax
movsbl %al,%edi
mov    %rbx,%rsi
call   1070 <fputc@plt>
add    $0x1,%r15
movzbl (%r15),%eax
cmp    $0x22,%al
je     12f0 <main+0x150>
cmp    $0x5c,%al
je     12f0 <main+0x150>
test   %al,%al
jne    1301 <main+0x161>
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
jmp    1280 <main+0xe0>
mov    0x2c9f(%rip),%rax
movslq (%rax),%rdi
mov    0x10(%r15),%rdx
lea    0xce6(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd47(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x2c32(%rip),%rax
jmp    135d <main+0x1bd>
mov    (%rsp),%eax
mov    0x2c36(%rip),%rcx
movslq (%rcx),%rdi
mov    (%r15,%rax,8),%rdx
lea    0xc7d(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x10(%r15),%rdi
call   1040 <remove@plt>
jmp    1356 <main+0x1b6>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: %s <string> <outfile> <file> [<file> ...]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"wt\00"
@.str.2 = [22 x i8] c"Could not open `%s'.\0A\00"
@.str.3 = [100 x i8] c"/* This file auto-generated from %s by genstring.c - don't edit it */\0A\0Astatic const char *%s[] = {\0A\00"
@.str.4 = [3 x i8] c"rt\00"
@.str.5 = [6 x i8] c" \22\00"
@.str.6 = [4 x i8] c"\22,\0A\00"
@.str.7 = [4 x i8] c"};\0A\00"
@EXIT_SUCCESS = global i32 0
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 i8*
%10 = alloca i8*
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %23
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
store i32 %22, i32* %3
br label %172
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %7
%28 = load i32*, i32** %7
%29 = icmp ne i32* %28, null
br i1 %29, label %39, label %30
30: ; preds = %23
%31 = load i32, i32* @stderr
%32 = sext i32 %31 to i64
%33 = inttoptr i64 %32 to i32*
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
store i32 %38, i32* %3
br label %172
39: ; preds = %23
%40 = call i8* @malloc(i32 1024)
store i8* %40, i8** %9
%41 = load i32*, i32** %7
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 3
%44 = load i8*, i8** %43
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.3, i64 0, i64 0), i8* %44, i8* %47)
store i32 3, i32* %8
br label %49
49: ; preds = %161, %39
%50 = load i32, i32* %8
%51 = load i32, i32* %4
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %164
53: ; preds = %49
%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* @fopen(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %59, i32** %6
%60 = load i32*, i32** %6
%61 = icmp ne i32* %60, null
br i1 %61, label %79, label %62
62: ; preds = %53
%63 = load i32, i32* @stderr
%64 = sext i32 %63 to i64
%65 = inttoptr i64 %64 to i32*
%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 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %70)
%72 = load i32*, i32** %7
%73 = call i32 @fclose(i32* %72)
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 2
%76 = load i8*, i8** %75
%77 = call i32 @remove(i8* %76)
%78 = load i32, i32* @EXIT_FAILURE
store i32 %78, i32* %3
br label %172
79: ; preds = %53
br label %80
80: ; preds = %155, %79
%81 = load i8*, i8** %9
%82 = load i32*, i32** %6
%83 = call i64 @fgets(i8* %81, i32 1024, i32* %82)
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %158
85: ; preds = %80
%86 = load i8*, i8** %9
store i8* %86, i8** %10
%87 = load i8*, i8** %10
%88 = call i64 @strlen(i8* %87)
store i64 %88, i64* %11
br label %89
89: ; preds = %120, %85
%90 = load i64, i64* %11
%91 = icmp ugt i64 %90, 0
br i1 %91, label %92, label %118
92: ; preds = %89
%93 = load i8*, i8** %10
%94 = load i64, i64* %11
%95 = sub i64 %94, 1
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 32
br i1 %99, label %116, label %100
100: ; preds = %92
%101 = load i8*, i8** %10
%102 = load i64, i64* %11
%103 = sub i64 %102, 1
%104 = getelementptr inbounds i8, i8* %101, i64 %103
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 9
br i1 %107, label %116, label %108
108: ; preds = %100
%109 = load i8*, i8** %10
%110 = load i64, i64* %11
%111 = sub i64 %110, 1
%112 = getelementptr inbounds i8, i8* %109, i64 %111
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 10
br label %116
116: ; preds = %108, %100, %92
%117 = phi i1 [ true, %100 ], [ true, %92 ], [ %115, %108 ]
br label %118
118: ; preds = %116, %89
%119 = phi i1 [ false, %89 ], [ %117, %116 ]
br i1 %119, label %120, label %127
120: ; preds = %118
%121 = load i8*, i8** %10
%122 = load i64, i64* %11
%123 = sub i64 %122, 1
%124 = getelementptr inbounds i8, i8* %121, i64 %123
store i8 0, i8* %124
%125 = load i64, i64* %11
%126 = add i64 %125, -1
store i64 %126, i64* %11
br label %89
127: ; preds = %118
%128 = load i32*, i32** %7
%129 = call i32 (i32*, i8*, ...) @fprintf(i32* %128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %130
130: ; preds = %148, %127
%131 = load i8*, i8** %10
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %155
135: ; preds = %130
%136 = load i8*, i8** %10
%137 = load i8, i8* %136
%138 = sext i8 %137 to i32
%139 = icmp eq i32 %138, 92
br i1 %139, label %145, label %140
140: ; preds = %135
%141 = load i8*, i8** %10
%142 = load i8, i8* %141
%143 = sext i8 %142 to i32
%144 = icmp eq i32 %143, 34
br i1 %144, label %145, label %148
145: ; preds = %140, %135
%146 = load i32*, i32** %7
%147 = call i32 @fputc(i8 signext 92, i32* %146)
br label %148
148: ; preds = %145, %140
%149 = load i8*, i8** %10
%150 = load i8, i8* %149
%151 = load i32*, i32** %7
%152 = call i32 @fputc(i8 signext %150, i32* %151)
%153 = load i8*, i8** %10
%154 = getelementptr inbounds i8, i8* %153, i32 1
store i8* %154, i8** %10
br label %130
155: ; preds = %130
%156 = load i32*, i32** %7
%157 = call i32 (i32*, i8*, ...) @fprintf(i32* %156, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %80
158: ; preds = %80
%159 = load i32*, i32** %6
%160 = call i32 @fclose(i32* %159)
br label %161
161: ; preds = %158
%162 = load i32, i32* %8
%163 = add nsw i32 %162, 1
store i32 %163, i32* %8
br label %49
164: ; preds = %49
%165 = load i32*, i32** %7
%166 = call i32 (i32*, i8*, ...) @fprintf(i32* %165, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%167 = load i32*, i32** %7
%168 = call i32 @fclose(i32* %167)
%169 = load i8*, i8** %9
%170 = call i32 @free(i8* %169)
%171 = load i32, i32* @EXIT_SUCCESS
store i32 %171, i32* %3
br label %172
172: ; preds = %164, %62, %30, %14
%173 = load i32, i32* %3
ret i32 %173
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: %s <string> <outfile> <file> [<file> ...]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"wt\00"
@.str.2 = [22 x i8] c"Could not open `%s'.\0A\00"
@.str.3 = [100 x i8] c"/* This file auto-generated from %s by genstring.c - don't edit it */\0A\0Astatic const char *%s[] = {\0A\00"
@.str.4 = [3 x i8] c"rt\00"
@.str.5 = [6 x i8] c" \22\00"
@.str.6 = [4 x i8] c"\22,\0A\00"
@.str.7 = [4 x i8] c"};\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load i8*, i8** %1
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %83
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load i8*, i8** %11
%20 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %83
21: ; preds = %10
%22 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.3, i64 0, i64 0), i8* %24, i8* %26)
%28 = zext i32 %0 to i64
br label %29
29: ; preds = %21, %75
%30 = phi i64 [ 3, %21 ], [ %77, %75 ]
%31 = getelementptr inbounds i8*, i8** %1, i64 %30
%32 = load i8*, i8** %31
%33 = tail call i32* @fopen(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %38, label %35
35: ; preds = %29
%36 = tail call i64 @fgets(i8* %22, i32 1024, i32* %33)
%37 = icmp eq i64 %36, 0
br i1 %37, label %75, label %49
38: ; preds = %29
%39 = and i64 %30, 4294967295
%40 = getelementptr inbounds i8*, i8** %1, i64 %39
%41 = load i32, i32* @stderr
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i32*
%44 = load i8*, i8** %40
%45 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = tail call i32 @fclose(i32* %13)
%47 = load i8*, i8** %11
%48 = tail call i32 @remove(i8* %47)
br label %83
49: ; preds = %35, %71
%50 = tail call i64 @strlen(i8* dereferenceable(1) %22)
%51 = icmp eq i64 %50, 0
br i1 %51, label %59, label %52
52: ; preds = %49, %57
%53 = phi i64 [ %54, %57 ], [ %50, %49 ]
%54 = add i64 %53, -1
%55 = getelementptr inbounds i8, i8* %22, i64 %54
%56 = load i8, i8* %55
switch i8 %56, label %59 [
i8 32, label %57
i8 9, label %57
i8 10, label %57
]
57: ; preds = %52, %52, %52
store i8 0, i8* %55
%58 = icmp eq i64 %54, 0
br i1 %58, label %59, label %52
59: ; preds = %57, %52, %49
%60 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 5, i64 1, i32* %13)
br label %61
61: ; preds = %67, %59
%62 = phi i8* [ %22, %59 ], [ %70, %67 ]
%63 = load i8, i8* %62
switch i8 %63, label %67 [
i8 0, label %71
i8 92, label %64
i8 34, label %64
]
64: ; preds = %61, %61
%65 = tail call i32 @fputc(i8 signext 92, i32* %13)
%66 = load i8, i8* %62
br label %67
67: ; preds = %61, %64
%68 = phi i8 [ %63, %61 ], [ %66, %64 ]
%69 = tail call i32 @fputc(i8 signext %68, i32* %13)
%70 = getelementptr inbounds i8, i8* %62, i64 1
br label %61
71: ; preds = %61
%72 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 3, i64 1, i32* %13)
%73 = tail call i64 @fgets(i8* %22, i32 1024, i32* %33)
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %49
75: ; preds = %71, %35
%76 = tail call i32 @fclose(i32* %33)
%77 = add nuw nsw i64 %30, 1
%78 = icmp eq i64 %77, %28
br i1 %78, label %79, label %29
79: ; preds = %75
%80 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64 3, i64 1, i32* %13)
%81 = tail call i32 @fclose(i32* %13)
%82 = tail call i32 @free(i8* %22)
br label %83
83: ; preds = %79, %38, %15, %4
%84 = phi i32* [ @EXIT_FAILURE, %4 ], [ @EXIT_FAILURE, %38 ], [ @EXIT_SUCCESS, %79 ], [ @EXIT_FAILURE, %15 ]
%85 = load i32, i32* %84
ret i32 %85
}