#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*/ initfunc;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ esc(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strlen(char *);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  char *name;
  FILE *fin;
  char buf[1024], initfunc[1024], *p, *q;
  if (argc != 2) {
    fprintf(stderr, "usage: mkbuiltin1 sys\n");
    fprintf(stderr, "in file $1.6 s/PACKAGE/$1/\n");
    exit(1);
  }
  name = argv[1];
  snprintf(initfunc, sizeof(initfunc), "init_%s_function", name);
  snprintf(buf, sizeof(buf), "%s.%s", name, getenv("O"));
  if ((fin = fopen(buf, "r")) == NULL) {
    fprintf(stderr, "open %s: %s\n", buf, strerror(errno));
    exit(1);
  }
  while (fgets(buf, sizeof buf, fin) != NULL)
    if (strstr(buf, "$$"))
      goto begin;
  fprintf(stderr, "did not find beginning of imports\n");
  exit(1);
begin:
  printf("char *%simport =\n", name);
  while (fgets(buf, sizeof buf, fin) != NULL) {
    buf[strlen(buf) - 1] = 0;
    if (strstr(buf, "$$"))
      goto end;
    for (p = buf; *p == ' ' || *p == '\t'; p++)
      ;
    if (strstr(buf, initfunc))
      continue;
    printf("\t\"");
    while (q = strstr(p, "PACKAGE")) {
      *q = 0;
      esc(p);
      printf("%s", name);
      p = q + 7;
    }
    esc(p);
    printf("\\n\"\n", p);
  }
  fprintf(stderr, "did not find end of imports\n");
  exit(1);
end:
  printf("\t\"$$\\n\";\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     120b <main+0x5b>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x400,%esi
lea    0xe05(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x420(%rbp),%rax
mov    %rax,-0x840(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x838(%rbp)
lea    0xdf5(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x840(%rbp),%rdi
mov    -0x838(%rbp),%rcx
mov    %rax,%r8
mov    $0x400,%esi
lea    0xdcd(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    12f2 <main+0x142>
mov    0x2d3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84c(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x848(%rbp)
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x84c(%rbp),%edi
mov    -0x848(%rbp),%rdx
mov    %rax,%rcx
lea    0xd6d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
jmp    12f7 <main+0x147>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     133d <main+0x18d>
lea    -0x420(%rbp),%rdi
lea    0xd37(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     1338 <main+0x188>
jmp    135e <main+0x1ae>
jmp    12f7 <main+0x147>
mov    0x2c9c(%rip),%rax
mov    (%rax),%edi
lea    0xd11(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%rsi
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     14f1 <main+0x341>
lea    -0x420(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rdi
lea    0xca5(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     13ca <main+0x21a>
jmp    1512 <main+0x362>
lea    -0x420(%rbp),%rax
mov    %rax,-0x828(%rbp)
mov    -0x828(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x84d(%rbp)
je     1409 <main+0x259>
mov    -0x828(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x84d(%rbp)
mov    -0x84d(%rbp),%al
test   $0x1,%al
jne    141c <main+0x26c>
jmp    1438 <main+0x288>
jmp    1421 <main+0x271>
mov    -0x828(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x828(%rbp)
jmp    13d8 <main+0x228>
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     145a <main+0x2aa>
jmp    1370 <main+0x1c0>
lea    0xc32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x828(%rbp),%rdi
lea    0xc20(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x830(%rbp)
cmp    $0x0,%rax
je     14cb <main+0x31b>
mov    -0x830(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x828(%rbp),%rdi
call   1090 <esc@plt>
mov    -0x18(%rbp),%rsi
lea    0xb9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x830(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x828(%rbp)
jmp    1468 <main+0x2b8>
mov    -0x828(%rbp),%rdi
call   1090 <esc@plt>
mov    -0x828(%rbp),%rsi
lea    0xbb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1370 <main+0x1c0>
mov    0x2ae8(%rip),%rax
mov    (%rax),%edi
lea    0xba2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xba7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
cmp    $0x2,%edi
jne    142b <main+0x26b>
mov    0x8(%rsi),%rbx
lea    0xe4e(%rip),%rdx
lea    0x410(%rsp),%rdi
mov    $0x400,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
lea    0xe47(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe35(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %rbx,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1070 <snprintf@plt>
lea    0xe1c(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     144d <main+0x28d>
mov    %rax,%rbp
lea    0x10(%rsp),%r15
lea    0xe0b(%rip),%r14
mov    %r15,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13f8 <main+0x238>
mov    %r15,%rdi
mov    %r14,%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     1250 <main+0x90>
lea    0xe01(%rip),%rdi
mov    %rbx,(%rsp)
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     140a <main+0x24a>
lea    0xda8(%rip),%r14
lea    0xddc(%rip),%r12
mov    %rbp,0x8(%rsp)
mov    (%rsp),%r13
jmp    1309 <main+0x149>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   10a0 <esc@plt>
lea    0xddc(%rip),%rdi
call   1040 <puts@plt>
lea    0xd70(%rip),%r14
mov    %rbp,%r12
mov    %rbx,%rdi
mov    $0x400,%esi
mov    0x8(%rsp),%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     140a <main+0x24a>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
jne    13d8 <main+0x218>
mov    %rbx,%r15
jmp    1344 <main+0x184>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
movzbl (%r15),%eax
cmp    $0x20,%al
je     1340 <main+0x180>
cmp    $0x9,%al
je     1340 <main+0x180>
mov    %rbx,%rdi
lea    0x410(%rsp),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
jne    12ee <main+0x12e>
lea    0xd27(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rbp
mov    %r12,%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     12d0 <main+0x110>
mov    %rax,%r14
lea    0xcb3(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x0,(%r14)
mov    %r15,%rdi
call   10a0 <esc@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%r15
add    $0x7,%r15
mov    %r15,%rdi
mov    %rbp,%rsi
call   10e0 <strstr@plt>
mov    %rax,%r14
test   %rax,%rax
jne    13a0 <main+0x1e0>
jmp    12d0 <main+0x110>
lea    0xce0(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
lea    0xc56(%rip),%rsi
jmp    141a <main+0x25a>
mov    0x2bcf(%rip),%rax
mov    (%rax),%edi
lea    0xc84(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2bae(%rip),%rbx
mov    (%rbx),%edi
lea    0xbc5(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
lea    0xbcc(%rip),%rsi
jmp    141a <main+0x25a>
mov    0x2b8c(%rip),%rax
mov    (%rax),%ebx
mov    0x2b7b(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xbe3(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"usage: mkbuiltin1 sys\0A\00"
@.str.1 = [28 x i8] c"in file $1.6 s/PACKAGE/$1/\0A\00"
@.str.2 = [17 x i8] c"init_%s_function\00"
@.str.3 = [6 x i8] c"%s.%s\00"
@.str.4 = [2 x i8] c"O\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [13 x i8] c"open %s: %s\0A\00"
@errno = global i32 0
@.str.7 = [3 x i8] c"$$\00"
@.str.8 = [35 x i8] c"did not find beginning of imports\0A\00"
@.str.9 = [18 x i8] c"char *%simport =\0A\00"
@.str.10 = [3 x i8] c"\09\22\00"
@.str.11 = [8 x i8] c"PACKAGE\00"
@.str.12 = [3 x i8] c"%s\00"
@.str.13 = [5 x i8] c"\\n\22\0A\00"
@.str.14 = [29 x i8] c"did not find end of imports\0A\00"
@.str.15 = [10 x i8] c"\09\22$$\\n\22;\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %6
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%25 = load i8*, i8** %6
%26 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %24, i32 1024, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%28 = load i8*, i8** %6
%29 = call i8* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %27, i32 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %28, i8* %29)
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %32, i32** %7
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %41
34: ; preds = %20
%35 = load i32, i32* @stderr
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%37 = load i32, i32* @errno
%38 = call i8* @strerror(i32 %37)
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %36, i8* %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %20
br label %42
42: ; preds = %52, %41
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%44 = load i32*, i32** %7
%45 = call i32* @fgets(i8* %43, i32 1024, i32* %44)
%46 = icmp ne i32* %45, null
br i1 %46, label %47, label %53
47: ; preds = %42
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%49 = call i8* @strstr(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %52
51: ; preds = %47
br label %57
52: ; preds = %47
br label %42
53: ; preds = %42
%54 = load i32, i32* @stderr
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %51
%58 = load i8*, i8** %6
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %113, %98, %57
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%62 = load i32*, i32** %7
%63 = call i32* @fgets(i8* %61, i32 1024, i32* %62)
%64 = icmp ne i32* %63, null
br i1 %64, label %65, label %118
65: ; preds = %60
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%67 = call i32 @strlen(i8* %66)
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %69
store i8 0, i8* %70
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%72 = call i8* @strstr(i8* %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%73 = icmp ne i8* %72, null
br i1 %73, label %74, label %75
74: ; preds = %65
br label %122
75: ; preds = %65
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
store i8* %76, i8** %10
br label %77
77: ; preds = %90, %75
%78 = load i8*, i8** %10
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 32
br i1 %81, label %87, label %82
82: ; preds = %77
%83 = load i8*, i8** %10
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = icmp eq i32 %85, 9
br label %87
87: ; preds = %82, %77
%88 = phi i1 [ true, %77 ], [ %86, %82 ]
br i1 %88, label %89, label %93
89: ; preds = %87
br label %90
90: ; preds = %89
%91 = load i8*, i8** %10
%92 = getelementptr inbounds i8, i8* %91, i32 1
store i8* %92, i8** %10
br label %77
93: ; preds = %87
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%96 = call i8* @strstr(i8* %94, i8* %95)
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %99
98: ; preds = %93
br label %60
99: ; preds = %93
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %101
101: ; preds = %105, %99
%102 = load i8*, i8** %10
%103 = call i8* @strstr(i8* %102, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
store i8* %103, i8** %11
%104 = icmp ne i8* %103, null
br i1 %104, label %105, label %113
105: ; preds = %101
%106 = load i8*, i8** %11
store i8 0, i8* %106
%107 = load i8*, i8** %10
%108 = call i32 @esc(i8* %107)
%109 = load i8*, i8** %6
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %109)
%111 = load i8*, i8** %11
%112 = getelementptr inbounds i8, i8* %111, i64 7
store i8* %112, i8** %10
br label %101
113: ; preds = %101
%114 = load i8*, i8** %10
%115 = call i32 @esc(i8* %114)
%116 = load i8*, i8** %10
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %116)
br label %60
118: ; preds = %60
%119 = load i32, i32* @stderr
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
%121 = call i32 @exit(i32 1)
unreachable
122: ; preds = %74
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"usage: mkbuiltin1 sys\0A\00"
@.str.1 = [28 x i8] c"in file $1.6 s/PACKAGE/$1/\0A\00"
@.str.2 = [17 x i8] c"init_%s_function\00"
@.str.3 = [6 x i8] c"%s.%s\00"
@.str.4 = [2 x i8] c"O\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [13 x i8] c"open %s: %s\0A\00"
@errno = global i32 0
@.str.7 = [3 x i8] c"$$\00"
@.str.8 = [35 x i8] c"did not find beginning of imports\0A\00"
@.str.9 = [18 x i8] c"char *%simport =\0A\00"
@.str.10 = [3 x i8] c"\09\22\00"
@.str.11 = [8 x i8] c"PACKAGE\00"
@.str.12 = [3 x i8] c"%s\00"
@.str.14 = [29 x i8] c"did not find end of imports\0A\00"
@str = [4 x i8] c"\\n\22\00"
@str.16 = [9 x i8] c"\09\22$$\\n\22;\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 1024, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = call i8* @getenv(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %16, i8* %18)
%20 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %28
22: ; preds = %14
%23 = load i32, i32* @stderr
%24 = load i32, i32* @errno
%25 = call i8* @strerror(i32 %24)
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %5, i8* %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %14, %31
%29 = call i32* @fgets(i8* %5, i32 1024, i32* %20)
%30 = icmp eq i32* %29, null
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%33 = icmp eq i8* %32, null
br i1 %33, label %28, label %38
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %31
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %16)
%40 = call i32* @fgets(i8* %5, i32 1024, i32* %20)
%41 = icmp eq i32* %40, null
br i1 %41, label %76, label %42
42: ; preds = %38, %73
%43 = call i32 @strlen(i8* %5)
%44 = add nsw i32 %43, -1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %45
store i8 0, i8* %46
%47 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %80
49: ; preds = %42, %52
%50 = phi i8* [ %53, %52 ], [ %5, %42 ]
%51 = load i8, i8* %50
switch i8 %51, label %54 [
i8 32, label %52
i8 9, label %52
]
52: ; preds = %49, %49
%53 = getelementptr inbounds i8, i8* %50, i64 1
br label %49
54: ; preds = %49
%55 = call i8* @strstr(i8* %5, i8* %6)
%56 = icmp eq i8* %55, null
br i1 %56, label %57, label %73
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%59 = call i8* @strstr(i8* %50, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%60 = icmp eq i8* %59, null
br i1 %60, label %69, label %61
61: ; preds = %57, %61
%62 = phi i8* [ %67, %61 ], [ %59, %57 ]
%63 = phi i8* [ %66, %61 ], [ %50, %57 ]
store i8 0, i8* %62
%64 = call i32 @esc(i8* %63)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %16)
%66 = getelementptr inbounds i8, i8* %62, i64 7
%67 = call i8* @strstr(i8* %66, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%68 = icmp eq i8* %67, null
br i1 %68, label %69, label %61
69: ; preds = %61, %57
%70 = phi i8* [ %50, %57 ], [ %66, %61 ]
%71 = call i32 @esc(i8* %70)
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %73
73: ; preds = %69, %54
%74 = call i32* @fgets(i8* %5, i32 1024, i32* %20)
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %42
76: ; preds = %73, %38
%77 = load i32, i32* @stderr
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %42
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.16, i64 0, i64 0))
ret i32 0
}