#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 */

/* Variables and functions */
char *bf_create_array(int);
int /*<<< orphan*/ bf_destroy_array(char *);
char *bf_execute(char *, char *, char *);
char *bf_minimize_file(char *);
char *bf_read_file(char *);
char *bf_read_file_and_minimize(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(int);
scalar_t__ opterr;
int optind;
int optopt;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ run_brainfuck_shell();
int /*<<< orphan*/ show_help();
int /*<<< orphan*/ show_version();
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char *opt_filename = NULL;
  int opt_flag_minimize = 0;
  int opt_flag_interactive = 0;
  int index;
  int c;
  opterr = 0;
  if (argc == 1) {
    opt_flag_interactive = 1;
  }
  while ((c = getopt(argc, argv, "hvm")) != -1) {
    switch (c) {
    case 'h':
      show_help();
      return 0;
    case 'v':
      show_version();
      return 0;
    case 'm':
      opt_flag_minimize = 1;
      break;
    case '?':
      if (isprint(optopt))
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      else
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      return 1;
    }
  }
  for (index = optind; index < argc; index++) {
    if (index == argc - 1) {
      opt_filename = argv[index];
    }
  }
  if (!opt_filename && !opt_flag_interactive) {
    fprintf(stderr, "No filename given. Try -h for more information\n");
    return 1;
  }
  if (opt_flag_minimize) {
    char *program_string = bf_read_file(opt_filename);
    program_string = bf_minimize_file(program_string);
    printf("%s\n", program_string);
    free(program_string);
  } else if (opt_flag_interactive) {
    run_brainfuck_shell();
  } else {
    char *program_string = bf_read_file_and_minimize(opt_filename);
    if (!program_string) {
      return 1;
    }
    char *prog_array = bf_create_array(30000);
    char *ptr = prog_array;
    ptr = bf_execute(program_string, prog_array, ptr);
    bf_destroy_array(prog_array);
    free(program_string);
    if (!ptr) {
      fprintf(stderr, "An error occured during execution\n");
      return 1;
    }
  }
  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,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    0x2db5(%rip),%rax
movq   $0x0,(%rax)
cmpl   $0x1,-0x8(%rbp)
jne    122b <main+0x4b>
movl   $0x1,-0x20(%rbp)
jmp    1230 <main+0x50>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdc2(%rip),%rdx
call   1100 <getopt@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
je     1335 <main+0x155>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4c(%rbp)
sub    $0x3f,%eax
je     12c8 <main+0xe8>
jmp    1263 <main+0x83>
mov    -0x4c(%rbp),%eax
sub    $0x68,%eax
je     1296 <main+0xb6>
jmp    1274 <main+0x94>
mov    -0x4c(%rbp),%eax
sub    $0x6d,%eax
je     12bc <main+0xdc>
jmp    1285 <main+0xa5>
mov    -0x4c(%rbp),%eax
sub    $0x76,%eax
je     12a9 <main+0xc9>
jmp    1330 <main+0x150>
mov    $0x0,%al
call   10d0 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b1 <main+0x2d1>
mov    $0x0,%al
call   1030 <show_version@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b1 <main+0x2d1>
movl   $0x1,-0x1c(%rbp)
jmp    1330 <main+0x150>
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
call   10e0 <isprint@plt>
cmp    $0x0,%eax
je     1304 <main+0x124>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
mov    0x2cf9(%rip),%rax
mov    (%rax),%edx
lea    0xd0c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1324 <main+0x144>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
mov    0x2cd4(%rip),%rax
mov    (%rax),%edx
lea    0xcfe(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b1 <main+0x2d1>
jmp    1230 <main+0x50>
mov    0x2ca4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1381 <main+0x1a1>
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    136e <main+0x18e>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    1373 <main+0x193>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1341 <main+0x161>
cmpq   $0x0,-0x18(%rbp)
jne    13b9 <main+0x1d9>
cmpl   $0x0,-0x20(%rbp)
jne    13b9 <main+0x1d9>
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b1 <main+0x2d1>
cmpl   $0x0,-0x1c(%rbp)
je     13fb <main+0x21b>
mov    -0x18(%rbp),%rdi
call   1040 <bf_read_file@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   10c0 <bf_minimize_file@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xc85(%rip),%rdi
call   1080 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1050 <free@plt>
jmp    14aa <main+0x2ca>
cmpl   $0x0,-0x20(%rbp)
je     1411 <main+0x231>
mov    $0x0,%al
call   1060 <run_brainfuck_shell@plt>
jmp    14a5 <main+0x2c5>
mov    -0x18(%rbp),%rdi
call   10a0 <bf_read_file_and_minimize@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1435 <main+0x255>
movl   $0x1,-0x4(%rbp)
jmp    14b1 <main+0x2d1>
mov    $0x7530,%edi
call   1090 <bf_create_array@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
call   1070 <bf_execute@plt>
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
call   10f0 <bf_destroy_array@plt>
mov    -0x38(%rbp),%rdi
call   1050 <free@plt>
cmpq   $0x0,-0x48(%rbp)
jne    14a0 <main+0x2c0>
mov    0x2b4c(%rip),%rax
mov    (%rax),%edi
lea    0xbe4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14b1 <main+0x2d1>
jmp    14a5 <main+0x2c5>
jmp    14aa <main+0x2ca>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x2dd3(%rip),%rax
movq   $0x0,(%rax)
mov    $0x1,%r12b
lea    0xdfa(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1100 <getopt@plt>
cmp    $0x67,%eax
jle    1240 <main+0x60>
cmp    $0x76,%eax
je     1251 <main+0x71>
cmp    $0x6d,%eax
je     124c <main+0x6c>
cmp    $0x68,%eax
jne    1210 <main+0x30>
jmp    125f <main+0x7f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0xffffffff,%eax
je     126d <main+0x8d>
cmp    $0x3f,%eax
jne    1210 <main+0x30>
jmp    12c4 <main+0xe4>
xor    %r12d,%r12d
jmp    1210 <main+0x30>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <show_version@plt>
jmp    133a <main+0x15a>
xor    %ebx,%ebx
xor    %eax,%eax
call   10d0 <show_help@plt>
jmp    133a <main+0x15a>
mov    0x2d6c(%rip),%rax
movslq (%rax),%rax
cmp    %r14d,%eax
jge    12ea <main+0x10a>
lea    -0x1(%r14),%ecx
movslq %ecx,%rcx
movslq %r14d,%rdx
mov    %r14d,%ebx
sub    %eax,%ebx
mov    %rax,%r8
not    %r8
add    %rdx,%r8
and    $0x3,%rbx
je     130b <main+0x12b>
mov    %rax,%rbp
sub    %rcx,%rbp
neg    %rbx
xor    %esi,%esi
xor    %edi,%edi
jmp    12b9 <main+0xd9>
nopl   0x0(%rax)
add    $0xffffffffffffffff,%rsi
cmp    %rsi,%rbx
je     1300 <main+0x120>
cmp    %rsi,%rbp
jne    12b0 <main+0xd0>
mov    (%r15,%rcx,8),%rdi
jmp    12b0 <main+0xd0>
mov    0x2d1d(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10e0 <isprint@plt>
mov    0x2cf5(%rip),%rcx
mov    (%rcx),%edi
test   %eax,%eax
je     12ee <main+0x10e>
lea    0xd1c(%rip),%rsi
jmp    12f5 <main+0x115>
xor    %edi,%edi
jmp    1313 <main+0x133>
lea    0xd26(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    1335 <main+0x155>
sub    %rsi,%rax
cmp    $0x3,%r8
jb     1313 <main+0x133>
jmp    1360 <main+0x180>
xor    %edi,%edi
cmp    $0x3,%r8
jae    1360 <main+0x180>
cmp    $0x1,%r14d
je     1345 <main+0x165>
test   %rdi,%rdi
jne    1345 <main+0x165>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
lea    0xd0f(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
test   $0x1,%r12b
je     13af <main+0x1cf>
cmp    $0x1,%r14d
jne    13dd <main+0x1fd>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <run_brainfuck_shell@plt>
jmp    133a <main+0x15a>
mov    %rcx,%rsi
sub    %rax,%rsi
jmp    137d <main+0x19d>
nopl   0x0(%rax,%rax,1)
add    $0x4,%rax
add    $0xfffffffffffffffc,%rsi
cmp    %rdx,%rax
je     1313 <main+0x133>
test   %rsi,%rsi
jne    1386 <main+0x1a6>
mov    (%r15,%rcx,8),%rdi
lea    0x1(%rax),%rbp
cmp    %rcx,%rbp
jne    1393 <main+0x1b3>
mov    (%r15,%rcx,8),%rdi
lea    0x2(%rax),%rbp
cmp    %rcx,%rbp
jne    13a0 <main+0x1c0>
mov    (%r15,%rcx,8),%rdi
lea    0x3(%rax),%rbp
cmp    %rcx,%rbp
jne    1370 <main+0x190>
mov    (%r15,%rcx,8),%rdi
jmp    1370 <main+0x190>
call   1040 <bf_read_file@plt>
mov    %rax,%rdi
call   10c0 <bf_minimize_file@plt>
mov    %rax,%rbx
lea    0xca7(%rip),%rdi
mov    %rax,%rsi
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1050 <free@plt>
xor    %ebx,%ebx
jmp    133a <main+0x15a>
call   10a0 <bf_read_file_and_minimize@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     133a <main+0x15a>
mov    %rax,%r14
mov    $0x7530,%edi
call   1090 <bf_create_array@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
mov    %rax,%rdx
call   1070 <bf_execute@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   10f0 <bf_destroy_array@plt>
mov    %r14,%rdi
call   1050 <free@plt>
xor    %ebx,%ebx
test   %r15,%r15
jne    133a <main+0x15a>
mov    0x2b9d(%rip),%rax
mov    (%rax),%edi
lea    0xc35(%rip),%rsi
jmp    132e <main+0x14e>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [4 x i8] c"hvm\00"
@optopt = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.2 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.3 = [48 x i8] c"No filename given. Try -h for more information\0A\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [35 x i8] c"An error occured during execution\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i64 0, i64* @opterr
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %8
br label %18
18: ; preds = %17, %2
br label %19
19: ; preds = %44, %18
%20 = load i32, i32* %4
%21 = load i8**, i8*** %5
%22 = call i32 @getopt(i32 %20, i8** %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %22, i32* %10
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %45
24: ; preds = %19
%25 = load i32, i32* %10
switch i32 %25, label %44 [
i32 104, label %26
i32 118, label %28
i32 109, label %30
i32 63, label %31
]
26: ; preds = %24
%27 = call i32 (...) @show_help()
store i32 0, i32* %3
br label %117
28: ; preds = %24
%29 = call i32 (...) @show_version()
store i32 0, i32* %3
br label %117
30: ; preds = %24
store i32 1, i32* %7
br label %44
31: ; preds = %24
%32 = load i32, i32* @optopt
%33 = call i32 @isprint(i32 %32)
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i32, i32* @stderr
%37 = load i32, i32* @optopt
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %43
39: ; preds = %31
%40 = load i32, i32* @stderr
%41 = load i32, i32* @optopt
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %39, %35
store i32 1, i32* %3
br label %117
44: ; preds = %24, %30
br label %19
45: ; preds = %19
%46 = load i32, i32* @optind
store i32 %46, i32* %9
br label %47
47: ; preds = %63, %45
%48 = load i32, i32* %9
%49 = load i32, i32* %4
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %66
51: ; preds = %47
%52 = load i32, i32* %9
%53 = load i32, i32* %4
%54 = sub nsw i32 %53, 1
%55 = icmp eq i32 %52, %54
br i1 %55, label %56, label %62
56: ; preds = %51
%57 = load i8**, i8*** %5
%58 = load i32, i32* %9
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
store i8* %61, i8** %6
br label %62
62: ; preds = %56, %51
br label %63
63: ; preds = %62
%64 = load i32, i32* %9
%65 = add nsw i32 %64, 1
store i32 %65, i32* %9
br label %47
66: ; preds = %47
%67 = load i8*, i8** %6
%68 = icmp ne i8* %67, null
br i1 %68, label %75, label %69
69: ; preds = %66
%70 = load i32, i32* %8
%71 = icmp ne i32 %70, 0
br i1 %71, label %75, label %72
72: ; preds = %69
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %117
75: ; preds = %69, %66
%76 = load i32, i32* %7
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %87
78: ; preds = %75
%79 = load i8*, i8** %6
%80 = call i8* @bf_read_file(i8* %79)
store i8* %80, i8** %11
%81 = load i8*, i8** %11
%82 = call i8* @bf_minimize_file(i8* %81)
store i8* %82, i8** %11
%83 = load i8*, i8** %11
%84 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %83)
%85 = load i8*, i8** %11
%86 = call i32 @free(i8* %85)
br label %116
87: ; preds = %75
%88 = load i32, i32* %8
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %87
%91 = call i32 (...) @run_brainfuck_shell()
br label %115
92: ; preds = %87
%93 = load i8*, i8** %6
%94 = call i8* @bf_read_file_and_minimize(i8* %93)
store i8* %94, i8** %12
%95 = load i8*, i8** %12
%96 = icmp ne i8* %95, null
br i1 %96, label %98, label %97
97: ; preds = %92
store i32 1, i32* %3
br label %117
98: ; preds = %92
%99 = call i8* @bf_create_array(i32 30000)
store i8* %99, i8** %13
%100 = load i8*, i8** %13
store i8* %100, i8** %14
%101 = load i8*, i8** %12
%102 = load i8*, i8** %13
%103 = load i8*, i8** %14
%104 = call i8* @bf_execute(i8* %101, i8* %102, i8* %103)
store i8* %104, i8** %14
%105 = load i8*, i8** %13
%106 = call i32 @bf_destroy_array(i8* %105)
%107 = load i8*, i8** %12
%108 = call i32 @free(i8* %107)
%109 = load i8*, i8** %14
%110 = icmp ne i8* %109, null
br i1 %110, label %114, label %111
111: ; preds = %98
%112 = load i32, i32* @stderr
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %117
114: ; preds = %98
br label %115
115: ; preds = %114, %90
br label %116
116: ; preds = %115, %78
store i32 0, i32* %3
br label %117
117: ; preds = %116, %111, %97, %72, %43, %28, %26
%118 = load i32, i32* %3
ret i32 %118
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [4 x i8] c"hvm\00"
@optopt = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.2 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.3 = [48 x i8] c"No filename given. Try -h for more information\0A\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [35 x i8] c"An error occured during execution\0A\00"
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
%3 = icmp eq i32 %0, 1
br label %4
4: ; preds = %6, %2
%5 = phi i1 [ true, %2 ], [ false, %6 ]
br label %6
6: ; preds = %4, %6
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %6 [
i32 -1, label %21
i32 104, label %8
i32 118, label %10
i32 109, label %4
i32 63, label %12
]
8: ; preds = %6
%9 = tail call i32 (...) @show_help()
br label %108
10: ; preds = %6
%11 = tail call i32 (...) @show_version()
br label %108
12: ; preds = %6
%13 = load i32, i32* @optopt
%14 = tail call i32 @isprint(i32 %13)
%15 = icmp eq i32 %14, 0
%16 = load i32, i32* @stderr
br i1 %15, label %19, label %17
17: ; preds = %12
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %108
19: ; preds = %12
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %108
21: ; preds = %6
%22 = load i32, i32* @optind
%23 = icmp slt i32 %22, %0
br i1 %23, label %24, label %80
24: ; preds = %21
%25 = add nsw i32 %0, -1
%26 = sext i32 %22 to i64
%27 = sext i32 %25 to i64
%28 = sext i32 %0 to i64
%29 = getelementptr inbounds i8*, i8** %1, i64 %27
%30 = sub nsw i64 %28, %26
%31 = xor i64 %26, -1
%32 = add nsw i64 %31, %28
%33 = and i64 %30, 3
%34 = icmp eq i64 %33, 0
br i1 %34, label %47, label %35
35: ; preds = %24, %42
%36 = phi i64 [ %44, %42 ], [ %26, %24 ]
%37 = phi i8* [ %43, %42 ], [ null, %24 ]
%38 = phi i64 [ %45, %42 ], [ 0, %24 ]
%39 = icmp eq i64 %36, %27
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = load i8*, i8** %29
br label %42
42: ; preds = %40, %35
%43 = phi i8* [ %41, %40 ], [ %37, %35 ]
%44 = add nsw i64 %36, 1
%45 = add i64 %38, 1
%46 = icmp eq i64 %45, %33
br i1 %46, label %47, label %35
47: ; preds = %42, %24
%48 = phi i8* [ undef, %24 ], [ %43, %42 ]
%49 = phi i64 [ %26, %24 ], [ %44, %42 ]
%50 = phi i8* [ null, %24 ], [ %43, %42 ]
%51 = icmp ult i64 %32, 3
br i1 %51, label %80, label %52
52: ; preds = %47, %76
%53 = phi i64 [ %78, %76 ], [ %49, %47 ]
%54 = phi i8* [ %77, %76 ], [ %50, %47 ]
%55 = icmp eq i64 %53, %27
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = load i8*, i8** %29
br label %58
58: ; preds = %52, %56
%59 = phi i8* [ %57, %56 ], [ %54, %52 ]
%60 = add nsw i64 %53, 1
%61 = icmp eq i64 %60, %27
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = load i8*, i8** %29
br label %64
64: ; preds = %62, %58
%65 = phi i8* [ %63, %62 ], [ %59, %58 ]
%66 = add nsw i64 %53, 2
%67 = icmp eq i64 %66, %27
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = load i8*, i8** %29
br label %70
70: ; preds = %68, %64
%71 = phi i8* [ %69, %68 ], [ %65, %64 ]
%72 = add nsw i64 %53, 3
%73 = icmp eq i64 %72, %27
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = load i8*, i8** %29
br label %76
76: ; preds = %74, %70
%77 = phi i8* [ %75, %74 ], [ %71, %70 ]
%78 = add nsw i64 %53, 4
%79 = icmp eq i64 %78, %28
br i1 %79, label %80, label %52
80: ; preds = %47, %76, %21
%81 = phi i8* [ null, %21 ], [ %48, %47 ], [ %77, %76 ]
%82 = icmp ne i8* %81, null
%83 = or i1 %3, %82
br i1 %83, label %87, label %84
84: ; preds = %80
%85 = load i32, i32* @stderr
%86 = tail call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
br label %108
87: ; preds = %80
br i1 %5, label %93, label %88
88: ; preds = %87
%89 = tail call i8* @bf_read_file(i8* %81)
%90 = tail call i8* @bf_minimize_file(i8* %89)
%91 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %90)
%92 = tail call i32 @free(i8* %90)
br label %108
93: ; preds = %87
br i1 %3, label %94, label %96
94: ; preds = %93
%95 = tail call i32 (...) @run_brainfuck_shell()
br label %108
96: ; preds = %93
%97 = tail call i8* @bf_read_file_and_minimize(i8* %81)
%98 = icmp eq i8* %97, null
br i1 %98, label %108, label %99
99: ; preds = %96
%100 = tail call i8* @bf_create_array(i32 30000)
%101 = tail call i8* @bf_execute(i8* %97, i8* %100, i8* %100)
%102 = tail call i32 @bf_destroy_array(i8* %100)
%103 = tail call i32 @free(i8* %97)
%104 = icmp eq i8* %101, null
br i1 %104, label %105, label %108
105: ; preds = %99
%106 = load i32, i32* @stderr
%107 = tail call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %108
108: ; preds = %105, %96, %88, %94, %99, %17, %19, %84, %10, %8
%109 = phi i32 [ 0, %10 ], [ 0, %8 ], [ 1, %84 ], [ 1, %19 ], [ 1, %17 ], [ 0, %99 ], [ 0, %94 ], [ 0, %88 ], [ 1, %96 ], [ 1, %105 ]
ret i32 %109
}