#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*/ copy_file_to_stdout(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ print_error_msg(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ print_version();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int i;
  if (argc == 1) {
    print_usage();
    exit(EXIT_FAILURE);
  }
  if (argc == 2 &&
      (!strcmp(argv[1], "--usage") || !strcmp(argv[1], "--help"))) {
    print_usage();
    exit(EXIT_SUCCESS);
  }
  if (argc == 2 && !strcmp(argv[1], "--version")) {
    print_version();
    exit(EXIT_SUCCESS);
  }
  for (i = 1; i < argc; ++i) {
    printf("/* %s */\n", argv[i]);
    print_error_msg(copy_file_to_stdout(argv[i]), argv[i]);
    if (i + 1 < argc)
      puts("\n");
  }
  return EXIT_SUCCESS;
}


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)
jne    11b5 <main+0x35>
mov    $0x0,%al
call   10a0 <print_usage@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    120e <main+0x8e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe32(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     11f9 <main+0x79>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    120e <main+0x8e>
mov    $0x0,%al
call   10a0 <print_usage@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    124a <main+0xca>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde8(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    124a <main+0xca>
mov    $0x0,%al
call   1040 <print_version@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c7 <main+0x147>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xda9(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <copy_file_to_stdout@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <print_error_msg@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jge    12b4 <main+0x134>
lea    0xd72(%rip),%rdi
call   1030 <puts@plt>
jmp    12b9 <main+0x139>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1251 <main+0xd1>
mov    0x2d0a(%rip),%rax
mov    (%rax),%eax
add    $0x20,%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
mov    %edi,%ebp
cmp    $0x2,%edi
je     11b8 <main+0x38>
cmp    $0x1,%ebp
je     1284 <main+0x104>
jg     1201 <main+0x81>
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbx),%r14
lea    0xe3d(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     127b <main+0xfb>
lea    0xe2e(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     127b <main+0xfb>
lea    0xe1e(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1299 <main+0x119>
mov    %ebp,%r12d
mov    $0x1,%r13d
sub    %r12,%r13
mov    $0x2,%ebp
lea    0xe00(%rip),%r15
lea    0xe01(%rip),%r14
jmp    1249 <main+0xc9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(,%rbp,1),%rax
add    %r13,%rax
add    $0x1,%rbp
cmp    $0x2,%rax
je     11a0 <main+0x20>
mov    -0x8(%rbx,%rbp,8),%rsi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    -0x8(%rbx,%rbp,8),%rdi
call   1080 <copy_file_to_stdout@plt>
mov    -0x8(%rbx,%rbp,8),%rsi
mov    %eax,%edi
call   1070 <print_error_msg@plt>
cmp    %r12,%rbp
jae    1230 <main+0xb0>
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    1230 <main+0xb0>
xor    %eax,%eax
call   10a0 <print_usage@plt>
jmp    12a0 <main+0x120>
xor    %eax,%eax
call   10a0 <print_usage@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
xor    %eax,%eax
call   1040 <print_version@plt>
mov    0x2d31(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [8 x i8] c"--usage\00"
@.str.1 = [7 x i8] c"--help\00"
@EXIT_SUCCESS = global i32 0
@.str.2 = [10 x i8] c"--version\00"
@.str.3 = [10 x i8] c"/* %s */\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = call i32 (...) @print_usage()
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %22, %16
%29 = call i32 (...) @print_usage()
%30 = load i32, i32* @EXIT_SUCCESS
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %22, %13
%33 = load i32, i32* %4
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %45
35: ; preds = %32
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %35
%42 = call i32 (...) @print_version()
%43 = load i32, i32* @EXIT_SUCCESS
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %35, %32
store i32 1, i32* %6
br label %46
46: ; preds = %76, %45
%47 = load i32, i32* %6
%48 = load i32, i32* %4
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %79
50: ; preds = %46
%51 = load i8**, i8*** %5
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%57 = load i8**, i8*** %5
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @copy_file_to_stdout(i8* %61)
%63 = load i8**, i8*** %5
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %63, i64 %65
%67 = load i8*, i8** %66
%68 = call i32 @print_error_msg(i32 %62, i8* %67)
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
%71 = load i32, i32* %4
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %75
73: ; preds = %50
%74 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %75
75: ; preds = %73, %50
br label %76
76: ; preds = %75
%77 = load i32, i32* %6
%78 = add nsw i32 %77, 1
store i32 %78, i32* %6
br label %46
79: ; preds = %46
%80 = load i32, i32* @EXIT_SUCCESS
ret i32 %80
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [8 x i8] c"--usage\00"
@.str.1 = [7 x i8] c"--help\00"
@EXIT_SUCCESS = global i32 0
@.str.2 = [10 x i8] c"--version\00"
@.str.3 = [10 x i8] c"/* %s */\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %26 [
i32 1, label %3
i32 2, label %7
]
3: ; preds = %2
%4 = tail call i32 (...) @print_usage()
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12, %7
%16 = tail call i32 (...) @print_usage()
%17 = load i32, i32* @EXIT_SUCCESS
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %12
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = tail call i32 (...) @print_version()
%24 = load i32, i32* @EXIT_SUCCESS
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %2
%27 = icmp sgt i32 %0, 1
br i1 %27, label %28, label %46
28: ; preds = %19, %26
%29 = zext i32 %0 to i64
%30 = zext i32 %0 to i64
br label %31
31: ; preds = %28, %44
%32 = phi i64 [ 1, %28 ], [ %40, %44 ]
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %33
%37 = tail call i32 @copy_file_to_stdout(i8* %36)
%38 = load i8*, i8** %33
%39 = tail call i32 @print_error_msg(i32 %37, i8* %38)
%40 = add nuw nsw i64 %32, 1
%41 = icmp ult i64 %40, %29
br i1 %41, label %42, label %44
42: ; preds = %31
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %31, %42
%45 = icmp eq i64 %40, %30
br i1 %45, label %46, label %31
46: ; preds = %44, %26
%47 = load i32, i32* @EXIT_SUCCESS
ret i32 %47
}