#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ printBacktrace(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void msgxit__(int no, char *annot, char *fmt, va_list args) {
  fprintf(stderr, "[%s] ", annot);
  vfprintf(stderr, fmt, args);
  fputc('\n', stderr);
  printBacktrace(stderr);
  fprintf(stderr, "Sorry, bye: exit(%i)\n", no);
  exit(no);
}


x86 assembly (clang, -O0):
<msgxit__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1060 <vfprintf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1040 <printBacktrace@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe3c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<msgxit__>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rsi,%rdx
mov    %edi,%r15d
mov    0x2e76(%rip),%rbx
mov    (%rbx),%edi
lea    0xe8d(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%rbx),%edi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1060 <vfprintf@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    (%rbx),%edi
call   1040 <printBacktrace@plt>
mov    (%rbx),%edi
lea    0xe63(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r15d,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"[%s] \00"
@.str.1 = [22 x i8] c"Sorry, bye: exit(%i)\0A\00"
define void @msgxit__(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %6
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = call i32 @vfprintf(i32 %12, i8* %13, i32 %14)
%16 = load i32, i32* @stderr
%17 = call i32 @fputc(i8 signext 10, i32 %16)
%18 = load i32, i32* @stderr
%19 = call i32 @printBacktrace(i32 %18)
%20 = load i32, i32* @stderr
%21 = load i32, i32* %5
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %5
%24 = call i32 @exit(i32 %23)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"[%s] \00"
@.str.1 = [22 x i8] c"Sorry, bye: exit(%i)\0A\00"
define void @msgxit__(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = load i32, i32* @stderr
%8 = tail call i32 @vfprintf(i32 %7, i8* %2, i32 %3)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fputc(i8 signext 10, i32 %9)
%11 = load i32, i32* @stderr
%12 = tail call i32 @printBacktrace(i32 %11)
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%15 = tail call i32 @exit(i32 %0)
unreachable
}