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

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ ENOSYS;
int _STAT_VER;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __lxstat64(int vers, const char *file, struct stat64 *buf) {
  if (vers != _STAT_VER || file == NULL || buf == NULL) {
    __set_errno(EINVAL);
    return -1;
  }
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__lxstat64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%eax
jne    114b <__lxstat64+0x3b>
cmpq   $0x0,-0x10(%rbp)
je     114b <__lxstat64+0x3b>
cmpq   $0x0,-0x18(%rbp)
jne    1165 <__lxstat64+0x55>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117a <__lxstat64+0x6a>
mov    0x2e7c(%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):
<__lxstat64>:
push   %rax
mov    0x2ec0(%rip),%r8
mov    0x2eb1(%rip),%rax
mov    %rax,%rcx
cmp    %edi,(%r8)
jne    112e <__lxstat64+0x1e>
mov    0x2eba(%rip),%rcx
test   %rsi,%rsi
cmove  %rax,%rcx
test   %rdx,%rdx
cmove  %rax,%rcx
mov    (%rcx),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat64 = type { i32 }
@_STAT_VER = global i32 0
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @__lxstat64(i32 %0, i8* %1, %struct.stat64* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.stat64*
store i32 %0, i32* %5
store i8* %1, i8** %6
store %struct.stat64* %2, %struct.stat64** %7
%8 = load i32, i32* %5
%9 = load i32, i32* @_STAT_VER
%10 = icmp ne i32 %8, %9
br i1 %10, label %17, label %11
11: ; preds = %3
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load %struct.stat64*, %struct.stat64** %7
%16 = icmp eq %struct.stat64* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14, %11, %3
%18 = load i32, i32* @EINVAL
%19 = call i32 @__set_errno(i32 %18)
store i32 -1, i32* %4
br label %23
20: ; preds = %14
%21 = load i32, i32* @ENOSYS
%22 = call i32 @__set_errno(i32 %21)
store i32 -1, i32* %4
br label %23
23: ; preds = %20, %17
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.stat64 = type { i32 }
@_STAT_VER = global i32 0
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @__lxstat64(i32 %0, i8* readnone %1, %struct.stat64* readnone %2) {
%4 = load i32, i32* @_STAT_VER
%5 = icmp ne i32 %4, %0
%6 = icmp eq i8* %1, null
%7 = or i1 %6, %5
%8 = icmp eq %struct.stat64* %2, null
%9 = or i1 %8, %7
%10 = load i32, i32* @EINVAL
%11 = load i32, i32* @ENOSYS
%12 = select i1 %9, i32 %10, i32 %11
%13 = tail call i32 @__set_errno(i32 %12)
ret i32 -1
}