#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 timeval {
  int dummy;
};

/* Variables and functions */
int AT_FDCWD;
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int futimesat(int fd, const char *file, const struct timeval tvp[2]) {
  if (fd < 0 && (file == NULL || (fd != AT_FDCWD && file[0] != '/'))) {
    __set_errno(EBADF);
    return -1;
  }
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<futimesat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1174 <futimesat+0x64>
cmpq   $0x0,-0x10(%rbp)
je     115a <futimesat+0x4a>
mov    -0x8(%rbp),%eax
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%eax
je     1174 <futimesat+0x64>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1174 <futimesat+0x64>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1189 <futimesat+0x79>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<futimesat>:
push   %rax
test   %edi,%edi
js     112a <futimesat+0x1a>
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
mov    0x2ea7(%rip),%rax
test   %rsi,%rsi
je     111c <futimesat+0xc>
mov    0x2e8b(%rip),%rcx
cmp    %edi,(%rcx)
je     1115 <futimesat+0x5>
cmpb   $0x2f,(%rsi)
je     1115 <futimesat+0x5>
jmp    111c <futimesat+0xc>

LLVM IR (-O0):
%struct.timeval = type { i32 }
@AT_FDCWD = global i32 0
@EBADF = global i32 0
@ENOSYS = global i32 0
define i32 @futimesat(i32 %0, i8* %1, %struct.timeval* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.timeval*
store i32 %0, i32* %5
store i8* %1, i8** %6
store %struct.timeval* %2, %struct.timeval** %7
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = load i32, i32* @AT_FDCWD
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load i8*, i8** %6
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 47
br i1 %22, label %23, label %26
23: ; preds = %17, %10
%24 = load i32, i32* @EBADF
%25 = call i32 @__set_errno(i32 %24)
store i32 -1, i32* %4
br label %29
26: ; preds = %17, %13, %3
%27 = load i32, i32* @ENOSYS
%28 = call i32 @__set_errno(i32 %27)
store i32 -1, i32* %4
br label %29
29: ; preds = %26, %23
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@AT_FDCWD = global i32 0
@EBADF = global i32 0
@ENOSYS = global i32 0
define i32 @futimesat(i32 %0, i8* %1, %struct.timeval* nocapture readnone %2) {
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = icmp eq i8* %1, null
br i1 %6, label %14, label %7
7: ; preds = %5
%8 = load i32, i32* @AT_FDCWD
%9 = icmp eq i32 %8, %0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i8, i8* %1
%12 = icmp eq i8 %11, 47
br i1 %12, label %13, label %14
13: ; preds = %10, %7, %3
br label %14
14: ; preds = %5, %10, %13
%15 = phi i32* [ @ENOSYS, %13 ], [ @EBADF, %10 ], [ @EBADF, %5 ]
%16 = load i32, i32* %15
%17 = tail call i32 @__set_errno(i32 %16)
ret i32 -1
}