int sys$setprv(char enbflg, struct _generic_64 *prvadr, char prmflg,
               struct _generic_64 *prvprv) {
  return ({
    unsigned long resultvar;
    register long int _a4 asm("r10") = (long)(prvprv);
    register long int _a3 asm("rdx") = (long)(prmflg);
    register long int _a2 asm("rsi") = (long)(prvadr);
    register long int _a1 asm("rdi") = (long)(enbflg);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x81\n\t"
                 : "=a"(resultvar)
                 : "i"(104), "r"(_a1), "r"(_a2), "r"(_a3), "r"(_a4)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$setprv>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
movsbq -0x11(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
movsbq -0x1(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%r10
mov    $0x68,%rax
int    $0x81
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys$setprv>:
movslq %edx,%rdx
movslq %edi,%rdi
mov    %rcx,%r10
mov    $0x68,%rax
int    $0x81
ret

LLVM IR (-O0):
%struct._generic_64 = type opaque
define i32 @"sys$setprv"(i8 signext %0, %struct._generic_64* %1, i8 signext %2, %struct._generic_64* %3) {
%5 = alloca i8
%6 = alloca %struct._generic_64*
%7 = alloca i8
%8 = alloca %struct._generic_64*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
store i8 %0, i8* %5
store %struct._generic_64* %1, %struct._generic_64** %6
store i8 %2, i8* %7
store %struct._generic_64* %3, %struct._generic_64** %8
%15 = load %struct._generic_64*, %struct._generic_64** %8
%16 = ptrtoint %struct._generic_64* %15 to i64
store i64 %16, i64* %10
%17 = load i8, i8* %7
%18 = sext i8 %17 to i64
store i64 %18, i64* %11
%19 = load %struct._generic_64*, %struct._generic_64** %6
%20 = ptrtoint %struct._generic_64* %19 to i64
store i64 %20, i64* %12
%21 = load i8, i8* %5
%22 = sext i8 %21 to i64
store i64 %22, i64* %13
%23 = load i64, i64* %13
%24 = load i64, i64* %12
%25 = load i64, i64* %11
%26 = load i64, i64* %10
%27 = call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},{rsi},{rdx},{r10},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 104, i64 %23, i64 %24, i64 %25, i64 %26)
store i64 %27, i64* %9
%28 = load i64, i64* %9
store i64 %28, i64* %14
%29 = load i64, i64* %14
%30 = trunc i64 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
%struct._generic_64 = type opaque
define i32 @"sys$setprv"(i8 signext %0, %struct._generic_64* %1, i8 signext %2, %struct._generic_64* %3) {
%5 = ptrtoint %struct._generic_64* %3 to i64
%6 = sext i8 %2 to i64
%7 = ptrtoint %struct._generic_64* %1 to i64
%8 = sext i8 %0 to i64
%9 = tail call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},{rsi},{rdx},{r10},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 104, i64 %8, i64 %7, i64 %6, i64 %5)
%10 = trunc i64 %9 to i32
ret i32 %10
}