#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;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ add_single_file(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ basename(char *);
int /*<<< orphan*/ dirname(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void add_files(char *name) {
  if (access(name, F_OK) == -1) {
    printf("ERROR reading '%s' file\n", name);
    exit(0);
  }
  add_single_file(basename(name), dirname(name));
}


x86 assembly (clang, -O0):
<add_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
cmp    $0xffffffff,%eax
jne    119e <add_files+0x3e>
mov    -0x8(%rbp),%rsi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1050 <basename@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <dirname@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1070 <add_single_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_files>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e6b(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
cmp    $0xffffffff,%eax
je     119a <add_files+0x3a>
mov    %rbx,%rdi
call   1050 <basename@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <dirname@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <add_single_file@plt>
lea    0xe5f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@F_OK = global i32 0
@.str = [25 x i8] c"ERROR reading '%s' file\0A\00"
define void @add_files(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @F_OK
%5 = call i32 @access(i8* %3, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @basename(i8* %12)
%14 = load i8*, i8** %2
%15 = call i32 @dirname(i8* %14)
%16 = call i32 @add_single_file(i32 %13, i32 %15)
ret void
}

LLVM IR (-O2):
@F_OK = global i32 0
@.str = [25 x i8] c"ERROR reading '%s' file\0A\00"
define void @add_files(i8* %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %1
%9 = tail call i32 @basename(i8* %0)
%10 = tail call i32 @dirname(i8* %0)
%11 = tail call i32 @add_single_file(i32 %9, i32 %10)
ret void
}