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


x86 assembly (clang, -O0):
<sys$set_implicit_affinity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
movslq -0x1c(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%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    $0x6d,%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$set_implicit_affinity>:
movslq %ecx,%r10
mov    $0x6d,%rax
int    $0x81
ret

LLVM IR (-O0):
%struct._generic_64 = type opaque
define i32 @"sys$set_implicit_affinity"(i32* %0, i8* %1, %struct._generic_64* %2, i32 %3, %struct._generic_64* %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca %struct._generic_64*
%9 = alloca i32
%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 i8* %1, i8** %7
store %struct._generic_64* %2, %struct._generic_64** %8
store i32 %3, i32* %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 i32, i32* %9
%21 = sext i32 %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 i8*, i8** %7
%25 = ptrtoint i8* %24 to i64
store i64 %25, i64* %15
%26 = load i32*, i32** %6
%27 = ptrtoint 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 109, 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$set_implicit_affinity"(i32* %0, i8* %1, %struct._generic_64* %2, i32 %3, %struct._generic_64* %4) {
%6 = ptrtoint %struct._generic_64* %4 to i64
%7 = sext i32 %3 to i64
%8 = ptrtoint %struct._generic_64* %2 to i64
%9 = ptrtoint i8* %1 to i64
%10 = ptrtoint 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 109, i64 %10, i64 %9, i64 %8, i64 %7, i64 %6)
%12 = trunc i64 %11 to i32
ret i32 %12
}