int f_va_1(char *fmt, ...) {
  __builtin_va_list va;
  __builtin_va_start(va, fmt);
  int v = __builtin_va_arg(va, int);
  __builtin_va_end(va);
  return v;
}


x86 assembly (clang, -O0):
<f_va_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
test   %al,%al
je     113c <f_va_1+0x3c>
movaps %xmm0,-0xb0(%rbp)
movaps %xmm1,-0xa0(%rbp)
movaps %xmm2,-0x90(%rbp)
movaps %xmm3,-0x80(%rbp)
movaps %xmm4,-0x70(%rbp)
movaps %xmm5,-0x60(%rbp)
movaps %xmm6,-0x50(%rbp)
movaps %xmm7,-0x40(%rbp)
mov    %r9,-0xb8(%rbp)
mov    %r8,-0xc0(%rbp)
mov    %rcx,-0xc8(%rbp)
mov    %rdx,-0xd0(%rbp)
mov    %rsi,-0xd8(%rbp)
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rax
lea    -0xe0(%rbp),%rcx
mov    %rcx,0x10(%rax)
lea    0x10(%rbp),%rcx
mov    %rcx,0x8(%rax)
movl   $0x30,0x4(%rax)
movl   $0x8,(%rax)
lea    -0x20(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0xe4(%rbp)
cmp    $0x28,%eax
ja     11c9 <f_va_1+0xc9>
mov    -0xf0(%rbp),%rcx
mov    -0xe4(%rbp),%edx
movslq %edx,%rax
add    0x10(%rcx),%rax
add    $0x8,%edx
mov    %edx,(%rcx)
mov    %rax,-0xf8(%rbp)
jmp    11e6 <f_va_1+0xe6>
mov    -0xf0(%rbp),%rcx
mov    0x8(%rcx),%rdx
mov    %rdx,%rax
add    $0x8,%rdx
mov    %rdx,0x8(%rcx)
mov    %rax,-0xf8(%rbp)
mov    -0xf8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define i32 @f_va_1(i8* nocapture readnone %0, ...) {
%2 = alloca [1 x %struct.__va_list_tag]
%3 = bitcast [1 x %struct.__va_list_tag]* %2 to i8*
%4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = icmp ult i32 %5, 41
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 3
%9 = load i8*, i8** %8
%10 = zext i32 %5 to i64
%11 = getelementptr i8, i8* %9, i64 %10
%12 = add nuw nsw i32 %5, 8
store i32 %12, i32* %4
br label %17
13: ; preds = %1
%14 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 2
%15 = load i8*, i8** %14
%16 = getelementptr i8, i8* %15, i64 8
store i8* %16, i8** %14
br label %17
17: ; preds = %13, %7
%18 = phi i8* [ %11, %7 ], [ %15, %13 ]
%19 = bitcast i8* %18 to i32*
%20 = load i32, i32* %19
ret i32 %20
}