#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int pc_error(int number, char *message, char *filename, int firstline,
             int lastline, va_list argptr) {
  static char *prefix[3] = {"error", "fatal error", "warning"};
  if (number != 0) {
    char *pre;
    pre = prefix[number / 100];
    if (firstline >= 0)
      fprintf(stderr, "%s(%d -- %d) : %s %03d: ", filename, firstline, lastline,
              pre, number);
    else
      fprintf(stderr, "%s(%d) : %s %03d: ", filename, lastline, pre, number);
  }
  vfprintf(stderr, message, argptr);
  fflush(stderr);
  return 0;
}


x86 assembly (clang, -O0):
<pc_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11db <pc_error+0xab>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    0x2ed3(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     11b0 <pc_error+0x80>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x30(%rbp),%r9
mov    -0x4(%rbp),%eax
lea    0xe73(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11d6 <pc_error+0xa6>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x4(%rbp),%r9d
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11db <pc_error+0xab>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pc_error>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %r9d,%r14d
mov    %rsi,%rbx
test   %edi,%edi
je     11a0 <pc_error+0x70>
mov    %edi,%eax
movslq %edi,%rsi
imul   $0x51eb851f,%rsi,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x25,%rsi
add    %edi,%esi
movslq %esi,%rsi
lea    0x2c9b(%rip),%rdi
mov    (%rdi,%rsi,8),%r9
mov    0x2e70(%rip),%rsi
mov    (%rsi),%edi
test   %ecx,%ecx
js     1189 <pc_error+0x59>
mov    %eax,(%rsp)
lea    0xe94(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11a0 <pc_error+0x70>
lea    0xe9d(%rip),%rsi
mov    %r8d,%ecx
mov    %r9,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e39(%rip),%rbp
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <vfprintf@plt>
mov    0x0(%rbp),%edi
call   1040 <fflush@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@pc_error.prefix = internal global [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0)]
@.str = [6 x i8] c"error\00"
@.str.1 = [12 x i8] c"fatal error\00"
@.str.2 = [8 x i8] c"warning\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"%s(%d -- %d) : %s %03d: \00"
@.str.4 = [19 x i8] c"%s(%d) : %s %03d: \00"
define i32 @pc_error(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %7
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %40
16: ; preds = %6
%17 = load i32, i32* %7
%18 = sdiv i32 %17, 100
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [3 x i8*], [3 x i8*]* @pc_error.prefix, i64 0, i64 %19
%21 = load i8*, i8** %20
store i8* %21, i8** %13
%22 = load i32, i32* %10
%23 = icmp sge i32 %22, 0
br i1 %23, label %24, label %32
24: ; preds = %16
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %9
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = load i8*, i8** %13
%30 = load i32, i32* %7
%31 = call i32 (i32, i8*, i8*, i32, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %26, i32 %27, i32 %28, i8* %29, i32 %30)
br label %39
32: ; preds = %16
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %9
%35 = load i32, i32* %11
%36 = load i8*, i8** %13
%37 = load i32, i32* %7
%38 = call i32 (i32, i8*, i8*, i32, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %34, i32 %35, i8* %36, i32 %37)
br label %39
39: ; preds = %32, %24
br label %40
40: ; preds = %39, %6
%41 = load i32, i32* @stderr
%42 = load i8*, i8** %8
%43 = load i32, i32* %12
%44 = call i32 @vfprintf(i32 %41, i8* %42, i32 %43)
%45 = load i32, i32* @stderr
%46 = call i32 @fflush(i32 %45)
ret i32 0
}

LLVM IR (-O2):
@pc_error.prefix = internal unnamed_addr constant [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0)]
@.str = [6 x i8] c"error\00"
@.str.1 = [12 x i8] c"fatal error\00"
@.str.2 = [8 x i8] c"warning\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"%s(%d -- %d) : %s %03d: \00"
@.str.4 = [19 x i8] c"%s(%d) : %s %03d: \00"
define i32 @pc_error(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp eq i32 %0, 0
br i1 %7, label %19, label %8
8: ; preds = %6
%9 = sdiv i32 %0, 100
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [3 x i8*], [3 x i8*]* @pc_error.prefix, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = icmp sgt i32 %3, -1
%14 = load i32, i32* @stderr
br i1 %13, label %15, label %17
15: ; preds = %8
%16 = tail call i32 (i32, i8*, i8*, i32, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %2, i32 %3, i32 %4, i8* %12, i32 %0)
br label %19
17: ; preds = %8
%18 = tail call i32 (i32, i8*, i8*, i32, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %2, i32 %4, i8* %12, i32 %0)
br label %19
19: ; preds = %15, %17, %6
%20 = load i32, i32* @stderr
%21 = tail call i32 @vfprintf(i32 %20, i8* %1, i32 %5)
%22 = load i32, i32* @stderr
%23 = tail call i32 @fflush(i32 %22)
ret i32 0
}