#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 char FILE;

/* Variables and functions */
int /*<<< orphan*/ custom_error(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ decode(char *, char *);
int /*<<< orphan*/ errno;
scalar_t__ fclose(char *);
char *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char *stdin;
char *stdout;
int strlen(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  char *line;
  char *tmpline;
  char *outputpath;
  FILE *inputFile;
  FILE *outputFile;
  int needsclosing, last, i, errorfree;
  int outputFileNeedsClosing;
  line = 0;
  inputFile = 0;
  last = argc - 1;
  tmpline = 0;
  needsclosing = 0;
  errorfree = 1;
  outputFile = stdout;
  outputpath = 0;
  outputFileNeedsClosing = 0;
  if (argc > 1) {
    for (i = 1; errorfree && (i < last); ++i) {
      tmpline = argv[i];
      if (strlen(tmpline) == 2 && tmpline[0] == '-') {
        switch (tmpline[1]) {
        case 'o': {
          ++i;
          outputpath = argv[i];
          outputFile = fopen(outputpath, "w");
          if (!outputFile) {
            custom_error(errno, "couldn't open output file %s\n", outputpath);
          }
          outputFileNeedsClosing = 1;
          break;
        }
        default:
          errorfree = 0;
          break;
        }
      } else {
        errorfree = 0;
        break;
      }
    }
    if (errorfree) {
      if (i == last) {
        line = argv[last];
        if (strlen(line) == 1 && line[0] == '-') {
          inputFile = stdin;
        } else if (strlen(line) >= 1 && line[0] != '-') {
          inputFile = fopen(line, "r");
          if (!inputFile) {
            custom_error(errno, "couldn't open %s\n", line);
          }
          needsclosing = 1;
        }
      } else {
        fprintf(stderr, "no file provided\n");
      }
    }
  }
  if (inputFile) {
    decode(inputFile, outputFile);
    if (needsclosing && fclose(inputFile) != 0) {
      custom_error(errno, "couldn't close %s\n", line);
    }
    if (outputFileNeedsClosing && fclose(outputFile) != 0) {
      custom_error(errno, "couldn't close %s\n", outputFile);
    }
  } else {
    usage(argv[0]);
  }
  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)
movq   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x1,-0x48(%rbp)
mov    0x2e0c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x4c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    13c1 <main+0x251>
movl   $0x1,-0x44(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x48(%rbp)
mov    %al,-0x4d(%rbp)
je     11fe <main+0x8e>
mov    -0x44(%rbp),%eax
cmp    -0x40(%rbp),%eax
setl   %al
mov    %al,-0x4d(%rbp)
mov    -0x4d(%rbp),%al
test   $0x1,%al
jne    120e <main+0x9e>
jmp    12dc <main+0x16c>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jne    12bd <main+0x14d>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12bd <main+0x14d>
mov    -0x20(%rbp),%rax
mov    0x1(%rax),%al
sub    $0x6f,%al
jne    12b1 <main+0x141>
jmp    1254 <main+0xe4>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xd88(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    12a5 <main+0x135>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xd62(%rip),%rsi
call   1050 <custom_error@plt>
movl   $0x1,-0x4c(%rbp)
jmp    12b8 <main+0x148>
movl   $0x0,-0x48(%rbp)
jmp    12c9 <main+0x159>
movl   $0x0,-0x48(%rbp)
jmp    12dc <main+0x16c>
jmp    12ce <main+0x15e>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e3 <main+0x73>
cmpl   $0x0,-0x48(%rbp)
je     13bc <main+0x24c>
mov    -0x44(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    13a2 <main+0x232>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
jne    1337 <main+0x1c7>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1337 <main+0x1c7>
mov    0x2cbd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    139d <main+0x22d>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
jl     1398 <main+0x228>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     1398 <main+0x228>
mov    -0x18(%rbp),%rdi
lea    0xcbc(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1391 <main+0x221>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xc96(%rip),%rsi
call   1050 <custom_error@plt>
movl   $0x1,-0x3c(%rbp)
jmp    139d <main+0x22d>
jmp    13b7 <main+0x247>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
lea    0xc82(%rip),%rsi
call   1060 <fprintf@plt>
jmp    13bc <main+0x24c>
jmp    13c1 <main+0x251>
cmpq   $0x0,-0x30(%rbp)
je     144a <main+0x2da>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1080 <decode@plt>
cmpl   $0x0,-0x3c(%rbp)
je     140f <main+0x29f>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
cmp    $0x0,%rax
je     140f <main+0x29f>
mov    0x2bd3(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xc3c(%rip),%rsi
call   1050 <custom_error@plt>
cmpl   $0x0,-0x4c(%rbp)
je     1445 <main+0x2d5>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
cmp    $0x0,%rax
je     1445 <main+0x2d5>
mov    0x2b9d(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xc06(%rip),%rsi
call   1050 <custom_error@plt>
jmp    1456 <main+0x2e6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <usage@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     1329 <main+0x1b9>
mov    %edi,%r14d
lea    -0x1(%r14),%r13d
cmp    $0x2,%edi
jne    11ef <main+0x7f>
mov    0x2e2e(%rip),%rax
mov    (%rax),%r15
mov    $0x1,%r12d
cmp    %r13d,%r12d
jne    1268 <main+0xf8>
movslq %r13d,%rax
mov    (%rbx,%rax,8),%r12
mov    %r12,%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
jne    1282 <main+0x112>
cmpb   $0x2d,(%r12)
jne    1282 <main+0x112>
mov    0x2e12(%rip),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     1329 <main+0x1b9>
mov    %r15,%rsi
call   1080 <decode@plt>
jmp    12e4 <main+0x174>
mov    $0x1,%r12d
jmp    1209 <main+0x99>
nopw   0x0(%rax,%rax,1)
add    $0x2,%r12
cmp    %r13d,%r12d
jge    11a3 <main+0x33>
mov    (%rbx,%r12,8),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jne    1329 <main+0x1b9>
cmpb   $0x2d,0x0(%rbp)
jne    1329 <main+0x1b9>
cmpb   $0x6f,0x1(%rbp)
jne    1329 <main+0x1b9>
mov    0x8(%rbx,%r12,8),%rbp
mov    %rbp,%rdi
lea    0xdbf(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1200 <main+0x90>
mov    0x2d7b(%rip),%rax
mov    (%rax),%edi
lea    0xda4(%rip),%rsi
mov    %rbp,%rdx
call   1050 <custom_error@plt>
jmp    1200 <main+0x90>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
lea    0xdbc(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1329 <main+0x1b9>
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1329 <main+0x1b9>
cmpb   $0x2d,(%r12)
je     1329 <main+0x1b9>
lea    0xd7c(%rip),%rsi
mov    %r12,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1311 <main+0x1a1>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15,%rsi
call   1080 <decode@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
test   %rax,%rax
je     12e4 <main+0x174>
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
lea    0xd6a(%rip),%rsi
mov    %r12,%rdx
call   1050 <custom_error@plt>
cmp    $0x2,%r14d
je     1331 <main+0x1c1>
mov    %r15,%rdi
call   1030 <fclose@plt>
test   %rax,%rax
je     1331 <main+0x1c1>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
lea    0xd3f(%rip),%rsi
mov    %r15,%rdx
call   1050 <custom_error@plt>
jmp    1331 <main+0x1c1>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
lea    0xd01(%rip),%rsi
mov    %r12,%rdx
call   1050 <custom_error@plt>
mov    (%rbx),%rdi
call   1070 <usage@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i8* null
@.str = [2 x i8] c"w\00"
@errno = global i32 0
@.str.1 = [30 x i8] c"couldn't open output file %s\0A\00"
@stdin = global i8* null
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [18 x i8] c"couldn't open %s\0A\00"
@stderr = global i32 0
@.str.4 = [18 x i8] c"no file provided\0A\00"
@.str.5 = [19 x i8] c"couldn't close %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %9
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
store i32 %17, i32* %12
store i8* null, i8** %7
store i32 0, i32* %11
store i32 1, i32* %14
%18 = load i8*, i8** @stdout
store i8* %18, i8** %10
store i8* null, i8** %8
store i32 0, i32* %15
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 1
br i1 %20, label %21, label %126
21: ; preds = %2
store i32 1, i32* %13
br label %22
22: ; preds = %72, %21
%23 = load i32, i32* %14
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i32, i32* %13
%27 = load i32, i32* %12
%28 = icmp slt i32 %26, %27
br label %29
29: ; preds = %25, %22
%30 = phi i1 [ false, %22 ], [ %28, %25 ]
br i1 %30, label %31, label %75
31: ; preds = %29
%32 = load i8**, i8*** %5
%33 = load i32, i32* %13
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
store i8* %36, i8** %7
%37 = load i8*, i8** %7
%38 = call i32 @strlen(i8* %37)
%39 = icmp eq i32 %38, 2
br i1 %39, label %40, label %70
40: ; preds = %31
%41 = load i8*, i8** %7
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 45
br i1 %45, label %46, label %70
46: ; preds = %40
%47 = load i8*, i8** %7
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
switch i32 %50, label %68 [
i32 111, label %51
]
51: ; preds = %46
%52 = load i32, i32* %13
%53 = add nsw i32 %52, 1
store i32 %53, i32* %13
%54 = load i8**, i8*** %5
%55 = load i32, i32* %13
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
store i8* %58, i8** %8
%59 = load i8*, i8** %8
%60 = call i8* @fopen(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %60, i8** %10
%61 = load i8*, i8** %10
%62 = icmp ne i8* %61, null
br i1 %62, label %67, label %63
63: ; preds = %51
%64 = load i32, i32* @errno
%65 = load i8*, i8** %8
%66 = call i32 @custom_error(i32 %64, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %63, %51
store i32 1, i32* %15
br label %69
68: ; preds = %46
store i32 0, i32* %14
br label %69
69: ; preds = %68, %67
br label %71
70: ; preds = %40, %31
store i32 0, i32* %14
br label %75
71: ; preds = %69
br label %72
72: ; preds = %71
%73 = load i32, i32* %13
%74 = add nsw i32 %73, 1
store i32 %74, i32* %13
br label %22
75: ; preds = %70, %29
%76 = load i32, i32* %14
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %125
78: ; preds = %75
%79 = load i32, i32* %13
%80 = load i32, i32* %12
%81 = icmp eq i32 %79, %80
br i1 %81, label %82, label %121
82: ; preds = %78
%83 = load i8**, i8*** %5
%84 = load i32, i32* %12
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %83, i64 %85
%87 = load i8*, i8** %86
store i8* %87, i8** %6
%88 = load i8*, i8** %6
%89 = call i32 @strlen(i8* %88)
%90 = icmp eq i32 %89, 1
br i1 %90, label %91, label %99
91: ; preds = %82
%92 = load i8*, i8** %6
%93 = getelementptr inbounds i8, i8* %92, i64 0
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = icmp eq i32 %95, 45
br i1 %96, label %97, label %99
97: ; preds = %91
%98 = load i8*, i8** @stdin
store i8* %98, i8** %9
br label %120
99: ; preds = %91, %82
%100 = load i8*, i8** %6
%101 = call i32 @strlen(i8* %100)
%102 = icmp sge i32 %101, 1
br i1 %102, label %103, label %119
103: ; preds = %99
%104 = load i8*, i8** %6
%105 = getelementptr inbounds i8, i8* %104, i64 0
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp ne i32 %107, 45
br i1 %108, label %109, label %119
109: ; preds = %103
%110 = load i8*, i8** %6
%111 = call i8* @fopen(i8* %110, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %111, i8** %9
%112 = load i8*, i8** %9
%113 = icmp ne i8* %112, null
br i1 %113, label %118, label %114
114: ; preds = %109
%115 = load i32, i32* @errno
%116 = load i8*, i8** %6
%117 = call i32 @custom_error(i32 %115, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %116)
br label %118
118: ; preds = %114, %109
store i32 1, i32* %11
br label %119
119: ; preds = %118, %103, %99
br label %120
120: ; preds = %119, %97
br label %124
121: ; preds = %78
%122 = load i32, i32* @stderr
%123 = call i32 @fprintf(i32 %122, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %124
124: ; preds = %121, %120
br label %125
125: ; preds = %124, %75
br label %126
126: ; preds = %125, %2
%127 = load i8*, i8** %9
%128 = icmp ne i8* %127, null
br i1 %128, label %129, label %155
129: ; preds = %126
%130 = load i8*, i8** %9
%131 = load i8*, i8** %10
%132 = call i32 @decode(i8* %130, i8* %131)
%133 = load i32, i32* %11
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %143
135: ; preds = %129
%136 = load i8*, i8** %9
%137 = call i64 @fclose(i8* %136)
%138 = icmp ne i64 %137, 0
br i1 %138, label %139, label %143
139: ; preds = %135
%140 = load i32, i32* @errno
%141 = load i8*, i8** %6
%142 = call i32 @custom_error(i32 %140, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %141)
br label %143
143: ; preds = %139, %135, %129
%144 = load i32, i32* %15
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %154
146: ; preds = %143
%147 = load i8*, i8** %10
%148 = call i64 @fclose(i8* %147)
%149 = icmp ne i64 %148, 0
br i1 %149, label %150, label %154
150: ; preds = %146
%151 = load i32, i32* @errno
%152 = load i8*, i8** %10
%153 = call i32 @custom_error(i32 %151, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %152)
br label %154
154: ; preds = %150, %146, %143
br label %160
155: ; preds = %126
%156 = load i8**, i8*** %5
%157 = getelementptr inbounds i8*, i8** %156, i64 0
%158 = load i8*, i8** %157
%159 = call i32 @usage(i8* %158)
br label %160
160: ; preds = %155, %154
ret i32 0
}

LLVM IR (-O2):
@stdout = global i8* null
@.str = [2 x i8] c"w\00"
@errno = global i32 0
@.str.1 = [30 x i8] c"couldn't open output file %s\0A\00"
@stdin = global i8* null
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [18 x i8] c"couldn't open %s\0A\00"
@stderr = global i32 0
@.str.4 = [18 x i8] c"no file provided\0A\00"
@.str.5 = [19 x i8] c"couldn't close %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %82
5: ; preds = %2
%6 = load i8*, i8** @stdout
%7 = icmp eq i32 %0, 2
br i1 %7, label %35, label %8
8: ; preds = %5, %32
%9 = phi i32 [ %33, %32 ], [ 1, %5 ]
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @strlen(i8* %12)
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %82
15: ; preds = %8
%16 = load i8, i8* %12
%17 = icmp eq i8 %16, 45
br i1 %17, label %18, label %82
18: ; preds = %15
%19 = getelementptr inbounds i8, i8* %12, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 111
br i1 %21, label %22, label %82
22: ; preds = %18
%23 = add nuw nsw i32 %9, 1
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = tail call i8* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = load i32, i32* @errno
%31 = tail call i32 @custom_error(i32 %30, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %26)
br label %32
32: ; preds = %22, %29
%33 = add nuw nsw i32 %9, 2
%34 = icmp slt i32 %33, %3
br i1 %34, label %8, label %35
35: ; preds = %32, %5
%36 = phi i8* [ %6, %5 ], [ %27, %32 ]
%37 = phi i32 [ 1, %5 ], [ %33, %32 ]
%38 = icmp eq i32 %37, %3
br i1 %38, label %39, label %60
39: ; preds = %35
%40 = sext i32 %3 to i64
%41 = getelementptr inbounds i8*, i8** %1, i64 %40
%42 = load i8*, i8** %41
%43 = tail call i32 @strlen(i8* %42)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %48
45: ; preds = %39
%46 = load i8, i8* %42
%47 = icmp eq i8 %46, 45
br i1 %47, label %63, label %48
48: ; preds = %45, %39
%49 = tail call i32 @strlen(i8* %42)
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %82
51: ; preds = %48
%52 = load i8, i8* %42
%53 = icmp eq i8 %52, 45
br i1 %53, label %82, label %54
54: ; preds = %51
%55 = tail call i8* @fopen(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%56 = icmp eq i8* %55, null
br i1 %56, label %57, label %68
57: ; preds = %54
%58 = load i32, i32* @errno
%59 = tail call i32 @custom_error(i32 %58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %42)
br label %82
60: ; preds = %35
%61 = load i32, i32* @stderr
%62 = tail call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %82
63: ; preds = %45
%64 = load i8*, i8** @stdin
%65 = icmp eq i8* %64, null
br i1 %65, label %82, label %66
66: ; preds = %63
%67 = tail call i32 @decode(i8* %64, i8* %36)
br label %75
68: ; preds = %54
%69 = tail call i32 @decode(i8* %55, i8* %36)
%70 = tail call i64 @fclose(i8* %55)
%71 = icmp eq i64 %70, 0
br i1 %71, label %75, label %72
72: ; preds = %68
%73 = load i32, i32* @errno
%74 = tail call i32 @custom_error(i32 %73, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %42)
br label %75
75: ; preds = %66, %72, %68
br i1 %7, label %85, label %76
76: ; preds = %75
%77 = tail call i64 @fclose(i8* %36)
%78 = icmp eq i64 %77, 0
br i1 %78, label %85, label %79
79: ; preds = %76
%80 = load i32, i32* @errno
%81 = tail call i32 @custom_error(i32 %80, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %36)
br label %85
82: ; preds = %8, %15, %18, %57, %2, %60, %48, %51, %63
%83 = load i8*, i8** %1
%84 = tail call i32 @usage(i8* %83)
br label %85
85: ; preds = %75, %76, %79, %82
ret i32 0
}