#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*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int i;
  if (argc < 2)
    usage();
  for (i = 1; i < argc; i++) {
    printf("%s: ", argv[i]);
    if (access(argv[i], F_OK) < 0)
      printf("%s\n", strerror(errno));
    else
      printf("access ok\n");
  }
  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    1167 <main+0x27>
mov    $0x0,%al
call   1040 <usage@plt>
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),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2e29(%rip),%rax
mov    (%rax),%esi
call   1050 <access@plt>
cmp    $0x0,%rax
jge    11dc <main+0x9c>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %rax,%rsi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <main+0xaa>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <main+0xaf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <main+0x2e>
xor    %eax,%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
cmp    $0x1,%edi
jg     1178 <main+0x28>
xor    %eax,%eax
call   1050 <usage@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r12
mov    %edi,%r15d
mov    $0x1,%ebx
lea    0xe76(%rip),%r14
mov    0x2e3f(%rip),%r13
lea    0xe6d(%rip),%rbp
jmp    11ae <main+0x5e>
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     1167 <main+0x17>
mov    (%r12,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r12,%rbx,8),%rdi
mov    0x0(%r13),%esi
call   1060 <access@plt>
mov    %rbp,%rdi
test   %rax,%rax
jns    11a0 <main+0x50>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    %rax,%rdi
jmp    11a0 <main+0x50>

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@F_OK = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@errno = global i32 0
@.str.2 = [11 x i8] c"access ok\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 slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @usage()
br label %11
11: ; preds = %9, %2
store i32 1, i32* %6
br label %12
12: ; preds = %38, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %41
16: ; preds = %12
%17 = load i8**, i8*** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %21)
%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* @F_OK
%29 = call i64 @access(i8* %27, i32 %28)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %16
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %37
35: ; preds = %16
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %31
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %12
41: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
@F_OK = global i32 0
@errno = global i32 0
@str = [10 x i8] c"access ok\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %25
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %20
%9 = phi i64 [ 1, %6 ], [ %23, %20 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %10
%14 = load i32, i32* @F_OK
%15 = tail call i64 @access(i8* %13, i32 %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %8
%18 = load i32, i32* @errno
%19 = tail call i8* @strerror(i32 %18)
br label %20
20: ; preds = %8, %17
%21 = phi i8* [ %19, %17 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0), %8 ]
%22 = tail call i32 @puts(i8* dereferenceable(1) %21)
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %25, label %8
25: ; preds = %20, %4
ret i32 0
}