#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*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strings(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  if (argc > 1) {
    int i;
    for (i = 1; i < argc; i++) {
      FILE *pf;
      if (strcmp(argv[i], "-a") == 0)
        continue;
      if ((pf = fopen(argv[i], "rb")) == NULL) {
        perror("fopen");
        return (1);
      }
      strings(pf);
    }
  } else {
    strings(stdin);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11f4 <main+0xb4>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ef <main+0xaf>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119a <main+0x5a>
jmp    11e1 <main+0xa1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe56(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11d8 <main+0x98>
lea    0xe3f(%rip),%rdi
call   1060 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    120a <main+0xca>
mov    -0x20(%rbp),%rdi
call   1030 <strings@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1167 <main+0x27>
jmp    1203 <main+0xc3>
mov    0x2ded(%rip),%rax
mov    (%rax),%rdi
call   1030 <strings@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x2,%edi
jl     11a7 <main+0x67>
mov    %rsi,%r13
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xea0(%rip),%r14
lea    0xe9c(%rip),%r15
jmp    1179 <main+0x39>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r12
je     11b6 <main+0x76>
mov    0x0(%r13,%rbx,8),%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1170 <main+0x30>
mov    0x0(%r13,%rbx,8),%rdi
mov    %r15,%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11c2 <main+0x82>
mov    %rax,%rdi
call   1030 <strings@plt>
jmp    1170 <main+0x30>
mov    0x2e3a(%rip),%rax
mov    (%rax),%rdi
call   1030 <strings@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe3d(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%eax
jmp    11b8 <main+0x78>

LLVM IR (-O0):
@.str = [3 x i8] c"-a\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [6 x i8] c"fopen\00"
@stdin = global i32* null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %41
10: ; preds = %2
store i32 1, i32* %6
br label %11
11: ; preds = %37, %10
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %40
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %15
br label %37
24: ; preds = %15
%25 = load i8**, i8*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %7
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %45
34: ; preds = %24
%35 = load i32*, i32** %7
%36 = call i32 @strings(i32* %35)
br label %37
37: ; preds = %34, %23
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %11
40: ; preds = %11
br label %44
41: ; preds = %2
%42 = load i32*, i32** @stdin
%43 = call i32 @strings(i32* %42)
br label %44
44: ; preds = %41, %40
store i32 0, i32* %3
br label %45
45: ; preds = %44, %32
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [3 x i8] c"-a\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [6 x i8] c"fopen\00"
@stdin = global i32* null
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %23
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %18
%7 = phi i64 [ 1, %4 ], [ %19, %18 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %6
%13 = load i8*, i8** %8
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %21, label %16
16: ; preds = %12
%17 = tail call i32 @strings(i32* %14)
br label %18
18: ; preds = %16, %6
%19 = add nuw nsw i64 %7, 1
%20 = icmp eq i64 %19, %5
br i1 %20, label %26, label %6
21: ; preds = %12
%22 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %26
23: ; preds = %2
%24 = load i32*, i32** @stdin
%25 = tail call i32 @strings(i32* %24)
br label %26
26: ; preds = %18, %23, %21
%27 = phi i32 [ 1, %21 ], [ 0, %23 ], [ 0, %18 ]
ret i32 %27
}