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

/* Variables and functions */
int /*<<< orphan*/ Com_Error(int, char *, ...);
void PF_error(const char *msg) {
  int i;
  char copy[3072];
  if (!msg) {
    Com_Error(1, "Game Error: unknown error");
    return;
  }
  for (i = 0; i < sizeof(copy) - 1 && msg[i]; i++)
    copy[i] = msg[i] & 127;
  copy[i] = 0;
  Com_Error(1, "Game Error: %s", copy);
}


x86 assembly (clang, -O0):
<PF_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1142 <PF_error+0x32>
mov    $0x1,%edi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <Com_Error@plt>
jmp    11dd <PF_error+0xcd>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
xor    %eax,%eax
cmp    $0xbff,%rcx
mov    %al,-0xc11(%rbp)
jae    117a <PF_error+0x6a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xc11(%rbp)
mov    -0xc11(%rbp),%al
test   $0x1,%al
jne    118d <PF_error+0x7d>
jmp    11b7 <PF_error+0xa7>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
and    $0x7f,%eax
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0xc10(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <PF_error+0x39>
movslq -0xc(%rbp),%rax
movb   $0x0,-0xc10(%rbp,%rax,1)
lea    -0xc10(%rbp),%rdx
mov    $0x1,%edi
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1030 <Com_Error@plt>
add    $0xc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PF_error>:
sub    $0xc08,%rsp
test   %rdi,%rdi
je     115c <PF_error+0x4c>
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%rdi,%rax,1),%ecx
test   %cl,%cl
je     1176 <PF_error+0x66>
and    $0x7f,%cl
mov    %cl,-0x1(%rsp,%rax,1)
cmp    $0xbff,%rax
je     117c <PF_error+0x6c>
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     1181 <PF_error+0x71>
and    $0x7f,%cl
mov    %cl,(%rsp,%rax,1)
add    $0x2,%rax
jmp    1130 <PF_error+0x20>
lea    0xe9d(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
add    $0xc08,%rsp
jmp    1030 <Com_Error@plt>
add    $0xffffffffffffffff,%rax
jmp    1181 <PF_error+0x71>
mov    $0xbff,%eax
mov    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xe8c(%rip),%rsi
mov    %rsp,%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <Com_Error@plt>
add    $0xc08,%rsp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Game Error: unknown error\00"
@.str.1 = [15 x i8] c"Game Error: %s\00"
define void @PF_error(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [3072 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 (i32, i8*, ...) @Com_Error(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %45
9: ; preds = %1
store i32 0, i32* %3
br label %10
10: ; preds = %36, %9
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = icmp ult i64 %12, 3071
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br label %22
22: ; preds = %14, %10
%23 = phi i1 [ false, %10 ], [ %21, %14 ]
br i1 %23, label %24, label %39
24: ; preds = %22
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = and i32 %30, 127
%32 = trunc i32 %31 to i8
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [3072 x i8], [3072 x i8]* %4, i64 0, i64 %34
store i8 %32, i8* %35
br label %36
36: ; preds = %24
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %10
39: ; preds = %22
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [3072 x i8], [3072 x i8]* %4, i64 0, i64 %41
store i8 0, i8* %42
%43 = getelementptr inbounds [3072 x i8], [3072 x i8]* %4, i64 0, i64 0
%44 = call i32 (i32, i8*, ...) @Com_Error(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %39, %7
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Game Error: unknown error\00"
@.str.1 = [15 x i8] c"Game Error: %s\00"
define void @PF_error(i8* %0) {
%2 = alloca [3072 x i8]
%3 = getelementptr inbounds [3072 x i8], [3072 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i32, i8*, ...) @Com_Error(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %30
7: ; preds = %1, %21
%8 = phi i64 [ %24, %21 ], [ 0, %1 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %25, label %12
12: ; preds = %7
%13 = and i8 %10, 127
%14 = getelementptr inbounds [3072 x i8], [3072 x i8]* %2, i64 0, i64 %8
store i8 %13, i8* %14
%15 = or i64 %8, 1
%16 = icmp eq i64 %15, 3071
br i1 %16, label %25, label %17
17: ; preds = %12
%18 = getelementptr inbounds i8, i8* %0, i64 %15
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = and i8 %19, 127
%23 = getelementptr inbounds [3072 x i8], [3072 x i8]* %2, i64 0, i64 %15
store i8 %22, i8* %23
%24 = add nuw nsw i64 %8, 2
br label %7
25: ; preds = %17, %12, %7
%26 = phi i64 [ 3071, %12 ], [ %8, %7 ], [ %15, %17 ]
%27 = and i64 %26, 4294967295
%28 = getelementptr inbounds [3072 x i8], [3072 x i8]* %2, i64 0, i64 %27
store i8 0, i8* %28
%29 = call i32 (i32, i8*, ...) @Com_Error(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %30
30: ; preds = %25, %5
ret void
}