void test_arg_multiarg(int i, double d) {
  do {
    int n = __builtin_snprintf(0, 0, "%12i %s", i, "abc");
    do {
      extern void failure_on_line_139(int);
      extern void success_on_line_139(int);
      if (n == 16)
        success_on_line_139(n);
      else
        failure_on_line_139(n);
    } while (0);
  } while (0);
  do {
    int n = __builtin_snprintf(0, 0, "%*i %s", 12, i, "abc");
    do {
      extern void failure_on_line_140(int);
      extern void success_on_line_140(int);
      if (n == 16)
        success_on_line_140(n);
      else
        failure_on_line_140(n);
    } while (0);
  } while (0);
}


x86 assembly (clang, -O0):
<test_arg_multiarg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%esi
lea    0xe92(%rip),%rdx
lea    0xe93(%rip),%r8
mov    %rsi,%rdi
mov    $0x0,%al
call   1030 <snprintf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jne    1199 <test_arg_multiarg+0x49>
mov    -0x14(%rbp),%edi
call   1070 <success_on_line_139@plt>
jmp    11a1 <test_arg_multiarg+0x51>
mov    -0x14(%rbp),%edi
call   1040 <failure_on_line_139@plt>
jmp    11a6 <test_arg_multiarg+0x56>
jmp    11ab <test_arg_multiarg+0x5b>
jmp    11b0 <test_arg_multiarg+0x60>
mov    -0x4(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%esi
lea    0xe4d(%rip),%rdx
mov    $0xc,%ecx
lea    0xe3d(%rip),%r9
mov    %rsi,%rdi
mov    $0x0,%al
call   1030 <snprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jne    11ef <test_arg_multiarg+0x9f>
mov    -0x18(%rbp),%edi
call   1050 <success_on_line_140@plt>
jmp    11f7 <test_arg_multiarg+0xa7>
mov    -0x18(%rbp),%edi
call   1060 <failure_on_line_140@plt>
jmp    11fc <test_arg_multiarg+0xac>
jmp    1201 <test_arg_multiarg+0xb1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_arg_multiarg>:
push   %rbx
mov    %edi,%ebx
lea    0xea6(%rip),%rdx
lea    0xea7(%rip),%r8
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <snprintf@plt>
cmp    $0x10,%eax
jne    117f <test_arg_multiarg+0x2f>
mov    $0x10,%edi
call   1070 <success_on_line_139@plt>
jmp    1186 <test_arg_multiarg+0x36>
mov    %eax,%edi
call   1040 <failure_on_line_139@plt>
lea    0xe7f(%rip),%rdx
lea    0xe74(%rip),%r9
xor    %edi,%edi
xor    %esi,%esi
mov    $0xc,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1030 <snprintf@plt>
cmp    $0x10,%eax
jne    11b7 <test_arg_multiarg+0x67>
mov    $0x10,%edi
pop    %rbx
jmp    1050 <success_on_line_140@plt>
mov    %eax,%edi
pop    %rbx
jmp    1060 <failure_on_line_140@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%12i %s\00"
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [7 x i8] c"%*i %s\00"
define void @test_arg_multiarg(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store double %1, double* %4
br label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %9, i32* %5
br label %10
10: ; preds = %7
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 16
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32, i32* %5
br label %17
15: ; preds = %10
%16 = load i32, i32* %5
br label %17
17: ; preds = %15, %13
br label %18
18: ; preds = %17
br label %19
19: ; preds = %18
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 12, i32 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %22, i32* %6
br label %23
23: ; preds = %20
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, 16
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32, i32* %6
br label %30
28: ; preds = %23
%29 = load i32, i32* %6
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%12i %s\00"
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [7 x i8] c"%*i %s\00"
define void @test_arg_multiarg(i32 %0, double %1) {
%3 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32 %3, 16
br i1 %4, label %5, label %6
5: ; preds = %2
tail call void @success_on_line_139(i32 16)
br label %7
6: ; preds = %2
tail call void @failure_on_line_139(i32 %3)
br label %7
7: ; preds = %6, %5
%8 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 12, i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 16
br i1 %9, label %10, label %11
10: ; preds = %7
tail call void @success_on_line_140(i32 16)
br label %12
11: ; preds = %7
tail call void @failure_on_line_140(i32 %8)
br label %12
12: ; preds = %11, %10
ret void
}