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

/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror_r(scalar_t__, char *, int);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void warnvf(const char *fmt, va_list args) {
  char errbuf[256];
  if (errno != 0) {
    strerror_r(errno, errbuf, sizeof(errbuf));
  } else {
    errbuf[0] = '\0';
  }
  fprintf(stderr, "[openssl-privsep] ");
  vfprintf(stderr, fmt, args);
  if (errbuf[0] != '\0')
    fputs(errbuf, stderr);
  fputc('\n', stderr);
}


x86 assembly (clang, -O0):
<warnvf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e6f(%rip),%rax
cmpq   $0x0,(%rax)
je     1193 <warnvf+0x43>
mov    0x2e5e(%rip),%rax
mov    (%rax),%rdi
lea    -0x110(%rbp),%rsi
mov    $0x100,%edx
call   1060 <strerror_r@plt>
jmp    119a <warnvf+0x4a>
movb   $0x0,-0x110(%rbp)
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
lea    0xe56(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1070 <vfprintf@plt>
movsbl -0x110(%rbp),%eax
cmp    $0x0,%eax
je     11e9 <warnvf+0x99>
lea    -0x110(%rbp),%rdi
mov    0x2dfe(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warnvf>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
mov    0x2e70(%rip),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     117f <warnvf+0x2f>
mov    %rsp,%rsi
mov    $0x100,%edx
call   1060 <strerror_r@plt>
jmp    1183 <warnvf+0x33>
movb   $0x0,(%rsp)
mov    0x2e56(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe6c(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1070 <vfprintf@plt>
cmpb   $0x0,(%rsp)
je     11b8 <warnvf+0x68>
mov    0x0(%rbp),%esi
mov    %rsp,%rdi
call   1030 <fputs@plt>
mov    0x0(%rbp),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i64 0
@stderr = global i32 0
@.str = [19 x i8] c"[openssl-privsep] \00"
define void @warnvf(i8* %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i64, i64* @errno
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @strerror_r(i64 %5, i8* %4, i32 256)
br label %10
9: ; preds = %2
store i8 0, i8* %4
br label %10
10: ; preds = %9, %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = call i32 @vfprintf(i32 %13, i8* %0, i32 %1)
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %10
%18 = load i32, i32* @stderr
%19 = call i32 @fputs(i8* %4, i32 %18)
br label %20
20: ; preds = %17, %10
%21 = load i32, i32* @stderr
%22 = call i32 @fputc(i8 signext 10, i32 %21)
ret void
}