int sys$cpu_capabilities(int cpu_id, struct _generic_64 *select_mask,
                         struct _generic_64 *modify_mask,
                         struct _generic_64 *prev_mask,
                         struct _generic_64 *flags) {
  return ({
    unsigned long resultvar;
    register long int _a5 asm("r8") = (long)(flags);
    register long int _a4 asm("r10") = (long)(prev_mask);
    register long int _a3 asm("rdx") = (long)(modify_mask);
    register long int _a2 asm("rsi") = (long)(select_mask);
    register long int _a1 asm("rdi") = (long)(cpu_id);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x81\n\t"
                 : "=a"(resultvar)
                 : "i"(110), "r"(_a1), "r"(_a2), "r"(_a3), "r"(_a4), "r"(_a5)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$cpu_capabilities>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x40(%rbp),%r10
mov    -0x38(%rbp),%r8
mov    $0x6e,%rax
int    $0x81
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
pop    %rbp
ret

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

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

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