#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 *uint64_t;
typedef char *int64_t;

/* Variables and functions */
int64_t syscall5(uint64_t msg, uint64_t dest, uint64_t arg1, uint64_t arg2,
                 uint64_t arg3, uint64_t arg4) {
  register int64_t r8 __asm__("r8") = arg3;
  register int64_t r9 __asm__("r9") = arg4;
  __asm__ __volatile__(
      "syscall"
      : "=a"(msg), "=D"(dest), "=S"(arg1), "=d"(arg2), "=r"(r8), "=r"(r9)
      : "a"(msg), "D"(dest), "S"(arg1), "d"(arg2), "r"(r8), "r"(r9)
      : "r10", "r11", "%rcx", "memory");
  return msg;
}


x86 assembly (clang, -O0):
<syscall5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
syscall
mov    %rax,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall5>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
syscall
ret

LLVM IR (-O0):
define i8* @syscall5(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%15 = load i8*, i8** %11
store i8* %15, i8** %13
%16 = load i8*, i8** %12
store i8* %16, i8** %14
%17 = load i8*, i8** %7
%18 = load i8*, i8** %8
%19 = load i8*, i8** %9
%20 = load i8*, i8** %10
%21 = load i8*, i8** %13
%22 = load i8*, i8** %14
%23 = call { i8*, i8*, i8*, i8*, i8*, i8* } asm sideeffect "syscall", "={ax},={di},={si},={dx},={r8},={r9},{ax},{di},{si},{dx},{r8},{r9},~{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %17, i8* %18, i8* %19, i8* %20, i8* %21, i8* %22)
%24 = extractvalue { i8*, i8*, i8*, i8*, i8*, i8* } %23, 0
%25 = extractvalue { i8*, i8*, i8*, i8*, i8*, i8* } %23, 1
%26 = extractvalue { i8*, i8*, i8*, i8*, i8*, i8* } %23, 2
%27 = extractvalue { i8*, i8*, i8*, i8*, i8*, i8* } %23, 3
%28 = extractvalue { i8*, i8*, i8*, i8*, i8*, i8* } %23, 4
%29 = extractvalue { i8*, i8*, i8*, i8*, i8*, i8* } %23, 5
store i8* %24, i8** %7
store i8* %25, i8** %8
store i8* %26, i8** %9
store i8* %27, i8** %10
store i8* %28, i8** %13
store i8* %29, i8** %14
%30 = load i8*, i8** %7
ret i8* %30
}

LLVM IR (-O2):
define i8* @syscall5(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = tail call { i8*, i8*, i8*, i8*, i8*, i8* } asm sideeffect "syscall", "={ax},={di},={si},={dx},={r8},={r9},{ax},{di},{si},{dx},{r8},{r9},~{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5)
%8 = extractvalue { i8*, i8*, i8*, i8*, i8*, i8* } %7, 0
ret i8* %8
}