#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*/ 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;
      printf("%s", p);
      printf("%s", name);
      p = q + 7;
    }
    printf("%s\\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     11fb <main+0x5b>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <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    0xe15(%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    0xe05(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x840(%rbp),%rdi
mov    -0x838(%rbp),%rcx
mov    %rax,%r8
mov    $0x400,%esi
lea    0xddd(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    12e2 <main+0x142>
mov    0x2d4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84c(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x848(%rbp)
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x84c(%rbp),%edi
mov    -0x848(%rbp),%rdx
mov    %rax,%rcx
lea    0xd7d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    12e7 <main+0x147>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     132d <main+0x18d>
lea    -0x420(%rbp),%rdi
lea    0xd47(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
je     1328 <main+0x188>
jmp    134e <main+0x1ae>
jmp    12e7 <main+0x147>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
lea    0xd21(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%rsi
lea    0xd28(%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     14de <main+0x33e>
lea    -0x420(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rdi
lea    0xcb5(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
je     13ba <main+0x21a>
jmp    14ff <main+0x35f>
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     13f9 <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    140c <main+0x26c>
jmp    1428 <main+0x288>
jmp    1411 <main+0x271>
mov    -0x828(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x828(%rbp)
jmp    13c8 <main+0x228>
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
je     144a <main+0x2aa>
jmp    1360 <main+0x1c0>
lea    0xc42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x828(%rbp),%rdi
lea    0xc30(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x830(%rbp)
cmp    $0x0,%rax
je     14c4 <main+0x324>
mov    -0x830(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x828(%rbp),%rsi
lea    0xbb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xba1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x830(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x828(%rbp)
jmp    1458 <main+0x2b8>
mov    -0x828(%rbp),%rsi
lea    0xbcc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1360 <main+0x1c0>
mov    0x2afb(%rip),%rax
mov    (%rax),%edi
lea    0xbb7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xbbc(%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    1400 <main+0x250>
mov    0x8(%rsi),%rbx
lea    0xe5e(%rip),%rdx
lea    0x410(%rsp),%rdi
mov    $0x400,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
lea    0xe57(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe45(%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    0xe2c(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1422 <main+0x272>
mov    %rax,%rbp
lea    0x10(%rsp),%r15
lea    0xe1b(%rip),%r14
mov    %r15,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13cd <main+0x21d>
mov    %r15,%rdi
mov    %r14,%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     1240 <main+0x90>
lea    0xe11(%rip),%rdi
mov    %rbx,0x8(%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     13df <main+0x22f>
lea    0xdb7(%rip),%r14
mov    0x8(%rsp),%r13
jmp    12e6 <main+0x136>
nopl   0x0(%rax,%rax,1)
lea    0xde7(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%rbx
lea    0xd8e(%rip),%r14
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13df <main+0x22f>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
jne    13ad <main+0x1fd>
mov    %rbx,%r15
jmp    1314 <main+0x164>
xchg   %ax,%ax
add    $0x1,%r15
movzbl (%r15),%eax
cmp    $0x20,%al
je     1310 <main+0x160>
cmp    $0x9,%al
je     1310 <main+0x160>
mov    %rbx,%rdi
lea    0x410(%rsp),%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
jne    12cd <main+0x11d>
lea    0xd57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
lea    0xd49(%rip),%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     12b0 <main+0x100>
mov    %rax,%r14
lea    0xd31(%rip),%rbx
lea    0xcdb(%rip),%r12
nopl   0x0(%rax)
movb   $0x0,(%r14)
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%r15
add    $0x7,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   10d0 <strstr@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1370 <main+0x1c0>
jmp    12b0 <main+0x100>
lea    0xd0e(%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    0x2c0c(%rip),%rax
mov    (%rax),%edi
lea    0xc81(%rip),%rsi
jmp    13ef <main+0x23f>
mov    0x2bfa(%rip),%rax
mov    (%rax),%edi
lea    0xcb6(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x2bd9(%rip),%rbx
mov    (%rbx),%edi
lea    0xbf0(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
lea    0xbf7(%rip),%rsi
jmp    13ef <main+0x23f>
mov    0x2bb7(%rip),%rax
mov    (%rax),%ebx
mov    0x2ba6(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc0e(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <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 = [7 x i8] c"%s\\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 %116
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 %120
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 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), 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 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* %114)
br label %60
116: ; preds = %60
%117 = load i32, i32* @stderr
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %74
%121 = 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.13 = [7 x i8] c"%s\\n\22\0A\00"
@.str.14 = [29 x i8] c"did not find end of imports\0A\00"
@str = [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 %75, label %42
42: ; preds = %38, %72
%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 %79
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 %72
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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* %70)
br label %72
72: ; preds = %69, %54
%73 = call i32* @fgets(i8* %5, i32 1024, i32* %20)
%74 = icmp eq i32* %73, null
br i1 %74, label %75, label %42
75: ; preds = %72, %38
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %42
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 0
}