void foo(__builtin_va_list authors, ...) {
  __builtin_va_start(authors, authors);
  (void)__builtin_va_arg(authors, int);
  __builtin_va_end(authors);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
test   %al,%al
je     1133 <foo+0x33>
movaps %xmm0,-0x90(%rbp)
movaps %xmm1,-0x80(%rbp)
movaps %xmm2,-0x70(%rbp)
movaps %xmm3,-0x60(%rbp)
movaps %xmm4,-0x50(%rbp)
movaps %xmm5,-0x40(%rbp)
movaps %xmm6,-0x30(%rbp)
movaps %xmm7,-0x20(%rbp)
mov    %r9,-0x98(%rbp)
mov    %r8,-0xa0(%rbp)
mov    %rcx,-0xa8(%rbp)
mov    %rdx,-0xb0(%rbp)
mov    %rsi,-0xb8(%rbp)
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lea    -0xc0(%rbp),%rcx
mov    %rcx,0x10(%rax)
lea    0x10(%rbp),%rcx
mov    %rcx,0x8(%rax)
movl   $0x30,0x4(%rax)
movl   $0x8,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
cmp    $0x28,%eax
ja     11bf <foo+0xbf>
mov    -0xd0(%rbp),%rcx
mov    -0xc4(%rbp),%edx
movslq %edx,%rax
add    0x10(%rcx),%rax
add    $0x8,%edx
mov    %edx,(%rcx)
mov    %rax,-0xd8(%rbp)
jmp    11dc <foo+0xdc>
mov    -0xd0(%rbp),%rcx
mov    0x8(%rcx),%rdx
mov    %rdx,%rax
add    $0x8,%rdx
mov    %rdx,0x8(%rcx)
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    $0x38,%rsp
mov    %rsi,-0x78(%rsp)
mov    %rdx,-0x70(%rsp)
mov    %rcx,-0x68(%rsp)
mov    %r8,-0x60(%rsp)
mov    %r9,-0x58(%rsp)
test   %al,%al
je     1148 <foo+0x48>
movaps %xmm0,-0x50(%rsp)
movaps %xmm1,-0x40(%rsp)
movaps %xmm2,-0x30(%rsp)
movaps %xmm3,-0x20(%rsp)
movaps %xmm4,-0x10(%rsp)
movaps %xmm5,(%rsp)
movaps %xmm6,0x10(%rsp)
movaps %xmm7,0x20(%rsp)
movabs $0x3000000008,%rax
mov    %rax,(%rdi)
lea    0x40(%rsp),%rax
mov    %rax,0x8(%rdi)
lea    -0x80(%rsp),%rax
mov    %rax,0x10(%rdi)
mov    $0x8,%eax
cmp    $0x28,%eax
ja     117b <foo+0x7b>
add    $0x8,%eax
mov    %eax,(%rdi)
add    $0x38,%rsp
ret
addq   $0x8,0x8(%rdi)
add    $0x38,%rsp
ret

LLVM IR (-O0):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define void @foo(%struct.__va_list_tag* %0, ...) {
%2 = alloca %struct.__va_list_tag*
store %struct.__va_list_tag* %0, %struct.__va_list_tag** %2
%3 = load %struct.__va_list_tag*, %struct.__va_list_tag** %2
%4 = bitcast %struct.__va_list_tag* %3 to i8*
%5 = load %struct.__va_list_tag*, %struct.__va_list_tag** %2
%6 = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = icmp ule i32 %7, 40
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %5, i32 0, i32 3
%11 = load i8*, i8** %10
%12 = getelementptr i8, i8* %11, i32 %7
%13 = bitcast i8* %12 to i32*
%14 = add i32 %7, 8
store i32 %14, i32* %6
br label %20
15: ; preds = %1
%16 = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %5, i32 0, i32 2
%17 = load i8*, i8** %16
%18 = bitcast i8* %17 to i32*
%19 = getelementptr i8, i8* %17, i32 8
store i8* %19, i8** %16
br label %20
20: ; preds = %15, %9
%21 = phi i32* [ %13, %9 ], [ %18, %15 ]
%22 = load i32, i32* %21
%23 = load %struct.__va_list_tag*, %struct.__va_list_tag** %2
%24 = bitcast %struct.__va_list_tag* %23 to i8*
ret void
}

LLVM IR (-O2):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define void @foo(%struct.__va_list_tag* %0, ...) {
%2 = bitcast %struct.__va_list_tag* %0 to i8*
tail call void @llvm.va_start(i8* %2)
%3 = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 41
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = add nuw nsw i32 %4, 8
store i32 %7, i32* %3
br label %12
8: ; preds = %1
%9 = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %0, i64 0, i32 2
%10 = load i8*, i8** %9
%11 = getelementptr i8, i8* %10, i64 8
store i8* %11, i8** %9
br label %12
12: ; preds = %8, %6
tail call void @llvm.va_end(i8* %2)
ret void
}