#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 */
typedef char *ssize_t;

/* Variables and functions */
long errno;
ssize_t sys_lgetxattr(const char *p, const char *n, void *v, size_t s) {
  long __res;
  __asm__ __volatile__("movq %5,%%r10; syscall"
                       : "=a"(__res)
                       : "0"(192), "D"((long)(p)), "S"((long)(n)),
                         "d"((long)(v)), "g"((long)(s))
                       : "r10", "r11", "rcx", "memory");
  do {
    if ((unsigned long)(__res) >= (unsigned long)(-4095)) {
      errno = -(__res);
      __res = -1;
    }
    return (ssize_t)(__res);
  } while (0);
}


x86 assembly (clang, -O0):
<sys_lgetxattr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0xc0,%eax
mov    -0x30(%rbp),%r10
syscall
mov    %rax,-0x28(%rbp)
cmpq   $0xfffffffffffff001,-0x28(%rbp)
ff
jb     115f <sys_lgetxattr+0x5f>
xor    %eax,%eax
mov    %eax,%ecx
sub    -0x28(%rbp),%rcx
mov    0x2e8c(%rip),%rax
mov    %rcx,(%rax)
movq   $0xffffffffffffffff,-0x28(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_lgetxattr>:
mov    %rcx,-0x8(%rsp)
mov    $0xc0,%eax
mov    -0x8(%rsp),%r10
syscall
cmp    $0xfffffffffffff001,%rax
jb     112d <sys_lgetxattr+0x2d>
neg    %rax
mov    0x2ebd(%rip),%rcx
mov    %rax,(%rcx)
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
@errno = global i64 0
define i8* @sys_lgetxattr(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%10 = load i8*, i8** %5
%11 = ptrtoint i8* %10 to i64
%12 = load i8*, i8** %6
%13 = ptrtoint i8* %12 to i64
%14 = load i8*, i8** %7
%15 = ptrtoint i8* %14 to i64
%16 = load i64, i64* %8
%17 = call i64 asm sideeffect "movq $5,%r10; syscall", "={ax},0,{di},{si},{dx},imr,~{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 192, i64 %11, i64 %13, i64 %15, i64 %16)
store i64 %17, i64* %9
br label %18
18: ; preds = %4
%19 = load i64, i64* %9
%20 = icmp uge i64 %19, -4095
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i64, i64* %9
%23 = sub nsw i64 0, %22
store i64 %23, i64* @errno
store i64 -1, i64* %9
br label %24
24: ; preds = %21, %18
%25 = load i64, i64* %9
%26 = inttoptr i64 %25 to i8*
br label %27
27: ; preds = %24
ret i8* %26
}

LLVM IR (-O2):
@errno = global i64 0
define i8* @sys_lgetxattr(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = ptrtoint i8* %0 to i64
%6 = ptrtoint i8* %1 to i64
%7 = ptrtoint i8* %2 to i64
%8 = tail call i64 asm sideeffect "movq $5,%r10; syscall", "={ax},0,{di},{si},{dx},imr,~{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 192, i64 %5, i64 %6, i64 %7, i64 %3)
%9 = icmp ugt i64 %8, -4096
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = sub nsw i64 0, %8
store i64 %11, i64* @errno
br label %12
12: ; preds = %10, %4
%13 = phi i64 [ -1, %10 ], [ %8, %4 ]
%14 = inttoptr i64 %13 to i8*
ret i8* %14
}