int sys$assign(void *devnam, unsigned short int *chan, unsigned int acmode,
               void *mbxnam, int flags) {
  return ({
    unsigned long resultvar;
    register long int _a5 asm("r8") = (long)(flags);
    register long int _a4 asm("r10") = (long)(mbxnam);
    register long int _a3 asm("rdx") = (long)(acmode);
    register long int _a2 asm("rsi") = (long)(chan);
    register long int _a1 asm("rdi") = (long)(devnam);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x81\n\t"
                 : "=a"(resultvar)
                 : "i"(30), "r"(_a1), "r"(_a2), "r"(_a3), "r"(_a4), "r"(_a5)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$assign>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movslq -0x24(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
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    $0x1e,%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$assign>:
movslq %r8d,%r8
mov    %edx,%edx
mov    %rcx,%r10
mov    $0x1e,%rax
int    $0x81
ret

LLVM IR (-O0):
define i32 @"sys$assign"(i8* %0, i16* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i16*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
store i8* %0, i8** %6
store i16* %1, i16** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%18 = load i32, i32* %10
%19 = sext i32 %18 to i64
store i64 %19, i64* %12
%20 = load i8*, i8** %9
%21 = ptrtoint i8* %20 to i64
store i64 %21, i64* %13
%22 = load i32, i32* %8
%23 = zext i32 %22 to i64
store i64 %23, i64* %14
%24 = load i16*, i16** %7
%25 = ptrtoint i16* %24 to i64
store i64 %25, i64* %15
%26 = load i8*, i8** %6
%27 = ptrtoint i8* %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 30, 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):
define i32 @"sys$assign"(i8* %0, i16* %1, i32 %2, i8* %3, i32 %4) {
%6 = sext i32 %4 to i64
%7 = ptrtoint i8* %3 to i64
%8 = zext i32 %2 to i64
%9 = ptrtoint i16* %1 to i64
%10 = ptrtoint i8* %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 30, i64 %10, i64 %9, i64 %8, i64 %7, i64 %6)
%12 = trunc i64 %11 to i32
ret i32 %12
}