#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 */

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ termcolors();
__attribute((noreturn)) void as6502_fatal(const char *reason) {
  if (termcolors()) {
    fprintf(stderr,
            "\x1b[1;37m"
            "as6502: "
            "\x1b[1;31m"
            "fatal:"
            "\x1b[1;37m"
            " %s\n"
            "\x1b[0m",
            reason);
  } else {
    fprintf(stderr, "as6502: fatal: %s\n", reason);
  }
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<as6502_fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <termcolors@plt>
cmp    $0x0,%rax
je     116b <as6502_fatal+0x3b>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe9f(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1184 <as6502_fatal+0x54>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xead(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<as6502_fatal>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <termcolors@plt>
test   %rax,%rax
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rax
lea    0xeab(%rip),%rsi
cmove  %rax,%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"\1B[1;37mas6502: \1B[1;31mfatal:\1B[1;37m %s\0A\1B[0m\00"
@.str.1 = [19 x i8] c"as6502: fatal: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @as6502_fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @termcolors()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %13
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %2
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %9, %5
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"\1B[1;37mas6502: \1B[1;31mfatal:\1B[1;37m %s\0A\1B[0m\00"
@.str.1 = [19 x i8] c"as6502: fatal: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @as6502_fatal(i8* %0) {
%2 = tail call i64 (...) @termcolors()
%3 = icmp eq i64 %2, 0
%4 = load i32, i32* @stderr
%5 = select i1 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32 @fprintf(i32 %4, i8* %5, i8* %0)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
}