#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 EOF;
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int getc(int /*<<< orphan*/ *);
int getopt_long(int, char *const *, char *, int /*<<< orphan*/ *,
                int /*<<< orphan*/ *);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int main(int argc, char *const argv[]) {
  int c;
  int ac = 0;
  int stack[10];
  int sp = 0;
  FILE *in = stdin;
  FILE *out = stdout;
  while ((c = getopt_long(argc, argv, "o:i:", NULL, NULL)) != -1)
    switch (c) {
    case 'o':
      out = fopen(optarg, "w");
      break;
    case 'i':
      in = fopen(optarg, "r");
      break;
    default:
      return 1;
    }
  if (optind != argc) {
    return 2;
  }
  fprintf(out, "P(init0, \"gt:istate\") ->\n");
  fprintf(out, "P(init0, \"gt:istate\")\n");
  c = getc(in);
  while (c != EOF) {
    switch (c) {
    case '+':
      fprintf(out, "T(init%i, \"iinc\", init%i)\n", ac, ac + 1);
      ac++;
      break;
    case '-':
      fprintf(out, "T(init%i, \"idec\", init%i)\n", ac, ac + 1);
      ac++;
      break;
    case '>':
      fprintf(out, "T(init%i, \"inext\", init%i)\n", ac, ac + 1);
      ac++;
      break;
    case '<':
      fprintf(out, "T(init%i, \"iprev\", init%i)\n", ac, ac + 1);
      ac++;
      break;
    case '.':
      fprintf(out, "T(init%i, \"iprint\", init%i)\n", ac, ac + 1);
      ac++;
      break;
    case ',':
      fprintf(out, "T(init%i, \"iinput\", init%i)\n", ac, ac + 1);
      ac++;
      break;
    case '[':
      stack[sp] = ac;
      ac++;
      sp++;
      break;
    case ']':
      sp--;
      fprintf(out, "T(init%i, \"imemz\", init%i)\n", stack[sp], ac + 1);
      fprintf(out, "T(init%i, \"imemz\", init%i)\n", ac, ac + 1);
      fprintf(out, "T(init%i, \"imemnz\", init%i)\n", stack[sp], stack[sp] + 1);
      fprintf(out, "T(init%i, \"imemnz\", init%i)\n", ac, stack[sp] + 1);
      ac++;
      break;
    }
    c = getc(in);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    0x2e47(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf3e(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1030 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1219 <main+0xd9>
mov    -0x14(%rbp),%eax
mov    %eax,-0x5c(%rbp)
sub    $0x69,%eax
je     11ea <main+0xaa>
jmp    11bb <main+0x7b>
mov    -0x5c(%rbp),%eax
sub    $0x6f,%eax
jne    1208 <main+0xc8>
jmp    11cc <main+0x8c>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xef5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x58(%rbp)
jmp    1214 <main+0xd4>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xed9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x50(%rbp)
jmp    1214 <main+0xd4>
movl   $0x1,-0x4(%rbp)
jmp    1464 <main+0x324>
jmp    1180 <main+0x40>
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     1237 <main+0xf7>
movl   $0x2,-0x4(%rbp)
jmp    1464 <main+0x324>
mov    -0x58(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x58(%rbp),%rdi
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x50(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2d67(%rip),%rcx
cmp    (%rcx),%eax
je     145d <main+0x31d>
mov    -0x14(%rbp),%eax
add    $0xffffffd5,%eax
mov    %eax,%ecx
mov    %rcx,-0x68(%rbp)
sub    $0x32,%eax
ja     144c <main+0x30c>
mov    -0x68(%rbp),%rax
lea    0xd67(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xe50(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    144c <main+0x30c>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    144c <main+0x30c>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    144c <main+0x30c>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xe27(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    144c <main+0x30c>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    144c <main+0x30c>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    144c <main+0x30c>
mov    -0x18(%rbp),%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    144c <main+0x30c>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
mov    -0x58(%rbp),%rdi
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x58(%rbp),%rdi
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
lea    0xdae(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x50(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x14(%rbp)
jmp    1267 <main+0x127>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e76(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
mov    0x2e47(%rip),%rax
mov    (%rax),%r12
lea    0xf49(%rip),%r15
mov    0x2e6e(%rip),%r14
lea    0xf40(%rip),%r13
jmp    11ae <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14),%edi
mov    %r13,%rsi
call   1050 <fopen@plt>
mov    %rax,%r12
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <getopt_long@plt>
cmp    $0x6f,%eax
je     11a0 <main+0x50>
cmp    $0xffffffff,%eax
je     11e9 <main+0x99>
cmp    $0x69,%eax
jne    1268 <main+0x118>
mov    (%r14),%edi
lea    0xef6(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,0x8(%rsp)
jmp    11ae <main+0x5e>
mov    0x2de0(%rip),%rax
mov    $0x2,%ecx
cmp    %ebp,(%rax)
mov    0x8(%rsp),%r14
jne    13a7 <main+0x257>
lea    0xecc(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1060 <fwrite@plt>
lea    0xecd(%rip),%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1060 <fwrite@plt>
mov    %r14,%rdi
call   1070 <getc@plt>
mov    0x2d95(%rip),%r13
xor    %ecx,%ecx
cmp    0x0(%r13),%eax
je     13a7 <main+0x257>
lea    0xdaa(%rip),%rbp
movl   $0x0,0x4(%rsp)
xor    %r15d,%r15d
mov    %r14,0x8(%rsp)
jmp    12a1 <main+0x151>
mov    $0x1,%ecx
jmp    13a7 <main+0x257>
lea    0x1(%r15),%ebx
mov    %r12,%rdi
lea    0xe86(%rip),%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%r15d
mov    %r14,%rdi
call   1070 <getc@plt>
cmp    0x0(%r13),%eax
je     13a5 <main+0x255>
add    $0xffffffd5,%eax
cmp    $0x32,%eax
ja     128f <main+0x13f>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
lea    0x1(%r15),%ebx
mov    %r12,%rdi
lea    0xed0(%rip),%rsi
jmp    1280 <main+0x130>
lea    0x1(%r15),%ebx
mov    %r12,%rdi
lea    0xe50(%rip),%rsi
jmp    1280 <main+0x130>
lea    0x1(%r15),%ebx
mov    %r12,%rdi
lea    0xe93(%rip),%rsi
jmp    1280 <main+0x130>
lea    0x1(%r15),%ebx
mov    %r12,%rdi
lea    0xe67(%rip),%rsi
jmp    1280 <main+0x130>
lea    0x1(%r15),%ebx
mov    %r12,%rdi
lea    0xe3b(%rip),%rsi
jmp    1280 <main+0x130>
mov    0x4(%rsp),%ecx
movslq %ecx,%rax
mov    %r15d,0x10(%rsp,%rax,4)
add    $0x1,%r15d
add    $0x1,%ecx
mov    %ecx,0x4(%rsp)
jmp    128f <main+0x13f>
mov    0x4(%rsp),%ecx
movslq %ecx,%rax
add    $0xffffffff,%ecx
mov    %ecx,0x4(%rsp)
mov    0xc(%rsp,%rax,4),%r13d
lea    0x1(%r15),%ebx
mov    %r12,%rdi
lea    0xe6b(%rip),%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r12,%rdi
lea    0xe55(%rip),%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbp,%r14
lea    0x1(%r13),%ebp
mov    %r12,%rdi
lea    0xe54(%rip),%rsi
mov    %r13d,%edx
mov    0x2c58(%rip),%r13
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r12,%rdi
lea    0xe37(%rip),%rsi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r14,%rbp
mov    0x8(%rsp),%r14
jmp    1285 <main+0x135>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@stdout = global i32* null
@.str = [5 x i8] c"o:i:\00"
@optarg = global i32 0
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"r\00"
@optind = global i32 0
@.str.3 = [26 x i8] c"P(init0, \22gt:istate\22) ->\0A\00"
@.str.4 = [23 x i8] c"P(init0, \22gt:istate\22)\0A\00"
@EOF = global i32 0
@.str.5 = [27 x i8] c"T(init%i, \22iinc\22, init%i)\0A\00"
@.str.6 = [27 x i8] c"T(init%i, \22idec\22, init%i)\0A\00"
@.str.7 = [28 x i8] c"T(init%i, \22inext\22, init%i)\0A\00"
@.str.8 = [28 x i8] c"T(init%i, \22iprev\22, init%i)\0A\00"
@.str.9 = [29 x i8] c"T(init%i, \22iprint\22, init%i)\0A\00"
@.str.10 = [29 x i8] c"T(init%i, \22iinput\22, init%i)\0A\00"
@.str.11 = [28 x i8] c"T(init%i, \22imemz\22, init%i)\0A\00"
@.str.12 = [29 x i8] c"T(init%i, \22imemnz\22, init%i)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10 x i32]
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %9
%12 = load i32*, i32** @stdin
store i32* %12, i32** %10
%13 = load i32*, i32** @stdout
store i32* %13, i32** %11
br label %14
14: ; preds = %28, %2
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @getopt_long(i32 %15, i8** %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* null, i32* null)
store i32 %17, i32* %6
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %29
19: ; preds = %14
%20 = load i32, i32* %6
switch i32 %20, label %27 [
i32 111, label %21
i32 105, label %24
]
21: ; preds = %19
%22 = load i32, i32* @optarg
%23 = call i32* @fopen(i32 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %11
br label %28
24: ; preds = %19
%25 = load i32, i32* @optarg
%26 = call i32* @fopen(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %26, i32** %10
br label %28
27: ; preds = %19
store i32 1, i32* %3
br label %145
28: ; preds = %24, %21
br label %14
29: ; preds = %14
%30 = load i32, i32* @optind
%31 = load i32, i32* %4
%32 = icmp ne i32 %30, %31
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 2, i32* %3
br label %145
34: ; preds = %29
%35 = load i32*, i32** %11
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%37 = load i32*, i32** %11
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%39 = load i32*, i32** %10
%40 = call i32 @getc(i32* %39)
store i32 %40, i32* %6
br label %41
41: ; preds = %141, %34
%42 = load i32, i32* %6
%43 = load i32, i32* @EOF
%44 = icmp ne i32 %42, %43
br i1 %44, label %45, label %144
45: ; preds = %41
%46 = load i32, i32* %6
switch i32 %46, label %141 [
i32 43, label %47
i32 45, label %55
i32 62, label %63
i32 60, label %71
i32 46, label %79
i32 44, label %87
i32 91, label %95
i32 93, label %104
]
47: ; preds = %45
%48 = load i32*, i32** %11
%49 = load i32, i32* %7
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %49, i32 %51)
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %141
55: ; preds = %45
%56 = load i32*, i32** %11
%57 = load i32, i32* %7
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %57, i32 %59)
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %141
63: ; preds = %45
%64 = load i32*, i32** %11
%65 = load i32, i32* %7
%66 = load i32, i32* %7
%67 = add nsw i32 %66, 1
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %64, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %65, i32 %67)
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 1
store i32 %70, i32* %7
br label %141
71: ; preds = %45
%72 = load i32*, i32** %11
%73 = load i32, i32* %7
%74 = load i32, i32* %7
%75 = add nsw i32 %74, 1
%76 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %73, i32 %75)
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 1
store i32 %78, i32* %7
br label %141
79: ; preds = %45
%80 = load i32*, i32** %11
%81 = load i32, i32* %7
%82 = load i32, i32* %7
%83 = add nsw i32 %82, 1
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %81, i32 %83)
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 1
store i32 %86, i32* %7
br label %141
87: ; preds = %45
%88 = load i32*, i32** %11
%89 = load i32, i32* %7
%90 = load i32, i32* %7
%91 = add nsw i32 %90, 1
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i32 %89, i32 %91)
%93 = load i32, i32* %7
%94 = add nsw i32 %93, 1
store i32 %94, i32* %7
br label %141
95: ; preds = %45
%96 = load i32, i32* %7
%97 = load i32, i32* %9
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %98
store i32 %96, i32* %99
%100 = load i32, i32* %7
%101 = add nsw i32 %100, 1
store i32 %101, i32* %7
%102 = load i32, i32* %9
%103 = add nsw i32 %102, 1
store i32 %103, i32* %9
br label %141
104: ; preds = %45
%105 = load i32, i32* %9
%106 = add nsw i32 %105, -1
store i32 %106, i32* %9
%107 = load i32*, i32** %11
%108 = load i32, i32* %9
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %109
%111 = load i32, i32* %110
%112 = load i32, i32* %7
%113 = add nsw i32 %112, 1
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %111, i32 %113)
%115 = load i32*, i32** %11
%116 = load i32, i32* %7
%117 = load i32, i32* %7
%118 = add nsw i32 %117, 1
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %116, i32 %118)
%120 = load i32*, i32** %11
%121 = load i32, i32* %9
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %122
%124 = load i32, i32* %123
%125 = load i32, i32* %9
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %126
%128 = load i32, i32* %127
%129 = add nsw i32 %128, 1
%130 = call i32 (i32*, i8*, ...) @fprintf(i32* %120, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %124, i32 %129)
%131 = load i32*, i32** %11
%132 = load i32, i32* %7
%133 = load i32, i32* %9
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %134
%136 = load i32, i32* %135
%137 = add nsw i32 %136, 1
%138 = call i32 (i32*, i8*, ...) @fprintf(i32* %131, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %132, i32 %137)
%139 = load i32, i32* %7
%140 = add nsw i32 %139, 1
store i32 %140, i32* %7
br label %141
141: ; preds = %45, %104, %95, %87, %79, %71, %63, %55, %47
%142 = load i32*, i32** %10
%143 = call i32 @getc(i32* %142)
store i32 %143, i32* %6
br label %41
144: ; preds = %41
store i32 0, i32* %3
br label %145
145: ; preds = %144, %33, %27
%146 = load i32, i32* %3
ret i32 %146
}

LLVM IR (-O2):
@stdin = global i32* null
@stdout = global i32* null
@.str = [5 x i8] c"o:i:\00"
@optarg = global i32 0
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"r\00"
@optind = global i32 0
@.str.3 = [26 x i8] c"P(init0, \22gt:istate\22) ->\0A\00"
@.str.4 = [23 x i8] c"P(init0, \22gt:istate\22)\0A\00"
@EOF = global i32 0
@.str.5 = [27 x i8] c"T(init%i, \22iinc\22, init%i)\0A\00"
@.str.6 = [27 x i8] c"T(init%i, \22idec\22, init%i)\0A\00"
@.str.7 = [28 x i8] c"T(init%i, \22inext\22, init%i)\0A\00"
@.str.8 = [28 x i8] c"T(init%i, \22iprev\22, init%i)\0A\00"
@.str.9 = [29 x i8] c"T(init%i, \22iprint\22, init%i)\0A\00"
@.str.10 = [29 x i8] c"T(init%i, \22iinput\22, init%i)\0A\00"
@.str.11 = [28 x i8] c"T(init%i, \22imemz\22, init%i)\0A\00"
@.str.12 = [29 x i8] c"T(init%i, \22imemnz\22, init%i)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = load i32*, i32** @stdin
%6 = load i32*, i32** @stdout
br label %7
7: ; preds = %16, %2
%8 = phi i32* [ %18, %16 ], [ %5, %2 ]
%9 = phi i32* [ %11, %16 ], [ %6, %2 ]
br label %10
10: ; preds = %7, %13
%11 = phi i32* [ %15, %13 ], [ %9, %7 ]
%12 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* null, i32* null)
switch i32 %12, label %72 [
i32 -1, label %19
i32 111, label %13
i32 105, label %16
]
13: ; preds = %10
%14 = load i32, i32* @optarg
%15 = tail call i32* @fopen(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %10
16: ; preds = %10
%17 = load i32, i32* @optarg
%18 = tail call i32* @fopen(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %7
19: ; preds = %10
%20 = load i32, i32* @optind
%21 = icmp eq i32 %20, %0
br i1 %21, label %22, label %72
22: ; preds = %19
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 25, i64 1, i32* %11)
%24 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i64 22, i64 1, i32* %11)
%25 = tail call i32 @getc(i32* %8)
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %72, label %28
28: ; preds = %22, %66
%29 = phi i32 [ %68, %66 ], [ 0, %22 ]
%30 = phi i32 [ %67, %66 ], [ 0, %22 ]
%31 = phi i32 [ %69, %66 ], [ %25, %22 ]
switch i32 %31, label %66 [
i32 43, label %32
i32 45, label %35
i32 62, label %38
i32 60, label %41
i32 46, label %44
i32 44, label %47
i32 91, label %50
i32 93, label %55
]
32: ; preds = %28
%33 = add nsw i32 %30, 1
%34 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %30, i32 %33)
br label %66
35: ; preds = %28
%36 = add nsw i32 %30, 1
%37 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %30, i32 %36)
br label %66
38: ; preds = %28
%39 = add nsw i32 %30, 1
%40 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %30, i32 %39)
br label %66
41: ; preds = %28
%42 = add nsw i32 %30, 1
%43 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %30, i32 %42)
br label %66
44: ; preds = %28
%45 = add nsw i32 %30, 1
%46 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %30, i32 %45)
br label %66
47: ; preds = %28
%48 = add nsw i32 %30, 1
%49 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i32 %30, i32 %48)
br label %66
50: ; preds = %28
%51 = sext i32 %29 to i64
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %51
store i32 %30, i32* %52
%53 = add nsw i32 %30, 1
%54 = add nsw i32 %29, 1
br label %66
55: ; preds = %28
%56 = add nsw i32 %29, -1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = add nsw i32 %30, 1
%61 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %59, i32 %60)
%62 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %30, i32 %60)
%63 = add nsw i32 %59, 1
%64 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %59, i32 %63)
%65 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %30, i32 %63)
br label %66
66: ; preds = %28, %55, %50, %47, %44, %41, %38, %35, %32
%67 = phi i32 [ %30, %28 ], [ %60, %55 ], [ %53, %50 ], [ %48, %47 ], [ %45, %44 ], [ %42, %41 ], [ %39, %38 ], [ %36, %35 ], [ %33, %32 ]
%68 = phi i32 [ %29, %28 ], [ %56, %55 ], [ %54, %50 ], [ %29, %47 ], [ %29, %44 ], [ %29, %41 ], [ %29, %38 ], [ %29, %35 ], [ %29, %32 ]
%69 = tail call i32 @getc(i32* %8)
%70 = load i32, i32* @EOF
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %28
72: ; preds = %10, %66, %22, %19
%73 = phi i32 [ 2, %19 ], [ 0, %22 ], [ 0, %66 ], [ 1, %10 ]
ret i32 %73
}