#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_info(struct stat *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  struct stat buf;
  int i;
  if (argc < 2) {
    printf("Missing input files\n");
    return 0;
  }
  for (i = 1; i < argc; i++) {
    if (stat(argv[i], &buf) != 0) {
      perror(argv[i]);
      continue;
    }
    printf("File: '%s':\n", argv[i]);
    print_info(&buf);
  }
  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   $0x2,-0x8(%rbp)
jge    117a <main+0x3a>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11fa <main+0xba>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f3 <main+0xb3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     11c2 <main+0x82>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <perror@plt>
jmp    11e5 <main+0xa5>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1060 <print_info@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1181 <main+0x41>
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
sub    $0x10,%rsp
cmp    $0x2,%edi
jge    117e <main+0x2e>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    %rsi,%r13
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0x8(%rsp),%r14
lea    0xe6b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13,%rbx,8),%rdi
mov    %r14,%rsi
call   1050 <stat@plt>
mov    0x0(%r13,%rbx,8),%rsi
test   %rax,%rax
jne    11d4 <main+0x84>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1070 <print_info@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    11a0 <main+0x50>
jmp    116e <main+0x1e>
mov    %rsi,%rdi
call   1060 <perror@plt>
jmp    11c9 <main+0x79>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [21 x i8] c"Missing input files\0A\00"
@.str.1 = [13 x i8] c"File: '%s':\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%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 slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %44
12: ; preds = %2
store i32 1, i32* %7
br label %13
13: ; preds = %40, %12
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %43
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i64 @stat(i8* %22, %struct.stat* %6)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %17
%26 = load i8**, i8*** %5
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @perror(i8* %30)
br label %40
32: ; preds = %17
%33 = load i8**, i8*** %5
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = call i32 @print_info(%struct.stat* %6)
br label %40
40: ; preds = %32, %25
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %13
43: ; preds = %13
store i32 0, i32* %3
br label %44
44: ; preds = %43, %10
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str.1 = [13 x i8] c"File: '%s':\0A\00"
@str = [20 x i8] c"Missing input files\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %25
10: ; preds = %6, %22
%11 = phi i64 [ 1, %6 ], [ %23, %22 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = call i64 @stat(i8* %13, %struct.stat* %3)
%15 = icmp eq i64 %14, 0
%16 = load i8*, i8** %12
br i1 %15, label %19, label %17
17: ; preds = %10
%18 = call i32 @perror(i8* %16)
br label %22
19: ; preds = %10
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%21 = call i32 @print_info(%struct.stat* %3)
br label %22
22: ; preds = %19, %17
%23 = add nuw nsw i64 %11, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %25, label %10
25: ; preds = %22, %8
ret i32 0
}