#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*/ free(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vprintf(char const *, int /*<<< orphan*/);
void vstd_notice(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)vprintf(buffer, az);
    free(buffer);
  } else {
    (void)vprintf(msg, az);
  }
  (void)printf("\n");
  return;
}


x86 assembly (clang, -O0):
<vstd_notice>:
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     1198 <vstd_notice+0x58>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <create_buffer@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <vprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    11a4 <vstd_notice+0x64>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <vprintf@plt>
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vstd_notice>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
and    $0x3,%edi
je     1166 <vstd_notice+0x26>
call   1050 <create_buffer@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1060 <vprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    1170 <vstd_notice+0x30>
mov    %rsi,%rdi
mov    %ebp,%esi
call   1060 <vprintf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @vstd_notice(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 %25
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 i8*, i8** %9
%21 = load i32, i32* %6
%22 = call i32 @vprintf(i8* %20, i32 %21)
%23 = load i8*, i8** %9
%24 = call i32 @free(i8* %23)
br label %29
25: ; preds = %3
%26 = load i8*, i8** %5
%27 = load i32, i32* %6
%28 = call i32 @vprintf(i8* %26, i32 %27)
br label %29
29: ; preds = %25, %16
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @vstd_notice(i32 %0, i8* %1, i32 %2) {
%4 = and i32 %0, 3
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i8* @create_buffer(i32 %4, i8* %1)
%8 = tail call i32 @vprintf(i8* %7, i32 %2)
%9 = tail call i32 @free(i8* %7)
br label %12
10: ; preds = %3
%11 = tail call i32 @vprintf(i8* %1, i32 %2)
br label %12
12: ; preds = %10, %6
%13 = tail call i32 @putchar(i32 10)
ret void
}