#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 */
int /*<<< orphan*/ LOG_NOTICE;
char *create_buffer(int, char const *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ vsyslog(int /*<<< orphan*/, char const *,
                           int /*<<< orphan*/);
void vlog_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);
    vsyslog(LOG_NOTICE, buffer, az);
    free(buffer);
  } else {
    vsyslog(LOG_NOTICE, msg, az);
  }
  return;
}


x86 assembly (clang, -O0):
<vlog_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     1191 <vlog_notice+0x61>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <create_buffer@plt>
mov    %rax,-0x28(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <vsyslog@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    11a6 <vlog_notice+0x76>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <vsyslog@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vlog_notice>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
and    $0x3,%edi
je     1163 <vlog_notice+0x33>
call   1040 <create_buffer@plt>
mov    %rax,%rbx
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <vsyslog@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <vsyslog@plt>

LLVM IR (-O0):
@LOG_NOTICE = global i32 0
define void @vlog_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 %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* @LOG_NOTICE
%21 = load i8*, i8** %9
%22 = load i32, i32* %6
%23 = call i32 @vsyslog(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* @LOG_NOTICE
%28 = load i8*, i8** %5
%29 = load i32, i32* %6
%30 = call i32 @vsyslog(i32 %27, i8* %28, i32 %29)
br label %31
31: ; preds = %26, %16
ret void
}

LLVM IR (-O2):
@LOG_NOTICE = global i32 0
define void @vlog_notice(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* @LOG_NOTICE
%9 = tail call i32 @vsyslog(i32 %8, i8* %7, i32 %2)
%10 = tail call i32 @free(i8* %7)
br label %14
11: ; preds = %3
%12 = load i32, i32* @LOG_NOTICE
%13 = tail call i32 @vsyslog(i32 %12, i8* %1, i32 %2)
br label %14
14: ; preds = %11, %6
ret void
}