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


x86 assembly (clang, -O0):
<__vdie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e76(%rip),%rax
cmpl   $0x0,(%rax)
je     117c <__vdie+0x3c>
lea    0xe8e(%rip),%rdi
call   1040 <perror@plt>
jmp    1183 <__vdie+0x43>
movl   $0xffffffff,-0x10(%rbp)
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<__vdie>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
mov    0x2e84(%rip),%rax
mov    (%rax),%ebx
test   %ebx,%ebx
je     11a0 <__vdie+0x60>
lea    0xe9f(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e73(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe93(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    %r15,%rsi
mov    %r14d,%edx
call   1050 <vfprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe79(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1060 <exit@plt>
mov    $0xffffffff,%ebx
jmp    1166 <__vdie+0x26>

LLVM IR (-O0):
@errno = global i32 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 @__vdie(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* @errno
store i32 %6, i32* %5
%7 = load i32, i32* @errno
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %12
11: ; preds = %2
store i32 -1, i32* %5
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = call i32 @vfprintf(i32 %15, i8* %16, i32 %17)
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %5
%22 = call i32 @exit(i32 %21)
unreachable
}

LLVM IR (-O2):
@errno = global i32 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 @__vdie(i8* %0, i32 %1) {
%3 = load i32, i32* @errno
%4 = icmp eq i32 %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 = %2, %5
%8 = phi i32 [ %3, %5 ], [ -1, %2 ]
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 @vfprintf(i32 %11, i8* %0, i32 %1)
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @exit(i32 %8)
unreachable
}