#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 /*<<< orphan*/ file_exists(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int all_input_files_exist(int argc, char *argv[]) {
  int idx;
  int retval = 1;
  for (idx = 2; idx < argc; idx++) {
    if (!file_exists(argv[idx])) {
      fprintf(stderr, "ERROR: '%s' does not exist\n", argv[idx]);
      retval = 0;
    }
  }
  return retval;
}


x86 assembly (clang, -O0):
<all_input_files_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119e <all_input_files_exist+0x7e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <file_exists@plt>
cmp    $0x0,%eax
jne    118b <all_input_files_exist+0x6b>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe81(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x18(%rbp)
jmp    1190 <all_input_files_exist+0x70>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <all_input_files_exist+0x1d>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<all_input_files_exist>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%r15d
cmp    $0x3,%edi
jl     118b <all_input_files_exist+0x6b>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x1,%r15d
mov    $0x2,%ebp
mov    0x2e92(%rip),%r13
lea    0xeab(%rip),%r14
jmp    1169 <all_input_files_exist+0x49>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%r12
je     118b <all_input_files_exist+0x6b>
mov    (%rbx,%rbp,8),%rdi
call   1030 <file_exists@plt>
test   %eax,%eax
jne    1160 <all_input_files_exist+0x40>
mov    0x0(%r13),%edi
mov    (%rbx,%rbp,8),%rdx
mov    %r14,%rsi
call   1040 <fprintf@plt>
xor    %r15d,%r15d
jmp    1160 <all_input_files_exist+0x40>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"ERROR: '%s' does not exist\0A\00"
define i32 @all_input_files_exist(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %6
store i32 2, i32* %5
br label %7
7: ; preds = %28, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %31
11: ; preds = %7
%12 = load i8**, i8*** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @file_exists(i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %11
%20 = load i32, i32* @stderr
%21 = load i8**, i8*** %4
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %25)
store i32 0, i32* %6
br label %27
27: ; preds = %19, %11
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %7
31: ; preds = %7
%32 = load i32, i32* %6
ret i32 %32
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"ERROR: '%s' does not exist\0A\00"
define i32 @all_input_files_exist(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %17
%7 = phi i64 [ 2, %4 ], [ %19, %17 ]
%8 = phi i32 [ 1, %4 ], [ %18, %17 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i32 @file_exists(i8* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %6
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %9
%16 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %6, %13
%18 = phi i32 [ %8, %6 ], [ 0, %13 ]
%19 = add nuw nsw i64 %7, 1
%20 = icmp eq i64 %19, %5
br i1 %20, label %21, label %6
21: ; preds = %17, %2
%22 = phi i32 [ 1, %2 ], [ %18, %17 ]
ret i32 %22
}