#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 */

/* Variables and functions */
int /*<<< orphan*/ assertStringsEqual(char *, char *);
int /*<<< orphan*/ vsnprintf_builder_1(char *, int);
int /*<<< orphan*/ vsnprintf_builder_3(char *, int, int, char *);
void test_vsnprintf() {
  char buffer[100];
  vsnprintf_builder_1(buffer, -1);
  assertStringsEqual(buffer, "-1");
  vsnprintf_builder_3(buffer, 3, -1000, "test");
  assertStringsEqual(buffer, "3 -1000 test");
}


x86 assembly (clang, -O0):
<test_vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
mov    $0xffffffff,%esi
call   1050 <vsnprintf_builder_1@plt>
lea    -0x70(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
mov    $0x3,%esi
mov    $0xfffffc18,%edx
lea    0xea0(%rip),%rcx
call   1040 <vsnprintf_builder_3@plt>
lea    -0x70(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_vsnprintf>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   1050 <vsnprintf_builder_1@plt>
lea    0xeb4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xeb0(%rip),%rcx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0xfffffc18,%edx
call   1040 <vsnprintf_builder_3@plt>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-1\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [13 x i8] c"3 -1000 test\00"
define void @test_vsnprintf() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @vsnprintf_builder_1(i8* %2, i32 -1)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @assertStringsEqual(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = call i32 @vsnprintf_builder_3(i8* %6, i32 3, i32 -1000, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%9 = call i32 @assertStringsEqual(i8* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"-1\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [13 x i8] c"3 -1000 test\00"
define void @test_vsnprintf() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @vsnprintf_builder_1(i8* %2, i32 -1)
%4 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @vsnprintf_builder_3(i8* %2, i32 3, i32 -1000, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret void
}