#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*/ error_second_vsnp(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ simple_va_fun(int, ...);
int /*<<< orphan*/ var_vsnprintf(char *, int, char *);
int main(int argc, char **argv) {
  simple_va_fun(100);
  printf("==============================\n");
  simple_va_fun(100, 200);
  printf("==============================\n");
  simple_va_fun(100, 200, 300);
  error_second_vsnp("test:=3, =XXXXX\n");
  var_vsnprintf("test:%%d=%d, %%s=%s+++\n", 3, "vsnprintf");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x64,%edi
mov    $0x0,%al
call   1050 <simple_va_fun@plt>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0xc8,%esi
mov    $0x0,%al
call   1050 <simple_va_fun@plt>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0xc8,%esi
mov    $0x12c,%edx
mov    $0x0,%al
call   1050 <simple_va_fun@plt>
lea    0xe78(%rip),%rdi
call   1060 <error_second_vsnp@plt>
lea    0xe7d(%rip),%rdi
mov    $0x3,%esi
lea    0xe89(%rip),%rdx
call   1040 <var_vsnprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
xor    %eax,%eax
call   1050 <simple_va_fun@plt>
lea    0xedf(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x64,%edi
mov    $0xc8,%esi
xor    %eax,%eax
call   1050 <simple_va_fun@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x64,%edi
mov    $0xc8,%esi
mov    $0x12c,%edx
xor    %eax,%eax
call   1050 <simple_va_fun@plt>
lea    0xe6e(%rip),%rdi
call   1060 <error_second_vsnp@plt>
lea    0xe73(%rip),%rdi
lea    0xe84(%rip),%rdx
mov    $0x3,%esi
call   1040 <var_vsnprintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"==============================\0A\00"
@.str.1 = [17 x i8] c"test:=3, =XXXXX\0A\00"
@.str.2 = [24 x i8] c"test:%%d=%d, %%s=%s+++\0A\00"
@.str.3 = [10 x i8] c"vsnprintf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i32, ...) @simple_va_fun(i32 100)
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i32, ...) @simple_va_fun(i32 100, i32 200)
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i32, ...) @simple_va_fun(i32 100, i32 200, i32 300)
%11 = call i32 @error_second_vsnp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @var_vsnprintf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"test:=3, =XXXXX\0A\00"
@.str.2 = [24 x i8] c"test:%%d=%d, %%s=%s+++\0A\00"
@.str.3 = [10 x i8] c"vsnprintf\00"
@str.4 = [31 x i8] c"==============================\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i32, ...) @simple_va_fun(i32 100)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 (i32, ...) @simple_va_fun(i32 100, i32 200)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.4, i64 0, i64 0))
%7 = tail call i32 (i32, ...) @simple_va_fun(i32 100, i32 200, i32 300)
%8 = tail call i32 @error_second_vsnp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @var_vsnprintf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}