#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 */
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void __vwarning(const char *fmt, va_list ap) {
  if (errno) {
    perror("trace-cmd");
  }
  errno = 0;
  fprintf(stderr, "  ");
  vfprintf(stderr, fmt, ap);
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<__vwarning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e92(%rip),%rax
cmpq   $0x0,(%rax)
je     115c <__vwarning+0x2c>
lea    0xea9(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e75(%rip),%rax
movq   $0x0,(%rax)
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__vwarning>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
mov    0x2e97(%rip),%rbp
cmpq   $0x0,0x0(%rbp)
jne    1187 <__vwarning+0x57>
movq   $0x0,0x0(%rbp)
mov    0x2e89(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xea9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <vfprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe8f(%rip),%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xe72(%rip),%rdi
call   1040 <perror@plt>
jmp    1148 <__vwarning+0x18>

LLVM IR (-O0):
@errno = global i64 0
@.str = [10 x i8] c"trace-cmd\00"
@stderr = global i32 0
@.str.1 = [3 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @__vwarning(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i64, i64* @errno
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
store i64 0, i64* @errno
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = call i32 @vfprintf(i32 %12, i8* %13, i32 %14)
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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