#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(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void fatal(char *m, int line, int file) {
  fprintf(stderr, "*** Fatal: ");
  fprintf(stderr, "%s", m);
  switch (file) {
  case 0:
    fprintf(stderr, "           [Line %d in Primary message file]\n", line);
    break;
  case 1:
    fprintf(stderr, "           [Line %d in Default message file]\n", line);
    break;
  case 2:
    fprintf(stderr, "           [Line %d in Template file]\n", line);
  }
  exit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ea7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
xor    %eax,%eax
mov    %al,-0x15(%rbp)
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%rcx
mov    -0x15(%rbp),%al
mov    (%rcx),%edi
mov    -0x8(%rbp),%rdx
lea    0xea8(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     119e <fatal+0x7e>
jmp    117c <fatal+0x5c>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     11bd <fatal+0x9d>
jmp    118d <fatal+0x6d>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11dc <fatal+0xbc>
jmp    11f6 <fatal+0xd6>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f6 <fatal+0xd6>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f6 <fatal+0xd6>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%rbx
mov    0x2eaa(%rip),%r15
mov    (%r15),%edi
lea    0xec0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
lea    0xebb(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x2,%ebp
ja     117e <fatal+0x5e>
movslq %ebp,%rax
lea    0xf2a(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    (%r15),%edi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"*** Fatal: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [46 x i8] c" [Line %d in Primary message file]\0A\00"
@.str.3 = [46 x i8] c" [Line %d in Default message file]\0A\00"
@.str.4 = [39 x i8] c" [Line %d in Template file]\0A\00"
define void @fatal(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %4
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = load i32, i32* %6
switch i32 %12, label %25 [
i32 0, label %13
i32 1, label %17
i32 2, label %21
]
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i32, i32* %5
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %25
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = load i32, i32* %5
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %25
21: ; preds = %3
%22 = load i32, i32* @stderr
%23 = load i32, i32* %5
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21, %3, %17, %13
%26 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"*** Fatal: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [46 x i8] c" [Line %d in Primary message file]\0A\00"
@.str.3 = [46 x i8] c" [Line %d in Default message file]\0A\00"
@.str.4 = [39 x i8] c" [Line %d in Template file]\0A\00"
@reltable.fatal = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([46 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.fatal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([46 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.fatal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.fatal to i64)) to i32)]
define void @fatal(i8* %0, i32 %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%8 = icmp ult i32 %2, 3
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = sext i32 %2 to i64
%11 = shl i64 %10, 2
%12 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.fatal to i8*), i64 %11)
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* %12, i32 %1)
br label %15
15: ; preds = %3, %9
%16 = tail call i32 @exit(i32 1)
unreachable
}