#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 */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
char *create_buffer(int, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void vstd_warn(int mode, const char *msg, va_list az) {
  int err_type, exit_code;
  exit_code = (mode >> 2);
  err_type = (mode & 0x3);
  ;
  if (err_type) {
    char *buffer;
    buffer = create_buffer(err_type, msg);
    (void)vfprintf(stderr, buffer, az);
    free(buffer);
  } else {
    (void)vfprintf(stderr, msg, az);
  }
  (void)fprintf(stderr, "\n");
  return;
}


x86 assembly (clang, -O0):
<vstd_warn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11a1 <vstd_warn+0x61>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <create_buffer@plt>
mov    %rax,-0x28(%rbp)
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1060 <vfprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    11b6 <vstd_warn+0x76>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1060 <vfprintf@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vstd_warn>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
and    $0x3,%edi
je     116f <vstd_warn+0x2f>
call   1050 <create_buffer@plt>
mov    %rax,%rbx
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <vfprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    117f <vstd_warn+0x3f>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    %ebp,%edx
call   1060 <vfprintf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @vstd_warn(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
%11 = ashr i32 %10, 2
store i32 %11, i32* %8
%12 = load i32, i32* %4
%13 = and i32 %12, 3
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %3
%17 = load i32, i32* %7
%18 = load i8*, i8** %5
%19 = call i8* @create_buffer(i32 %17, i8* %18)
store i8* %19, i8** %9
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %9
%22 = load i32, i32* %6
%23 = call i32 @vfprintf(i32 %20, i8* %21, i32 %22)
%24 = load i8*, i8** %9
%25 = call i32 @free(i8* %24)
br label %31
26: ; preds = %3
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %5
%29 = load i32, i32* %6
%30 = call i32 @vfprintf(i32 %27, i8* %28, i32 %29)
br label %31
31: ; preds = %26, %16
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @vstd_warn(i32 %0, i8* %1, i32 %2) {
%4 = and i32 %0, 3
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i8* @create_buffer(i32 %4, i8* %1)
%8 = load i32, i32* @stderr
%9 = tail call i32 @vfprintf(i32 %8, i8* %7, i32 %2)
%10 = tail call i32 @free(i8* %7)
br label %14
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = tail call i32 @vfprintf(i32 %12, i8* %1, i32 %2)
br label %14
14: ; preds = %11, %6
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}