#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ cat_file(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int ret = EXIT_SUCCESS, i;
  if (argc >= 2 && strcmp(argv[1], "--help") == 0) {
    printf("Usage: %s <file...>\n", argv[0]);
    return EXIT_SUCCESS;
  }
  if (argc < 2) {
    if (!cat_file("-")) {
      ret = EXIT_FAILURE;
    }
  } else {
    for (i = 1; i < argc; i++) {
      if (!cat_file(argv[i])) {
        ret = EXIT_FAILURE;
      }
    }
  }
  return ret;
}


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)
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     119e <main+0x6e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119e <main+0x6e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1225 <main+0xf5>
cmpl   $0x2,-0x8(%rbp)
jge    11ce <main+0x9e>
lea    0xe6d(%rip),%rdi
call   1050 <cat_file@plt>
cmp    $0x0,%eax
jne    11c9 <main+0x99>
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    121f <main+0xef>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    121a <main+0xea>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <cat_file@plt>
cmp    $0x0,%eax
jne    1207 <main+0xd7>
mov    0x2dde(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    120c <main+0xdc>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d5 <main+0xa5>
jmp    121f <main+0xef>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e99(%rip),%rbx
mov    (%rbx),%r15d
cmp    $0x2,%edi
jl     119b <main+0x6b>
mov    %rsi,%r12
mov    %edi,%r14d
mov    0x8(%rsi),%rdi
lea    0xea8(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b7 <main+0x87>
mov    %r14d,%ebp
mov    $0x1,%ebx
mov    0x2e6f(%rip),%r14
jmp    1189 <main+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     11ca <main+0x9a>
mov    (%r12,%rbx,8),%rdi
call   1050 <cat_file@plt>
test   %eax,%eax
jne    1180 <main+0x50>
mov    (%r14),%r15d
jmp    1180 <main+0x50>
lea    0xe7a(%rip),%rdi
call   1050 <cat_file@plt>
test   %eax,%eax
jne    11ca <main+0x9a>
mov    0x2e2e(%rip),%rax
mov    (%rax),%r15d
jmp    11ca <main+0x9a>
mov    (%r12),%rsi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [7 x i8] c"--help\00"
@.str.1 = [21 x i8] c"Usage: %s <file...>\0A\00"
@.str.2 = [2 x i8] c"-\00"
@EXIT_FAILURE = global i32 0
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* @EXIT_SUCCESS
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 2
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_SUCCESS
store i32 %22, i32* %3
br label %54
23: ; preds = %11, %2
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 2
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = call i32 @cat_file(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = load i32, i32* @EXIT_FAILURE
store i32 %30, i32* %6
br label %31
31: ; preds = %29, %26
br label %52
32: ; preds = %23
store i32 1, i32* %7
br label %33
33: ; preds = %48, %32
%34 = load i32, i32* %7
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %51
37: ; preds = %33
%38 = load i8**, i8*** %5
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @cat_file(i8* %42)
%44 = icmp ne i32 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %37
%46 = load i32, i32* @EXIT_FAILURE
store i32 %46, i32* %6
br label %47
47: ; preds = %45, %37
br label %48
48: ; preds = %47
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %33
51: ; preds = %33
br label %52
52: ; preds = %51, %31
%53 = load i32, i32* %6
store i32 %53, i32* %3
br label %54
54: ; preds = %52, %17
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [7 x i8] c"--help\00"
@.str.1 = [21 x i8] c"Usage: %s <file...>\0A\00"
@.str.2 = [2 x i8] c"-\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = zext i32 %0 to i64
br label %21
12: ; preds = %5
%13 = load i8*, i8** %1
%14 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @EXIT_SUCCESS
br label %32
16: ; preds = %2
%17 = tail call i32 @cat_file(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
%19 = load i32, i32* @EXIT_FAILURE
%20 = select i1 %18, i32 %19, i32 %3
br label %32
21: ; preds = %10, %21
%22 = phi i64 [ 1, %10 ], [ %30, %21 ]
%23 = phi i32 [ %3, %10 ], [ %29, %21 ]
%24 = getelementptr inbounds i8*, i8** %1, i64 %22
%25 = load i8*, i8** %24
%26 = tail call i32 @cat_file(i8* %25)
%27 = icmp eq i32 %26, 0
%28 = load i32, i32* @EXIT_FAILURE
%29 = select i1 %27, i32 %28, i32 %23
%30 = add nuw nsw i64 %22, 1
%31 = icmp eq i64 %30, %11
br i1 %31, label %32, label %21
32: ; preds = %21, %16, %12
%33 = phi i32 [ %15, %12 ], [ %20, %16 ], [ %29, %21 ]
ret i32 %33
}