#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ vis(int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int i, strip = 0;
  FILE *fp;
  while (argc > 1 && argv[1][0] == '-') {
    switch (argv[1][1]) {
    case 's':
      strip = 1;
      break;
    default:
      fprintf(stderr, "%s: unknown arg %s\n", argv[0], argv[1]);
      exit(1);
    }
    argc--;
    argv++;
  }
  if (argc == 1)
    vis(stdin, strip);
  else
    for (i = 1; i < argc; ++i)
      if ((fp = fopen(argv[i], "r")) == NULL) {
        fprintf(stderr, "%s: can't open %s\n", argv[0], argv[i]);
        exit(1);
      } else {
        vis(fp, strip);
        fclose(fp);
      }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x21(%rbp)
jle    1190 <main+0x40>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11a0 <main+0x50>
jmp    120c <main+0xbc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x1(%rax),%al
sub    $0x73,%al
jne    11c4 <main+0x74>
jmp    11b8 <main+0x68>
movl   $0x1,-0x18(%rbp)
jmp    11f2 <main+0xa2>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe1d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    116d <main+0x1d>
cmpl   $0x1,-0x8(%rbp)
jne    122d <main+0xdd>
mov    0x2dcb(%rip),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%esi
call   1060 <vis@plt>
jmp    12c5 <main+0x175>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c0 <main+0x170>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdc1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1298 <main+0x148>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xd8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1060 <vis@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
jmp    12b2 <main+0x162>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1234 <main+0xe4>
jmp    12c5 <main+0x175>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11f2 <main+0xa2>
mov    %rsi,%r12
mov    0x8(%rsi),%rcx
xor    %r15d,%r15d
cmpb   $0x2d,(%rcx)
jne    11a6 <main+0x56>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0x73,0x1(%rcx)
jne    123c <main+0xec>
cmp    $0x2,%edi
jle    11fb <main+0xab>
mov    0x10(%r12),%rcx
add    $0x8,%r12
add    $0xffffffff,%edi
cmpb   $0x2d,(%rcx)
je     1180 <main+0x30>
mov    $0x1,%r15d
mov    %edi,%r13d
mov    $0x1,%ebx
lea    0xe5f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,8),%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1220 <main+0xd0>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15d,%esi
call   1060 <vis@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11c0 <main+0x70>
jmp    120f <main+0xbf>
xor    %esi,%esi
cmp    $0x1,%edi
je     1200 <main+0xb0>
jmp    120f <main+0xbf>
mov    $0x1,%esi
mov    0x2de1(%rip),%rax
mov    (%rax),%rdi
call   1060 <vis@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebx,%eax
mov    0x2daf(%rip),%rcx
mov    (%rcx),%edi
mov    (%r12),%rdx
mov    (%r12,%rax,8),%rcx
lea    0xddc(%rip),%rsi
jmp    1250 <main+0x100>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xdb0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"%s: unknown arg %s\0A\00"
@stdin = global i32* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"%s: can't open %s\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 i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %9
9: ; preds = %40, %2
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 45
br label %20
20: ; preds = %12, %9
%21 = phi i1 [ false, %9 ], [ %19, %12 ]
br i1 %21, label %22, label %45
22: ; preds = %20
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
switch i32 %28, label %30 [
i32 115, label %29
]
29: ; preds = %22
store i32 1, i32* %7
br label %40
30: ; preds = %22
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %34, i8* %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %29
%41 = load i32, i32* %4
%42 = add nsw i32 %41, -1
store i32 %42, i32* %4
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i32 1
store i8** %44, i8*** %5
br label %9
45: ; preds = %20
%46 = load i32, i32* %4
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load i32*, i32** @stdin
%50 = load i32, i32* %7
%51 = call i32 @vis(i32* %49, i32 %50)
br label %88
52: ; preds = %45
store i32 1, i32* %6
br label %53
53: ; preds = %84, %52
%54 = load i32, i32* %6
%55 = load i32, i32* %4
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %87
57: ; preds = %53
%58 = load i8**, i8*** %5
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %63, i32** %8
%64 = icmp eq i32* %63, null
br i1 %64, label %65, label %77
65: ; preds = %57
%66 = load i32, i32* @stderr
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 0
%69 = load i8*, i8** %68
%70 = load i8**, i8*** %5
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %70, i64 %72
%74 = load i8*, i8** %73
%75 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %69, i8* %74)
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %57
%78 = load i32*, i32** %8
%79 = load i32, i32* %7
%80 = call i32 @vis(i32* %78, i32 %79)
%81 = load i32*, i32** %8
%82 = call i32 @fclose(i32* %81)
br label %83
83: ; preds = %77
br label %84
84: ; preds = %83
%85 = load i32, i32* %6
%86 = add nsw i32 %85, 1
store i32 %86, i32* %6
br label %53
87: ; preds = %53
br label %88
88: ; preds = %87, %48
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"%s: unknown arg %s\0A\00"
@stdin = global i32* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"%s: can't open %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %30
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %14, label %32
9: ; preds = %22
%10 = getelementptr inbounds i8*, i8** %16, i64 1
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 45
br i1 %13, label %14, label %32
14: ; preds = %4, %9
%15 = phi i8* [ %11, %9 ], [ %6, %4 ]
%16 = phi i8** [ %10, %9 ], [ %5, %4 ]
%17 = phi i8** [ %16, %9 ], [ %1, %4 ]
%18 = phi i32 [ %23, %9 ], [ %0, %4 ]
%19 = getelementptr inbounds i8, i8* %15, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 115
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = add nsw i32 %18, -1
%24 = icmp sgt i32 %18, 2
br i1 %24, label %9, label %37
25: ; preds = %14
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %17
%28 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %27, i8* %15)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %2
%31 = icmp eq i32 %0, 1
br i1 %31, label %37, label %60
32: ; preds = %9, %4
%33 = phi i32 [ %0, %4 ], [ %23, %9 ]
%34 = phi i32 [ 0, %4 ], [ 1, %9 ]
%35 = phi i8** [ %1, %4 ], [ %16, %9 ]
%36 = zext i32 %33 to i64
br label %41
37: ; preds = %22, %30
%38 = phi i32 [ 0, %30 ], [ 1, %22 ]
%39 = load i32*, i32** @stdin
%40 = tail call i32 @vis(i32* %39, i32 %38)
br label %60
41: ; preds = %32, %55
%42 = phi i64 [ 1, %32 ], [ %58, %55 ]
%43 = getelementptr inbounds i8*, i8** %35, i64 %42
%44 = load i8*, i8** %43
%45 = tail call i32* @fopen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %55
47: ; preds = %41
%48 = and i64 %42, 4294967295
%49 = getelementptr inbounds i8*, i8** %35, i64 %48
%50 = load i32, i32* @stderr
%51 = load i8*, i8** %35
%52 = load i8*, i8** %49
%53 = tail call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %51, i8* %52)
%54 = tail call i32 @exit(i32 1)
unreachable
55: ; preds = %41
%56 = tail call i32 @vis(i32* %45, i32 %34)
%57 = tail call i32 @fclose(i32* %45)
%58 = add nuw nsw i64 %42, 1
%59 = icmp eq i64 %58, %36
br i1 %59, label %60, label %41
60: ; preds = %55, %30, %37
ret i32 0
}