int select(int nfds, struct fdset *readfds, struct fdset *writefds,
           struct fdset *exceptfds, struct timeval *timeout) {
  struct {
    int nfds;
    struct fdset *rfds;
    struct fdset *wfds;
    struct fdset *efds;
    struct timeval *tv;
  } args = {nfds, readfds, writefds, exceptfds, timeout};
  return sys_select(&args);
}


x86 assembly (clang, -O0):
<select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   1030 <sys_select@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<select>:
sub    $0x28,%rsp
mov    %edi,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    %r8,0x20(%rsp)
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <sys_select@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.fdset = type opaque
%struct.timeval = type opaque
%struct.anon = type { i32, %struct.fdset*, %struct.fdset*, %struct.fdset*, %struct.timeval* }
define i32 @select(i32 %0, %struct.fdset* %1, %struct.fdset* %2, %struct.fdset* %3, %struct.timeval* %4) {
%6 = alloca i32
%7 = alloca %struct.fdset*
%8 = alloca %struct.fdset*
%9 = alloca %struct.fdset*
%10 = alloca %struct.timeval*
%11 = alloca %struct.anon
store i32 %0, i32* %6
store %struct.fdset* %1, %struct.fdset** %7
store %struct.fdset* %2, %struct.fdset** %8
store %struct.fdset* %3, %struct.fdset** %9
store %struct.timeval* %4, %struct.timeval** %10
%12 = getelementptr inbounds %struct.anon, %struct.anon* %11, i32 0, i32 0
%13 = load i32, i32* %6
store i32 %13, i32* %12
%14 = getelementptr inbounds %struct.anon, %struct.anon* %11, i32 0, i32 1
%15 = load %struct.fdset*, %struct.fdset** %7
store %struct.fdset* %15, %struct.fdset** %14
%16 = getelementptr inbounds %struct.anon, %struct.anon* %11, i32 0, i32 2
%17 = load %struct.fdset*, %struct.fdset** %8
store %struct.fdset* %17, %struct.fdset** %16
%18 = getelementptr inbounds %struct.anon, %struct.anon* %11, i32 0, i32 3
%19 = load %struct.fdset*, %struct.fdset** %9
store %struct.fdset* %19, %struct.fdset** %18
%20 = getelementptr inbounds %struct.anon, %struct.anon* %11, i32 0, i32 4
%21 = load %struct.timeval*, %struct.timeval** %10
store %struct.timeval* %21, %struct.timeval** %20
%22 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @sys_select to i32 (%struct.anon*, ...)*)(%struct.anon* %11)
ret i32 %22
}

LLVM IR (-O2):
%struct.fdset = type opaque
%struct.timeval = type opaque
%struct.anon = type { i32, %struct.fdset*, %struct.fdset*, %struct.fdset*, %struct.timeval* }
define i32 @select(i32 %0, %struct.fdset* %1, %struct.fdset* %2, %struct.fdset* %3, %struct.timeval* %4) {
%6 = alloca %struct.anon
%7 = bitcast %struct.anon* %6 to i8*
%8 = getelementptr inbounds %struct.anon, %struct.anon* %6, i64 0, i32 0
store i32 %0, i32* %8
%9 = getelementptr inbounds %struct.anon, %struct.anon* %6, i64 0, i32 1
store %struct.fdset* %1, %struct.fdset** %9
%10 = getelementptr inbounds %struct.anon, %struct.anon* %6, i64 0, i32 2
store %struct.fdset* %2, %struct.fdset** %10
%11 = getelementptr inbounds %struct.anon, %struct.anon* %6, i64 0, i32 3
store %struct.fdset* %3, %struct.fdset** %11
%12 = getelementptr inbounds %struct.anon, %struct.anon* %6, i64 0, i32 4
store %struct.timeval* %4, %struct.timeval** %12
%13 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @sys_select to i32 (%struct.anon*, ...)*)(%struct.anon* %6)
ret i32 %13
}