#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 */
int atoi(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
bool args(int argc, char **argv, char *bfpath, int *cwidth, char *eofval,
          bool *wrap, int *max_fwdsize, int *max_revsize) {
  char *temp;
  for (int i = 1; i < argc; i++) {
    if (strcmp(argv[i], "--version") == 0) {
      printf("BestFriend brainfuck interpreter\n");
      return false;
    } else if (strcmp(argv[i], "--help") == 0) {
      printf("Usage: bestfriend [FILE]\n");
      printf("Runs FILE as a brainfuck program.\n");
      printf("If multiple FILEs are given, the last will be run.\n");
      return false;
    } else if (strncmp(argv[i], "--width=", 8) == 0) {
      if (strcmp(argv[i], "--width=32") == 0) {
        *cwidth = 1;
      } else if (strcmp(argv[i], "--width=16") == 0) {
        *cwidth = 2;
      } else if (strcmp(argv[i], "--width=8") == 0) {
        *cwidth = 3;
      } else {
        printf("Invalid cell width, defaulting to 32-bit.\n");
      }
    } else if (strncmp(argv[i], "--eof=", 6) == 0) {
      if (strcmp(argv[i], "--eof=-1") == 0) {
        *eofval = -1;
      } else if (strcmp(argv[i], "--eof=0") == 0) {
        *eofval = 0;
      } else if (strcmp(argv[i], "--eof=nochg") == 0) {
        *eofval = 1;
      } else {
        printf("Invalid EOF behaviour, defaulting to -1.\n");
      }
    } else if (strncmp(argv[i], "--wrap=", 7) == 0) {
      if (strncmp(argv[i], "--wrap=y", 8) == 0) {
        *wrap = true;
      } else if (strncmp(argv[i], "--wrap=n", 8) == 0) {
        *wrap = false;
      }
    } else if (strncmp(argv[i], "--fwdbound=", 11) == 0) {
      temp = malloc((strlen(argv[i]) - 10) * sizeof(char));
      strcpy(temp, argv[i] + 11);
      *max_fwdsize = atoi(temp);
    } else if (strncmp(argv[i], "--revbound=", 11) == 0) {
      temp = malloc((strlen(argv[i]) - 10) * sizeof(char));
      strcpy(temp, argv[i] + 11);
      *max_fwdsize = atoi(temp);
    } else {
      strcpy(bfpath, argv[i]);
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    15ab <args+0x43b>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe43(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11e4 <args+0x74>
lea    0xe37(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    15b2 <args+0x442>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe35(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1236 <args+0xc6>
lea    0xe26(%rip),%rdi
call   1060 <printf@plt>
lea    0xe34(%rip),%rdi
call   1060 <printf@plt>
lea    0xe4b(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    15b2 <args+0x442>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe5b(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    130b <args+0x19b>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe3d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    128e <args+0x11e>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    1306 <args+0x196>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe17(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12bf <args+0x14f>
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
jmp    1301 <args+0x191>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdf1(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12f0 <args+0x180>
mov    -0x20(%rbp),%rax
movl   $0x3,(%rax)
jmp    12fc <args+0x18c>
lea    0xdd6(%rip),%rdi
call   1060 <printf@plt>
jmp    1301 <args+0x191>
jmp    1306 <args+0x196>
jmp    158e <args+0x41e>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdda(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    13d7 <args+0x267>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdba(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1360 <args+0x1f0>
mov    -0x28(%rbp),%rax
movb   $0xff,(%rax)
jmp    13d2 <args+0x262>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd95(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    138e <args+0x21e>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
jmp    13cd <args+0x25d>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd6f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13bc <args+0x24c>
mov    -0x28(%rbp),%rax
movb   $0x1,(%rax)
jmp    13c8 <args+0x258>
lea    0xd59(%rip),%rdi
call   1060 <printf@plt>
jmp    13cd <args+0x25d>
jmp    13d2 <args+0x262>
jmp    1589 <args+0x419>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd5c(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    146f <args+0x2ff>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd3d(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1434 <args+0x2c4>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
jmp    146a <args+0x2fa>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd10(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1465 <args+0x2f5>
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
jmp    146a <args+0x2fa>
jmp    1584 <args+0x414>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcde(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    14ea <args+0x37a>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
sub    $0xa,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
add    $0xb,%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    157f <args+0x40f>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc6f(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1565 <args+0x3f5>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
sub    $0xa,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
add    $0xb,%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    157a <args+0x40a>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
jmp    157f <args+0x40f>
jmp    1584 <args+0x414>
jmp    1589 <args+0x419>
jmp    158e <args+0x41e>
jmp    1593 <args+0x423>
jmp    1598 <args+0x428>
jmp    159d <args+0x42d>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    119e <args+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x1,0xc(%rsp)
cmp    $0x2,%edi
jl     14ab <args+0x33b>
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %r8,0x10(%rsp)
mov    %r9,0x20(%rsp)
mov    %edi,%r15d
mov    $0x1,%r12d
lea    0xe4e(%rip),%rbx
mov    %r15,0x18(%rsp)
jmp    11cd <args+0x5d>
movl   $0x1,(%r14)
add    $0x1,%r12
cmp    %r12,%r15
je     14ab <args+0x33b>
mov    0x0(%rbp,%r12,8),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1476 <args+0x306>
mov    0x0(%rbp,%r12,8),%rdi
lea    0xe1b(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     147f <args+0x30f>
mov    0x0(%rbp,%r12,8),%rdi
lea    0xe08(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
mov    0x0(%rbp,%r12,8),%rdi
test   %rax,%rax
je     12b0 <args+0x140>
lea    0xe12(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    0x0(%rbp,%r12,8),%rdi
test   %rax,%rax
je     1310 <args+0x1a0>
lea    0xe17(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    0x0(%rbp,%r12,8),%rdi
test   %rax,%rax
je     136a <args+0x1fa>
mov    %rbx,%r15
lea    0xe0f(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
mov    0x0(%rbp,%r12,8),%rdi
test   %rax,%rax
je     13b3 <args+0x243>
lea    0xdfc(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
mov    0x0(%rbp,%r12,8),%rsi
test   %rax,%rax
je     13f8 <args+0x288>
mov    %r13,%rdi
call   1040 <strcpy@plt>
jmp    1433 <args+0x2c3>
nopl   (%rax)
lea    0xd63(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11b9 <args+0x49>
mov    0x0(%rbp,%r12,8),%rdi
lea    0xd54(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13df <args+0x26f>
mov    0x0(%rbp,%r12,8),%rdi
lea    0xd45(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1440 <args+0x2d0>
lea    0xdb9(%rip),%rdi
call   1050 <puts@plt>
jmp    11c0 <args+0x50>
nopw   0x0(%rax,%rax,1)
lea    0xd2a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13eb <args+0x27b>
mov    0x0(%rbp,%r12,8),%rdi
lea    0xd19(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     144c <args+0x2dc>
mov    0x0(%rbp,%r12,8),%rdi
lea    0xd07(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1469 <args+0x2f9>
lea    0xd30(%rip),%rdi
call   1050 <puts@plt>
jmp    11c0 <args+0x50>
lea    0xcf5(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1459 <args+0x2e9>
mov    0x0(%rbp,%r12,8),%rdi
lea    0xcdf(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11c0 <args+0x50>
mov    0x20(%rsp),%rax
movl   $0x0,(%rax)
jmp    11c0 <args+0x50>
call   1060 <strlen@plt>
lea    -0xa(%rax),%edi
call   1080 <malloc@plt>
mov    %r13,%rbx
mov    %rax,%r13
mov    0x0(%rbp,%r12,8),%rsi
add    $0xb,%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %r13,%rdi
mov    %rbx,%r13
jmp    1427 <args+0x2b7>
movl   $0x2,(%r14)
jmp    11c0 <args+0x50>
mov    0x10(%rsp),%rax
movb   $0xff,(%rax)
jmp    11c0 <args+0x50>
mov    %rsi,%rdi
call   1060 <strlen@plt>
lea    -0xa(%rax),%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    0x0(%rbp,%r12,8),%rsi
add    $0xb,%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
movl   $0x1,0xc(%rsp)
call   1090 <atoi@plt>
mov    0x60(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r15,%rbx
mov    0x18(%rsp),%r15
jmp    11c0 <args+0x50>
movl   $0x3,(%r14)
jmp    11c0 <args+0x50>
mov    0x10(%rsp),%rax
movb   $0x0,(%rax)
jmp    11c0 <args+0x50>
mov    0x20(%rsp),%rax
movl   $0x1,(%rax)
jmp    11c0 <args+0x50>
mov    0x10(%rsp),%rax
movb   $0x1,(%rax)
jmp    11c0 <args+0x50>
lea    0xcd4(%rip),%rdi
jmp    149e <args+0x32e>
lea    0xc5d(%rip),%rdi
call   1050 <puts@plt>
lea    0xc6a(%rip),%rdi
call   1050 <puts@plt>
lea    0xc80(%rip),%rdi
call   1050 <puts@plt>
movl   $0x0,0xc(%rsp)
mov    0xc(%rsp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"--version\00"
@.str.1 = [34 x i8] c"BestFriend brainfuck interpreter\0A\00"
@.str.2 = [7 x i8] c"--help\00"
@.str.3 = [26 x i8] c"Usage: bestfriend [FILE]\0A\00"
@.str.4 = [35 x i8] c"Runs FILE as a brainfuck program.\0A\00"
@.str.5 = [52 x i8] c"If multiple FILEs are given, the last will be run.\0A\00"
@.str.6 = [9 x i8] c"--width=\00"
@.str.7 = [11 x i8] c"--width=32\00"
@.str.8 = [11 x i8] c"--width=16\00"
@.str.9 = [10 x i8] c"--width=8\00"
@.str.10 = [43 x i8] c"Invalid cell width, defaulting to 32-bit.\0A\00"
@.str.11 = [7 x i8] c"--eof=\00"
@.str.12 = [9 x i8] c"--eof=-1\00"
@.str.13 = [8 x i8] c"--eof=0\00"
@.str.14 = [12 x i8] c"--eof=nochg\00"
@.str.15 = [42 x i8] c"Invalid EOF behaviour, defaulting to -1.\0A\00"
@.str.16 = [8 x i8] c"--wrap=\00"
@.str.17 = [9 x i8] c"--wrap=y\00"
@.str.18 = [9 x i8] c"--wrap=n\00"
@.str.19 = [12 x i8] c"--fwdbound=\00"
@.str.20 = [12 x i8] c"--revbound=\00"
define i32 @args(i32 %0, i8** %1, i8* %2, i32* %3, i8* %4, i32* %5, i32* %6, i32* %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8**
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i8*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i8*
%19 = alloca i32
store i32 %0, i32* %10
store i8** %1, i8*** %11
store i8* %2, i8** %12
store i32* %3, i32** %13
store i8* %4, i8** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store i32* %7, i32** %17
store i32 1, i32* %19
br label %20
20: ; preds = %239, %8
%21 = load i32, i32* %19
%22 = load i32, i32* %10
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %242
24: ; preds = %20
%25 = load i8**, i8*** %11
%26 = load i32, i32* %19
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %9
br label %243
34: ; preds = %24
%35 = load i8**, i8*** %11
%36 = load i32, i32* %19
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %34
%43 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %9
br label %243
46: ; preds = %34
%47 = load i8**, i8*** %11
%48 = load i32, i32* %19
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i64 @strncmp(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 8)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %89
54: ; preds = %46
%55 = load i8**, i8*** %11
%56 = load i32, i32* %19
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %54
%63 = load i32*, i32** %13
store i32 1, i32* %63
br label %88
64: ; preds = %54
%65 = load i8**, i8*** %11
%66 = load i32, i32* %19
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
%70 = call i64 @strcmp(i8* %69, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %64
%73 = load i32*, i32** %13
store i32 2, i32* %73
br label %87
74: ; preds = %64
%75 = load i8**, i8*** %11
%76 = load i32, i32* %19
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8*, i8** %75, i64 %77
%79 = load i8*, i8** %78
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %74
%83 = load i32*, i32** %13
store i32 3, i32* %83
br label %86
84: ; preds = %74
%85 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0))
br label %86
86: ; preds = %84, %82
br label %87
87: ; preds = %86, %72
br label %88
88: ; preds = %87, %62
br label %236
89: ; preds = %46
%90 = load i8**, i8*** %11
%91 = load i32, i32* %19
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8*, i8** %90, i64 %92
%94 = load i8*, i8** %93
%95 = call i64 @strncmp(i8* %94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 6)
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %132
97: ; preds = %89
%98 = load i8**, i8*** %11
%99 = load i32, i32* %19
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8*, i8** %98, i64 %100
%102 = load i8*, i8** %101
%103 = call i64 @strcmp(i8* %102, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %97
%106 = load i8*, i8** %14
store i8 -1, i8* %106
br label %131
107: ; preds = %97
%108 = load i8**, i8*** %11
%109 = load i32, i32* %19
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8*, i8** %108, i64 %110
%112 = load i8*, i8** %111
%113 = call i64 @strcmp(i8* %112, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%114 = icmp eq i64 %113, 0
br i1 %114, label %115, label %117
115: ; preds = %107
%116 = load i8*, i8** %14
store i8 0, i8* %116
br label %130
117: ; preds = %107
%118 = load i8**, i8*** %11
%119 = load i32, i32* %19
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8*, i8** %118, i64 %120
%122 = load i8*, i8** %121
%123 = call i64 @strcmp(i8* %122, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%124 = icmp eq i64 %123, 0
br i1 %124, label %125, label %127
125: ; preds = %117
%126 = load i8*, i8** %14
store i8 1, i8* %126
br label %129
127: ; preds = %117
%128 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.15, i64 0, i64 0))
br label %129
129: ; preds = %127, %125
br label %130
130: ; preds = %129, %115
br label %131
131: ; preds = %130, %105
br label %235
132: ; preds = %89
%133 = load i8**, i8*** %11
%134 = load i32, i32* %19
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8*, i8** %133, i64 %135
%137 = load i8*, i8** %136
%138 = call i64 @strncmp(i8* %137, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32 7)
%139 = icmp eq i64 %138, 0
br i1 %139, label %140, label %162
140: ; preds = %132
%141 = load i8**, i8*** %11
%142 = load i32, i32* %19
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8*, i8** %141, i64 %143
%145 = load i8*, i8** %144
%146 = call i64 @strncmp(i8* %145, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i32 8)
%147 = icmp eq i64 %146, 0
br i1 %147, label %148, label %150
148: ; preds = %140
%149 = load i32*, i32** %15
store i32 1, i32* %149
br label %161
150: ; preds = %140
%151 = load i8**, i8*** %11
%152 = load i32, i32* %19
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8*, i8** %151, i64 %153
%155 = load i8*, i8** %154
%156 = call i64 @strncmp(i8* %155, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0), i32 8)
%157 = icmp eq i64 %156, 0
br i1 %157, label %158, label %160
158: ; preds = %150
%159 = load i32*, i32** %15
store i32 0, i32* %159
br label %160
160: ; preds = %158, %150
br label %161
161: ; preds = %160, %148
br label %234
162: ; preds = %132
%163 = load i8**, i8*** %11
%164 = load i32, i32* %19
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8*, i8** %163, i64 %165
%167 = load i8*, i8** %166
%168 = call i64 @strncmp(i8* %167, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), i32 11)
%169 = icmp eq i64 %168, 0
br i1 %169, label %170, label %193
170: ; preds = %162
%171 = load i8**, i8*** %11
%172 = load i32, i32* %19
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds i8*, i8** %171, i64 %173
%175 = load i8*, i8** %174
%176 = call i32 @strlen(i8* %175)
%177 = sub nsw i32 %176, 10
%178 = sext i32 %177 to i64
%179 = mul i64 %178, 1
%180 = trunc i64 %179 to i32
%181 = call i8* @malloc(i32 %180)
store i8* %181, i8** %18
%182 = load i8*, i8** %18
%183 = load i8**, i8*** %11
%184 = load i32, i32* %19
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds i8*, i8** %183, i64 %185
%187 = load i8*, i8** %186
%188 = getelementptr inbounds i8, i8* %187, i64 11
%189 = call i32 @strcpy(i8* %182, i8* %188)
%190 = load i8*, i8** %18
%191 = call i32 @atoi(i8* %190)
%192 = load i32*, i32** %16
store i32 %191, i32* %192
br label %233
193: ; preds = %162
%194 = load i8**, i8*** %11
%195 = load i32, i32* %19
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i8*, i8** %194, i64 %196
%198 = load i8*, i8** %197
%199 = call i64 @strncmp(i8* %198, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i32 11)
%200 = icmp eq i64 %199, 0
br i1 %200, label %201, label %224
201: ; preds = %193
%202 = load i8**, i8*** %11
%203 = load i32, i32* %19
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds i8*, i8** %202, i64 %204
%206 = load i8*, i8** %205
%207 = call i32 @strlen(i8* %206)
%208 = sub nsw i32 %207, 10
%209 = sext i32 %208 to i64
%210 = mul i64 %209, 1
%211 = trunc i64 %210 to i32
%212 = call i8* @malloc(i32 %211)
store i8* %212, i8** %18
%213 = load i8*, i8** %18
%214 = load i8**, i8*** %11
%215 = load i32, i32* %19
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i8*, i8** %214, i64 %216
%218 = load i8*, i8** %217
%219 = getelementptr inbounds i8, i8* %218, i64 11
%220 = call i32 @strcpy(i8* %213, i8* %219)
%221 = load i8*, i8** %18
%222 = call i32 @atoi(i8* %221)
%223 = load i32*, i32** %16
store i32 %222, i32* %223
br label %232
224: ; preds = %193
%225 = load i8*, i8** %12
%226 = load i8**, i8*** %11
%227 = load i32, i32* %19
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds i8*, i8** %226, i64 %228
%230 = load i8*, i8** %229
%231 = call i32 @strcpy(i8* %225, i8* %230)
br label %232
232: ; preds = %224, %201
br label %233
233: ; preds = %232, %170
br label %234
234: ; preds = %233, %161
br label %235
235: ; preds = %234, %131
br label %236
236: ; preds = %235, %88
br label %237
237: ; preds = %236
br label %238
238: ; preds = %237
br label %239
239: ; preds = %238
%240 = load i32, i32* %19
%241 = add nsw i32 %240, 1
store i32 %241, i32* %19
br label %20
242: ; preds = %20
store i32 1, i32* %9
br label %243
243: ; preds = %242, %42, %32
%244 = load i32, i32* %9
ret i32 %244
}

LLVM IR (-O2):
@.str = [10 x i8] c"--version\00"
@.str.2 = [7 x i8] c"--help\00"
@.str.6 = [9 x i8] c"--width=\00"
@.str.7 = [11 x i8] c"--width=32\00"
@.str.8 = [11 x i8] c"--width=16\00"
@.str.9 = [10 x i8] c"--width=8\00"
@.str.11 = [7 x i8] c"--eof=\00"
@.str.12 = [9 x i8] c"--eof=-1\00"
@.str.13 = [8 x i8] c"--eof=0\00"
@.str.14 = [12 x i8] c"--eof=nochg\00"
@.str.16 = [8 x i8] c"--wrap=\00"
@.str.17 = [9 x i8] c"--wrap=y\00"
@.str.18 = [9 x i8] c"--wrap=n\00"
@.str.19 = [12 x i8] c"--fwdbound=\00"
@.str.20 = [12 x i8] c"--revbound=\00"
@str = [41 x i8] c"Invalid EOF behaviour, defaulting to -1.\00"
@str.21 = [42 x i8] c"Invalid cell width, defaulting to 32-bit.\00"
@str.22 = [25 x i8] c"Usage: bestfriend [FILE]\00"
@str.23 = [34 x i8] c"Runs FILE as a brainfuck program.\00"
@str.24 = [51 x i8] c"If multiple FILEs are given, the last will be run.\00"
@str.25 = [33 x i8] c"BestFriend brainfuck interpreter\00"
define i32 @args(i32 %0, i8** nocapture %1, i8* %2, i32* nocapture writeonly %3, i8* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture readnone %7) {
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %111
10: ; preds = %8
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %105
%13 = phi i64 [ 1, %10 ], [ %106, %105 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %108, label %18
18: ; preds = %12
%19 = load i8*, i8** %14
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.23, i64 0, i64 0))
br label %108
25: ; preds = %18
%26 = load i8*, i8** %14
%27 = tail call i64 @strncmp(i8* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 8)
%28 = icmp eq i64 %27, 0
%29 = load i8*, i8** %14
br i1 %28, label %30, label %46
30: ; preds = %25
%31 = tail call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 1, i32* %3
br label %105
34: ; preds = %30
%35 = load i8*, i8** %14
%36 = tail call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 2, i32* %3
br label %105
39: ; preds = %34
%40 = load i8*, i8** %14
%41 = tail call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %39
store i32 3, i32* %3
br label %105
44: ; preds = %39
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.21, i64 0, i64 0))
br label %105
46: ; preds = %25
%47 = tail call i64 @strncmp(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 6)
%48 = icmp eq i64 %47, 0
%49 = load i8*, i8** %14
br i1 %48, label %50, label %66
50: ; preds = %46
%51 = tail call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %50
store i8 -1, i8* %4
br label %105
54: ; preds = %50
%55 = load i8*, i8** %14
%56 = tail call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %54
store i8 0, i8* %4
br label %105
59: ; preds = %54
%60 = load i8*, i8** %14
%61 = tail call i64 @strcmp(i8* %60, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %59
store i8 1, i8* %4
br label %105
64: ; preds = %59
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %105
66: ; preds = %46
%67 = tail call i64 @strncmp(i8* %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32 7)
%68 = icmp eq i64 %67, 0
%69 = load i8*, i8** %14
br i1 %68, label %70, label %79
70: ; preds = %66
%71 = tail call i64 @strncmp(i8* %69, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i32 8)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %70
store i32 1, i32* %5
br label %105
74: ; preds = %70
%75 = load i8*, i8** %14
%76 = tail call i64 @strncmp(i8* %75, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0), i32 8)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %105
78: ; preds = %74
store i32 0, i32* %5
br label %105
79: ; preds = %66
%80 = tail call i64 @strncmp(i8* %69, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), i32 11)
%81 = icmp eq i64 %80, 0
%82 = load i8*, i8** %14
br i1 %81, label %83, label %91
83: ; preds = %79
%84 = tail call i32 @strlen(i8* %82)
%85 = add nsw i32 %84, -10
%86 = tail call i8* @malloc(i32 %85)
%87 = load i8*, i8** %14
%88 = getelementptr inbounds i8, i8* %87, i64 11
%89 = tail call i32 @strcpy(i8* %86, i8* %88)
%90 = tail call i32 @atoi(i8* %86)
store i32 %90, i32* %6
br label %105
91: ; preds = %79
%92 = tail call i64 @strncmp(i8* %82, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0), i32 11)
%93 = icmp eq i64 %92, 0
%94 = load i8*, i8** %14
br i1 %93, label %95, label %103
95: ; preds = %91
%96 = tail call i32 @strlen(i8* %94)
%97 = add nsw i32 %96, -10
%98 = tail call i8* @malloc(i32 %97)
%99 = load i8*, i8** %14
%100 = getelementptr inbounds i8, i8* %99, i64 11
%101 = tail call i32 @strcpy(i8* %98, i8* %100)
%102 = tail call i32 @atoi(i8* %98)
store i32 %102, i32* %6
br label %105
103: ; preds = %91
%104 = tail call i32 @strcpy(i8* %2, i8* %94)
br label %105
105: ; preds = %38, %44, %43, %33, %74, %78, %73, %95, %103, %83, %53, %63, %64, %58
%106 = add nuw nsw i64 %13, 1
%107 = icmp eq i64 %106, %11
br i1 %107, label %111, label %12
108: ; preds = %12, %22
%109 = phi i8* [ getelementptr inbounds ([51 x i8], [51 x i8]* @str.24, i64 0, i64 0), %22 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.25, i64 0, i64 0), %12 ]
%110 = tail call i32 @puts(i8* dereferenceable(1) %109)
br label %111
111: ; preds = %105, %108, %8
%112 = phi i32 [ 1, %8 ], [ 0, %108 ], [ 1, %105 ]
ret i32 %112
}