#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int rdcomc(int /*<<< orphan*/, char **, int *, float *, int *, int *, int, int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
char *strstr(char *, char *);
main(int argc, char *argv[]) {
  char *filename, ofname[100] = "PG", *cptr;
  FILE *fp, *ofp;
  float vals[10];
  char *wrdpp[10];
  int item[20];
  int nwrd, nval, irc;
  char line[81];
  int ghost_code = 0, pgplot_code = 0;
  if (argc < 2) {
    printf("Enter GHOST source file: ");
    if (!(irc = rdcomc(stdin, wrdpp, &nwrd, vals, &nval, item, 10, 10))) {
      printf("Error reading input\n");
      exit(1);
    } else if (irc < 0) {
      exit(0);
    } else {
      filename = wrdpp[0];
    }
  } else {
    filename = argv[1];
  }
  if (!(fp = fopen(filename, "r"))) {
    printf("Error opening file %s\n", filename);
    exit(1);
  } else {
    strcat(ofname, filename);
    if (!(ofp = fopen(ofname, "w"))) {
      printf("Error opening output file %s\n", ofname);
      exit(1);
    }
    while (1) {
      if (fgets(line, 80, fp) == NULL)
        if (feof(fp)) {
          fclose(fp);
          fclose(ofp);
          exit(0);
        } else {
          printf("Error reading input file\n");
          exit(1);
        }
      else {
        if (cptr = strstr(line, "c++++++++"))
          fprintf(ofp, "%s", line);
        if (cptr = strstr(line, "++GHOST++")) {
          pgplot_code = 0;
          ghost_code = 1;
        } else if (cptr = strstr(line, "++PGPLOT++")) {
          ghost_code = 0;
          pgplot_code = 1;
        } else if (cptr = strstr(line, "++END++")) {
          ghost_code = 0;
          pgplot_code = 0;
        } else {
          if (line[0] == 'C') {
            fprintf(ofp, "%s", line);
          } else if (pgplot_code) {
            fprintf(ofp, "%s", (line + 1));
          } else if (ghost_code) {
            fprintf(ofp, "c%s", line);
          } else {
            fprintf(ofp, "%s", line);
          }
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movb   $0x50,-0x80(%rbp)
movb   $0x47,-0x7f(%rbp)
movl   $0x0,-0x1c4(%rbp)
movl   $0x0,-0x1c8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    129d <main+0xed>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
lea    -0x110(%rbp),%rsi
lea    -0xc0(%rbp),%rcx
lea    -0x160(%rbp),%r9
lea    -0x164(%rbp),%rdx
lea    -0x168(%rbp),%r8
movl   $0xa,(%rsp)
movl   $0xa,0x8(%rsp)
call   1070 <rdcomc@plt>
mov    %eax,-0x16c(%rbp)
cmp    $0x0,%eax
jne    1274 <main+0xc4>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x16c(%rbp)
jge    1288 <main+0xd8>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    -0x110(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1298 <main+0xe8>
jmp    12a9 <main+0xf9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xd7b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x90(%rbp)
cmp    $0x0,%rax
jne    12e6 <main+0x136>
mov    -0x18(%rbp),%rsi
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <strcat@plt>
lea    -0x80(%rbp),%rdi
lea    0xd4a(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmp    $0x0,%rax
jne    1330 <main+0x180>
lea    -0x80(%rbp),%rsi
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    1335 <main+0x185>
lea    -0x1c0(%rbp),%rdi
mov    -0x90(%rbp),%rdx
mov    $0x50,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    13a4 <main+0x1f4>
mov    -0x90(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%rax
je     138c <main+0x1dc>
mov    -0x90(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x98(%rbp),%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    0xcd5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    -0x1c0(%rbp),%rdi
lea    0xcd0(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x88(%rbp)
cmp    $0x0,%rax
je     13e2 <main+0x232>
mov    -0x98(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
lea    0xccd(%rip),%rsi
call   1080 <fprintf@plt>
lea    -0x1c0(%rbp),%rdi
lea    0xc9c(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x88(%rbp)
cmp    $0x0,%rax
je     141f <main+0x26f>
movl   $0x0,-0x1c8(%rbp)
movl   $0x1,-0x1c4(%rbp)
jmp    1557 <main+0x3a7>
lea    -0x1c0(%rbp),%rdi
lea    0xc69(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x88(%rbp)
cmp    $0x0,%rax
je     145c <main+0x2ac>
movl   $0x0,-0x1c4(%rbp)
movl   $0x1,-0x1c8(%rbp)
jmp    1552 <main+0x3a2>
lea    -0x1c0(%rbp),%rdi
lea    0xc37(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x88(%rbp)
cmp    $0x0,%rax
je     1499 <main+0x2e9>
movl   $0x0,-0x1c4(%rbp)
movl   $0x0,-0x1c8(%rbp)
jmp    154d <main+0x39d>
movsbl -0x1c0(%rbp),%eax
cmp    $0x43,%eax
jne    14c8 <main+0x318>
mov    -0x98(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
lea    0xbec(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1548 <main+0x398>
cmpl   $0x0,-0x1c8(%rbp)
je     14f8 <main+0x348>
mov    -0x98(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
add    $0x1,%rdx
lea    0xbbc(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1543 <main+0x393>
cmpl   $0x0,-0x1c4(%rbp)
je     1524 <main+0x374>
mov    -0x98(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
lea    0xb8f(%rip),%rsi
call   1080 <fprintf@plt>
jmp    153e <main+0x38e>
mov    -0x98(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
lea    0xb71(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1543 <main+0x393>
jmp    1548 <main+0x398>
jmp    154d <main+0x39d>
jmp    1552 <main+0x3a2>
jmp    1557 <main+0x3a7>
jmp    155c <main+0x3ac>
jmp    1335 <main+0x185>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x70(%rsp)
movw   $0x4750,0x10(%rsp)
cmp    $0x1,%edi
jg     125c <main+0x9c>
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
lea    0xe0(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x130(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x160(%rsp),%r9
push   $0xa
push   $0xa
call   1080 <rdcomc@plt>
add    $0x10,%rsp
test   %eax,%eax
jne    12c4 <main+0x104>
lea    0xe40(%rip),%rdi
jmp    1302 <main+0x142>
mov    0x8(%rsi),%rbx
lea    0xdb3(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
jne    1280 <main+0xc0>
lea    0xda1(%rip),%rdi
mov    %rbx,%rsi
jmp    12b3 <main+0xf3>
mov    %rax,%r13
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10c0 <strcat@plt>
lea    0xd99(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
jne    12cd <main+0x10d>
lea    0xd87(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jns    1311 <main+0x151>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    %rax,%r14
lea    0x80(%rsp),%rdi
mov    $0x50,%esi
mov    %r13,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
jne    131e <main+0x15e>
mov    %r13,%rdi
call   10a0 <feof@plt>
test   %rax,%rax
jne    142e <main+0x26e>
lea    0xd7c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0xe0(%rsp),%rbx
jmp    1260 <main+0xa0>
xor    %r12d,%r12d
lea    0x80(%rsp),%rbx
lea    0xd2d(%rip),%rbp
xor    %r15d,%r15d
jmp    135e <main+0x19e>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %r12d,%r12d
mov    $0x1,%r15d
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r13,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     12ea <main+0x12a>
mov    %rbx,%rdi
lea    0xceb(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     137d <main+0x1bd>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
jne    1340 <main+0x180>
mov    %rbx,%rdi
lea    0xcd0(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     13ac <main+0x1ec>
xor    %r15d,%r15d
mov    $0x1,%r12d
jmp    1349 <main+0x189>
mov    %rbx,%rdi
lea    0xcbc(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     13c8 <main+0x208>
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    1349 <main+0x189>
cmpb   $0x43,0x80(%rsp)
43
jne    13e2 <main+0x222>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
jmp    1349 <main+0x189>
test   %r12d,%r12d
je     1402 <main+0x242>
lea    0x81(%rsp),%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
mov    $0x1,%r12d
jmp    1349 <main+0x189>
test   %r15d,%r15d
je     1421 <main+0x261>
mov    %r14,%rdi
lea    0xc69(%rip),%rsi
mov    %rbx,%rdx
call   1090 <fprintf@plt>
mov    $0x1,%r15d
jmp    13c3 <main+0x203>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
jmp    13c0 <main+0x200>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Enter GHOST source file: \00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"Error reading input\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [23 x i8] c"Error opening file %s\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [30 x i8] c"Error opening output file %s\0A\00"
@.str.6 = [26 x i8] c"Error reading input file\0A\00"
@.str.7 = [10 x i8] c"c++++++++\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [10 x i8] c"++GHOST++\00"
@.str.10 = [11 x i8] c"++PGPLOT++\00"
@.str.11 = [8 x i8] c"++END++\00"
@.str.12 = [4 x i8] c"c%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [100 x i8]
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [10 x float]
%12 = alloca [10 x i8*]
%13 = alloca [20 x i32]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [81 x i8]
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = bitcast [100 x i8]* %7 to i8*
%21 = bitcast i8* %20 to [100 x i8]*
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %21, i32 0, i32 0
store i8 80, i8* %22
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %21, i32 0, i32 1
store i8 71, i8* %23
store i32 0, i32* %18
store i32 0, i32* %19
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 2
br i1 %25, label %26, label %47
26: ; preds = %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%28 = load i32, i32* @stdin
%29 = getelementptr inbounds [10 x i8*], [10 x i8*]* %12, i64 0, i64 0
%30 = getelementptr inbounds [10 x float], [10 x float]* %11, i64 0, i64 0
%31 = getelementptr inbounds [20 x i32], [20 x i32]* %13, i64 0, i64 0
%32 = call i32 @rdcomc(i32 %28, i8** %29, i32* %14, float* %30, i32* %15, i32* %31, i32 10, i32 10)
store i32 %32, i32* %16
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %26
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %26
%38 = load i32, i32* %16
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 @exit(i32 0)
unreachable
42: ; preds = %37
%43 = getelementptr inbounds [10 x i8*], [10 x i8*]* %12, i64 0, i64 0
%44 = load i8*, i8** %43
store i8* %44, i8** %6
br label %45
45: ; preds = %42
br label %46
46: ; preds = %45
br label %51
47: ; preds = %2
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
store i8* %50, i8** %6
br label %51
51: ; preds = %47, %46
%52 = load i8*, i8** %6
%53 = call i32* @fopen(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %53, i32** %9
%54 = icmp ne i32* %53, null
br i1 %54, label %59, label %55
55: ; preds = %51
%56 = load i8*, i8** %6
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %51
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%61 = load i8*, i8** %6
%62 = call i32 @strcat(i8* %60, i8* %61)
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%64 = call i32* @fopen(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %64, i32** %10
%65 = icmp ne i32* %64, null
br i1 %65, label %70, label %66
66: ; preds = %59
%67 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %67)
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %59
br label %71
71: ; preds = %70, %146
%72 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%73 = load i32*, i32** %9
%74 = call i32* @fgets(i8* %72, i32 80, i32* %73)
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %89
76: ; preds = %71
%77 = load i32*, i32** %9
%78 = call i64 @feof(i32* %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %86
80: ; preds = %76
%81 = load i32*, i32** %9
%82 = call i32 @fclose(i32* %81)
%83 = load i32*, i32** %10
%84 = call i32 @fclose(i32* %83)
%85 = call i32 @exit(i32 0)
unreachable
86: ; preds = %76
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%88 = call i32 @exit(i32 1)
unreachable
89: ; preds = %71
%90 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%91 = call i8* @strstr(i8* %90, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
store i8* %91, i8** %8
%92 = icmp ne i8* %91, null
br i1 %92, label %93, label %97
93: ; preds = %89
%94 = load i32*, i32** %10
%95 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%96 = call i32 @fprintf(i32* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %95)
br label %97
97: ; preds = %93, %89
%98 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%99 = call i8* @strstr(i8* %98, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
store i8* %99, i8** %8
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %102
101: ; preds = %97
store i32 0, i32* %19
store i32 1, i32* %18
br label %145
102: ; preds = %97
%103 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%104 = call i8* @strstr(i8* %103, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
store i8* %104, i8** %8
%105 = icmp ne i8* %104, null
br i1 %105, label %106, label %107
106: ; preds = %102
store i32 0, i32* %18
store i32 1, i32* %19
br label %144
107: ; preds = %102
%108 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%109 = call i8* @strstr(i8* %108, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
store i8* %109, i8** %8
%110 = icmp ne i8* %109, null
br i1 %110, label %111, label %112
111: ; preds = %107
store i32 0, i32* %18
store i32 0, i32* %19
br label %143
112: ; preds = %107
%113 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp eq i32 %115, 67
br i1 %116, label %117, label %121
117: ; preds = %112
%118 = load i32*, i32** %10
%119 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%120 = call i32 @fprintf(i32* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %119)
br label %142
121: ; preds = %112
%122 = load i32, i32* %19
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %129
124: ; preds = %121
%125 = load i32*, i32** %10
%126 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%127 = getelementptr inbounds i8, i8* %126, i64 1
%128 = call i32 @fprintf(i32* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %127)
br label %141
129: ; preds = %121
%130 = load i32, i32* %18
%131 = icmp ne i32 %130, 0
br i1 %131, label %132, label %136
132: ; preds = %129
%133 = load i32*, i32** %10
%134 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%135 = call i32 @fprintf(i32* %133, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %134)
br label %140
136: ; preds = %129
%137 = load i32*, i32** %10
%138 = getelementptr inbounds [81 x i8], [81 x i8]* %17, i64 0, i64 0
%139 = call i32 @fprintf(i32* %137, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %138)
br label %140
140: ; preds = %136, %132
br label %141
141: ; preds = %140, %124
br label %142
142: ; preds = %141, %117
br label %143
143: ; preds = %142, %111
br label %144
144: ; preds = %143, %106
br label %145
145: ; preds = %144, %101
br label %146
146: ; preds = %145
br label %71
}

LLVM IR (-O2):
@.str = [26 x i8] c"Enter GHOST source file: \00"
@stdin = global i32 0
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [23 x i8] c"Error opening file %s\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [30 x i8] c"Error opening output file %s\0A\00"
@.str.7 = [10 x i8] c"c++++++++\00"
@.str.9 = [10 x i8] c"++GHOST++\00"
@.str.10 = [11 x i8] c"++PGPLOT++\00"
@.str.11 = [8 x i8] c"++END++\00"
@.str.12 = [4 x i8] c"c%s\00"
@str = [25 x i8] c"Error reading input file\00"
@str.13 = [20 x i8] c"Error reading input\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [10 x float]
%5 = alloca [10 x i8*]
%6 = alloca [20 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [81 x i8]
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
store i8 80, i8* %10
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 1
store i8 71, i8* %11
%12 = bitcast [10 x float]* %4 to i8*
%13 = bitcast [10 x i8*]* %5 to i8*
%14 = bitcast [20 x i32]* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%18 = icmp slt i32 %0, 2
br i1 %18, label %19, label %36
19: ; preds = %2
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @stdin
%22 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 0
%23 = getelementptr inbounds [10 x float], [10 x float]* %4, i64 0, i64 0
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%25 = call i32 @rdcomc(i32 %21, i8** %22, i32* %7, float* %23, i32* %8, i32* %24, i32 10, i32 10)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %19
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.13, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %19
%31 = icmp slt i32 %25, 0
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = call i32 @exit(i32 0)
unreachable
34: ; preds = %30
%35 = load i8*, i8** %22
br label %39
36: ; preds = %2
%37 = getelementptr inbounds i8*, i8** %1, i64 1
%38 = load i8*, i8** %37
br label %39
39: ; preds = %36, %34
%40 = phi i8* [ %35, %34 ], [ %38, %36 ]
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %39
%47 = call i32 @strcat(i8* %10, i8* %40)
%48 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp eq i32* %48, null
br i1 %49, label %55, label %50
50: ; preds = %46
%51 = call i32* @fgets(i8* %17, i32 80, i32* %41)
%52 = icmp eq i32* %51, null
br i1 %52, label %58, label %53
53: ; preds = %50
%54 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 1
br label %68
55: ; preds = %46
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %99, %50
%59 = call i64 @feof(i32* %41)
%60 = icmp eq i64 %59, 0
br i1 %60, label %65, label %61
61: ; preds = %58
%62 = call i32 @fclose(i32* %41)
%63 = call i32 @fclose(i32* %48)
%64 = call i32 @exit(i32 0)
unreachable
65: ; preds = %58
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %53, %99
%69 = phi i32 [ 0, %53 ], [ %101, %99 ]
%70 = phi i32 [ 0, %53 ], [ %100, %99 ]
%71 = call i8* @strstr(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%72 = icmp eq i8* %71, null
br i1 %72, label %75, label %73
73: ; preds = %68
%74 = call i32 @fputs(i8* %17, i32* %48)
br label %75
75: ; preds = %73, %68
%76 = call i8* @strstr(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%77 = icmp eq i8* %76, null
br i1 %77, label %78, label %99
78: ; preds = %75
%79 = call i8* @strstr(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%80 = icmp eq i8* %79, null
br i1 %80, label %81, label %99
81: ; preds = %78
%82 = call i8* @strstr(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%83 = icmp eq i8* %82, null
br i1 %83, label %84, label %99
84: ; preds = %81
%85 = load i8, i8* %17
%86 = icmp eq i8 %85, 67
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = call i32 @fputs(i8* %17, i32* %48)
br label %99
89: ; preds = %84
%90 = icmp eq i32 %69, 0
br i1 %90, label %93, label %91
91: ; preds = %89
%92 = call i32 @fputs(i8* %54, i32* %48)
br label %99
93: ; preds = %89
%94 = icmp eq i32 %70, 0
br i1 %94, label %97, label %95
95: ; preds = %93
%96 = call i32 @fprintf(i32* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %17)
br label %99
97: ; preds = %93
%98 = call i32 @fputs(i8* %17, i32* %48)
br label %99
99: ; preds = %81, %78, %75, %91, %97, %95, %87
%100 = phi i32 [ %70, %87 ], [ %70, %91 ], [ 1, %95 ], [ 0, %97 ], [ 1, %75 ], [ 0, %78 ], [ 0, %81 ]
%101 = phi i32 [ %69, %87 ], [ 1, %91 ], [ 0, %95 ], [ 0, %97 ], [ 0, %75 ], [ 1, %78 ], [ 0, %81 ]
%102 = call i32* @fgets(i8* %17, i32 80, i32* %41)
%103 = icmp eq i32* %102, null
br i1 %103, label %58, label %68
}