#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ print_blank_lines();
int print_file_contents(char *);
int /*<<< orphan*/ print_heading(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc == 1) {
    fprintf(stderr, "%s: no files specified\n", argv[0]);
    return EXIT_FAILURE;
  }
  for (int i = 1; i < argc; ++i) {
    print_heading(argv[i], i);
    bool printed_successfully = print_file_contents(argv[i]);
    if (printed_successfully && (i != argc - 1)) {
      print_blank_lines();
    }
  }
  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    118d <main+0x4d>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1209 <main+0xc9>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fd <main+0xbd>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x14(%rbp),%esi
call   1050 <print_heading@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <print_file_contents@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11ea <main+0xaa>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11ea <main+0xaa>
mov    $0x0,%al
call   1030 <print_blank_lines@plt>
jmp    11ef <main+0xaf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1194 <main+0x54>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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
mov    %rsi,%r14
cmp    $0x1,%edi
jne    1172 <main+0x32>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e68(%rip),%r15
jmp    11bf <main+0x7f>
mov    0x2e57(%rip),%r15
jle    11bf <main+0x7f>
lea    -0x1(%rdi),%r12d
mov    %edi,%r13d
mov    $0x1,%ebx
jmp    1199 <main+0x59>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r13
je     11bf <main+0x7f>
mov    (%r14,%rbx,8),%rdi
mov    %ebx,%esi
call   1050 <print_heading@plt>
mov    (%r14,%rbx,8),%rdi
call   1060 <print_file_contents@plt>
test   %eax,%eax
je     1190 <main+0x50>
cmp    %rbx,%r12
je     1190 <main+0x50>
xor    %eax,%eax
call   1030 <print_blank_lines@plt>
jmp    1190 <main+0x50>
mov    (%r15),%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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