#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 {
  int 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 *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  struct stat statbuf;
  char *filename = NULL, *program_source = NULL, *progname = NULL;
  FILE *fh = NULL;
  char ch;
  int ii;
  filename = argv[1];
  fh = fopen(filename, "r");
  if (fh == NULL) {
    fprintf(stderr, "Error: Could not open the file: %s \n", filename);
  } else {
    stat(filename, &statbuf);
    program_source = (char *)malloc(statbuf.st_size);
    fread(program_source, statbuf.st_size, 1, fh);
    fclose(fh);
  }
  filename = argv[2];
  fh = fopen(filename, "w");
  if (fh == NULL) {
    fprintf(stderr, "Error: Could not open the file: %s \n", filename);
  } else {
    fprintf(fh, "const char ");
    ii = 0;
    while ((filename[ii] != '.') & (filename[ii] != '\0') & ii < 1000) {
      fputc(filename[ii], fh);
      ii++;
    }
    fprintf(fh, "_source[] = \"");
    for (ii = 0; ii < statbuf.st_size; ii++) {
      ch = program_source[ii];
      if (ch >= 0 && ch <= 125) {
        switch (ch) {
        case '\"':
          fputs("\\\"", fh);
          break;
        case '\'':
          fputs("\\\'", fh);
          break;
        case '\\':
          fputs("\\\\", fh);
          break;
        case '\a':
          fputs("\\a", fh);
          break;
        case '\b':
          fputs("\\b", fh);
          break;
        case '\n':
          fputs("\\n", fh);
          break;
        case '\t':
          fputs("\\t", fh);
          break;
        case '\0':
          break;
        case '\r':
          break;
        default:
          fputc(ch, fh);
        }
      }
    }
    fprintf(fh, "\";  ");
  }
  fclose(fh);
  free(program_source);
  free(progname);
  return 0;
}


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)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1212 <main+0x82>
mov    0x2de8(%rip),%rax
movslq (%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1249 <main+0xb9>
mov    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1090 <stat@plt>
mov    -0x18(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x38(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdc7(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1295 <main+0x105>
mov    0x2d65(%rip),%rax
movslq (%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd79(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    14de <main+0x34e>
mov    -0x38(%rbp),%rdi
lea    0xd89(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x20(%rbp),%rcx
movslq -0x40(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    $0x0,%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmpl   $0x3e8,-0x40(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     131f <main+0x18f>
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x38(%rbp),%rsi
movsbl %al,%edi
call   1070 <fputc@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12ae <main+0x11e>
mov    -0x38(%rbp),%rdi
lea    0xd0b(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    14cc <main+0x33c>
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x39(%rbp)
movsbl -0x39(%rbp),%eax
cmp    $0x0,%eax
jl     14b9 <main+0x329>
movsbl -0x39(%rbp),%eax
cmp    $0x7d,%eax
jg     14b9 <main+0x329>
movsbl -0x39(%rbp),%eax
mov    %eax,-0x44(%rbp)
test   %eax,%eax
je     149b <main+0x30b>
jmp    1380 <main+0x1f0>
mov    -0x44(%rbp),%eax
sub    $0x7,%eax
je     1447 <main+0x2b7>
jmp    1391 <main+0x201>
mov    -0x44(%rbp),%eax
sub    $0x8,%eax
je     145c <main+0x2cc>
jmp    13a2 <main+0x212>
mov    -0x44(%rbp),%eax
sub    $0x9,%eax
je     1486 <main+0x2f6>
jmp    13b3 <main+0x223>
mov    -0x44(%rbp),%eax
sub    $0xa,%eax
je     1471 <main+0x2e1>
jmp    13c4 <main+0x234>
mov    -0x44(%rbp),%eax
sub    $0xd,%eax
je     14a0 <main+0x310>
jmp    13d5 <main+0x245>
mov    -0x44(%rbp),%eax
sub    $0x22,%eax
je     1408 <main+0x278>
jmp    13e6 <main+0x256>
mov    -0x44(%rbp),%eax
sub    $0x27,%eax
je     141d <main+0x28d>
jmp    13f7 <main+0x267>
mov    -0x44(%rbp),%eax
sub    $0x5c,%eax
je     1432 <main+0x2a2>
jmp    14a5 <main+0x315>
mov    -0x38(%rbp),%rsi
lea    0xc30(%rip),%rdi
call   1060 <fputs@plt>
jmp    14b4 <main+0x324>
mov    -0x38(%rbp),%rsi
lea    0xc1e(%rip),%rdi
call   1060 <fputs@plt>
jmp    14b4 <main+0x324>
mov    -0x38(%rbp),%rsi
lea    0xc0c(%rip),%rdi
call   1060 <fputs@plt>
jmp    14b4 <main+0x324>
mov    -0x38(%rbp),%rsi
lea    0xbfa(%rip),%rdi
call   1060 <fputs@plt>
jmp    14b4 <main+0x324>
mov    -0x38(%rbp),%rsi
lea    0xbe8(%rip),%rdi
call   1060 <fputs@plt>
jmp    14b4 <main+0x324>
mov    -0x38(%rbp),%rsi
lea    0xbd6(%rip),%rdi
call   1060 <fputs@plt>
jmp    14b4 <main+0x324>
mov    -0x38(%rbp),%rsi
lea    0xbc4(%rip),%rdi
call   1060 <fputs@plt>
jmp    14b4 <main+0x324>
jmp    14b4 <main+0x324>
jmp    14b4 <main+0x324>
mov    -0x39(%rbp),%al
mov    -0x38(%rbp),%rsi
movsbl %al,%edi
call   1070 <fputc@plt>
jmp    14b9 <main+0x329>
jmp    14be <main+0x32e>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1338 <main+0x1a8>
mov    -0x38(%rbp),%rdi
lea    0xb81(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    0x8(%rsi),%rbx
lea    0xef7(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     11f0 <main+0x60>
mov    %rax,%rbp
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1080 <stat@plt>
mov    (%rsp),%r15d
mov    %r15d,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1040 <fread@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
jmp    120e <main+0x7e>
mov    0x2de9(%rip),%rax
movslq (%rax),%rdi
lea    0xea1(%rip),%rsi
xor    %r14d,%r14d
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x10(%r12),%rbp
lea    0xead(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
je     13a1 <main+0x211>
lea    0xe94(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
xor    %ebx,%ebx
mov    %rbp,%rax
nopl   0x0(%rax)
movzbl (%rax),%eax
test   %al,%al
je     127a <main+0xea>
cmp    $0x2e,%al
je     127a <main+0xea>
movsbl %al,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    %ebx,%eax
add    $0x1,%ebx
add    %rbp,%rax
add    $0x1,%rax
cmp    $0x3e8,%ebx
jb     1250 <main+0xc0>
lea    0xe54(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
test   %r15d,%r15d
jle    1386 <main+0x1f6>
mov    %r15d,%ebp
xor    %r15d,%r15d
lea    0xd57(%rip),%r12
lea    0xe36(%rip),%rbx
jmp    12e5 <main+0x155>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe20(%rip),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rcx
call   10b0 <fwrite@plt>
add    $0x1,%r15
cmp    %r15,%rbp
je     1386 <main+0x1f6>
movzbl (%r14,%r15,1),%eax
cmp    $0x7d,%al
ja     12d8 <main+0x148>
cmp    $0x27,%al
ja     1311 <main+0x181>
movzbl %al,%ecx
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xddd(%rip),%rdi
jmp    12d0 <main+0x140>
cmp    $0x5c,%al
jne    1328 <main+0x198>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xdc3(%rip),%rdi
jmp    12d0 <main+0x140>
movsbl %al,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
jmp    12d8 <main+0x148>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xda9(%rip),%rdi
jmp    12d0 <main+0x140>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xd9c(%rip),%rdi
jmp    12d0 <main+0x140>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xd83(%rip),%rdi
jmp    12d0 <main+0x140>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
jmp    12d0 <main+0x140>
lea    0xd6b(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
jmp    13bc <main+0x22c>
mov    0x2c38(%rip),%rax
movslq (%rax),%rdi
lea    0xcf0(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Error: Could not open the file: %s \0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [12 x i8] c"const char \00"
@.str.4 = [14 x i8] c"_source[] = \22\00"
@.str.5 = [3 x i8] c"\\\22\00"
@.str.6 = [3 x i8] c"\\'\00"
@.str.7 = [3 x i8] c"\\\\\00"
@.str.8 = [3 x i8] c"\\a\00"
@.str.9 = [3 x i8] c"\\b\00"
@.str.10 = [3 x i8] c"\\n\00"
@.str.11 = [3 x i8] c"\\t\00"
@.str.12 = [5 x i8] c"\22; \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i8
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i32* null, i32** %10
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %10
%18 = load i32*, i32** %10
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %26
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = load i8*, i8** %7
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %24)
br label %40
26: ; preds = %2
%27 = load i8*, i8** %7
%28 = call i32 @stat(i8* %27, %struct.stat* %6)
%29 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%30 = load i32, i32* %29
%31 = call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to i8*
store i8* %32, i8** %8
%33 = load i8*, i8** %8
%34 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%35 = load i32, i32* %34
%36 = load i32*, i32** %10
%37 = call i32 @fread(i8* %33, i32 %35, i32 1, i32* %36)
%38 = load i32*, i32** %10
%39 = call i32 @fclose(i32* %38)
br label %40
40: ; preds = %26, %20
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
store i8* %43, i8** %7
%44 = load i8*, i8** %7
%45 = call i32* @fopen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %45, i32** %10
%46 = load i32*, i32** %10
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %54
48: ; preds = %40
%49 = load i32, i32* @stderr
%50 = sext i32 %49 to i64
%51 = inttoptr i64 %50 to i32*
%52 = load i8*, i8** %7
%53 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %52)
br label %149
54: ; preds = %40
%55 = load i32*, i32** %10
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %12
br label %57
57: ; preds = %80, %54
%58 = load i8*, i8** %7
%59 = load i32, i32* %12
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 46
%65 = zext i1 %64 to i32
%66 = load i8*, i8** %7
%67 = load i32, i32* %12
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %71, 0
%73 = zext i1 %72 to i32
%74 = and i32 %65, %73
%75 = load i32, i32* %12
%76 = icmp slt i32 %75, 1000
%77 = zext i1 %76 to i32
%78 = and i32 %74, %77
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %90
80: ; preds = %57
%81 = load i8*, i8** %7
%82 = load i32, i32* %12
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = load i8, i8* %84
%86 = load i32*, i32** %10
%87 = call i32 @fputc(i8 signext %85, i32* %86)
%88 = load i32, i32* %12
%89 = add nsw i32 %88, 1
store i32 %89, i32* %12
br label %57
90: ; preds = %57
%91 = load i32*, i32** %10
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %91, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %12
br label %93
93: ; preds = %143, %90
%94 = load i32, i32* %12
%95 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%96 = load i32, i32* %95
%97 = icmp slt i32 %94, %96
br i1 %97, label %98, label %146
98: ; preds = %93
%99 = load i8*, i8** %8
%100 = load i32, i32* %12
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %99, i64 %101
%103 = load i8, i8* %102
store i8 %103, i8* %11
%104 = load i8, i8* %11
%105 = sext i8 %104 to i32
%106 = icmp sge i32 %105, 0
br i1 %106, label %107, label %142
107: ; preds = %98
%108 = load i8, i8* %11
%109 = sext i8 %108 to i32
%110 = icmp sle i32 %109, 125
br i1 %110, label %111, label %142
111: ; preds = %107
%112 = load i8, i8* %11
%113 = sext i8 %112 to i32
switch i32 %113, label %137 [
i32 34, label %114
i32 39, label %117
i32 92, label %120
i32 7, label %123
i32 8, label %126
i32 10, label %129
i32 9, label %132
i32 0, label %135
i32 13, label %136
]
114: ; preds = %111
%115 = load i32*, i32** %10
%116 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %115)
br label %141
117: ; preds = %111
%118 = load i32*, i32** %10
%119 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %118)
br label %141
120: ; preds = %111
%121 = load i32*, i32** %10
%122 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %121)
br label %141
123: ; preds = %111
%124 = load i32*, i32** %10
%125 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %124)
br label %141
126: ; preds = %111
%127 = load i32*, i32** %10
%128 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %127)
br label %141
129: ; preds = %111
%130 = load i32*, i32** %10
%131 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %130)
br label %141
132: ; preds = %111
%133 = load i32*, i32** %10
%134 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %133)
br label %141
135: ; preds = %111
br label %141
136: ; preds = %111
br label %141
137: ; preds = %111
%138 = load i8, i8* %11
%139 = load i32*, i32** %10
%140 = call i32 @fputc(i8 signext %138, i32* %139)
br label %141
141: ; preds = %137, %136, %135, %132, %129, %126, %123, %120, %117, %114
br label %142
142: ; preds = %141, %107, %98
br label %143
143: ; preds = %142
%144 = load i32, i32* %12
%145 = add nsw i32 %144, 1
store i32 %145, i32* %12
br label %93
146: ; preds = %93
%147 = load i32*, i32** %10
%148 = call i32 (i32*, i8*, ...) @fprintf(i32* %147, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %149
149: ; preds = %146, %48
%150 = load i32*, i32** %10
%151 = call i32 @fclose(i32* %150)
%152 = load i8*, i8** %8
%153 = call i32 @free(i8* %152)
%154 = load i8*, i8** %9
%155 = call i32 @free(i8* %154)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Error: Could not open the file: %s \0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [12 x i8] c"const char \00"
@.str.4 = [14 x i8] c"_source[] = \22\00"
@.str.5 = [3 x i8] c"\\\22\00"
@.str.6 = [3 x i8] c"\\'\00"
@.str.7 = [3 x i8] c"\\\\\00"
@.str.8 = [3 x i8] c"\\a\00"
@.str.9 = [3 x i8] c"\\b\00"
@.str.10 = [3 x i8] c"\\n\00"
@.str.11 = [3 x i8] c"\\t\00"
@.str.12 = [5 x i8] c"\22; \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %22
14: ; preds = %2
%15 = call i32 @stat(i8* %6, %struct.stat* %3)
%16 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%17 = load i32, i32* %16
%18 = tail call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i8*
%20 = tail call i32 @fread(i8* %19, i32 %17, i32 1, i32* %7)
%21 = tail call i32 @fclose(i32* %7)
br label %22
22: ; preds = %14, %9
%23 = phi i32 [ undef, %9 ], [ %17, %14 ]
%24 = phi i8* [ null, %9 ], [ %19, %14 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %34
29: ; preds = %22
%30 = load i32, i32* @stderr
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
%33 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %26)
br label %79
34: ; preds = %22
%35 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %27)
br label %36
36: ; preds = %34, %40
%37 = phi i32 [ 0, %34 ], [ %45, %40 ]
%38 = phi i8* [ %26, %34 ], [ %44, %40 ]
%39 = load i8, i8* %38
switch i8 %39, label %40 [
i8 46, label %47
i8 0, label %47
]
40: ; preds = %36
%41 = tail call i32 @fputc(i8 signext %39, i32* %27)
%42 = add nuw nsw i32 %37, 1
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %26, i64 %43
%45 = freeze i32 %42
%46 = icmp ult i32 %45, 1000
br i1 %46, label %36, label %47
47: ; preds = %36, %36, %40
%48 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 13, i64 1, i32* %27)
%49 = icmp sgt i32 %23, 0
br i1 %49, label %50, label %77
50: ; preds = %47
%51 = zext i32 %23 to i64
br label %52
52: ; preds = %50, %74
%53 = phi i64 [ 0, %50 ], [ %75, %74 ]
%54 = getelementptr inbounds i8, i8* %24, i64 %53
%55 = load i8, i8* %54
%56 = icmp ult i8 %55, 126
br i1 %56, label %57, label %74
57: ; preds = %52
switch i8 %55, label %72 [
i8 34, label %58
i8 39, label %60
i8 92, label %62
i8 7, label %64
i8 8, label %66
i8 10, label %68
i8 9, label %70
i8 0, label %74
i8 13, label %74
]
58: ; preds = %57
%59 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 2, i64 1, i32* %27)
br label %74
60: ; preds = %57
%61 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i64 1, i32* %27)
br label %74
62: ; preds = %57
%63 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %27)
br label %74
64: ; preds = %57
%65 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i64 2, i64 1, i32* %27)
br label %74
66: ; preds = %57
%67 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i64 2, i64 1, i32* %27)
br label %74
68: ; preds = %57
%69 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i64 2, i64 1, i32* %27)
br label %74
70: ; preds = %57
%71 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i64 2, i64 1, i32* %27)
br label %74
72: ; preds = %57
%73 = tail call i32 @fputc(i8 signext %55, i32* %27)
br label %74
74: ; preds = %52, %72, %57, %57, %70, %68, %66, %64, %62, %60, %58
%75 = add nuw nsw i64 %53, 1
%76 = icmp eq i64 %75, %51
br i1 %76, label %77, label %52
77: ; preds = %74, %47
%78 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i64 4, i64 1, i32* %27)
br label %79
79: ; preds = %77, %29
%80 = tail call i32 @fclose(i32* %27)
%81 = tail call i32 @free(i8* %24)
%82 = tail call i32 @free(i8* null)
ret i32 0
}