#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printparse(int, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void _error(int type, char *prefix, char *format, va_list args) {
  if (type >= 0) {
    printparse(type, "error");
  }
  if (prefix) {
    fprintf(stderr, "%s: ", prefix);
  }
  vfprintf(stderr, format, args);
}


x86 assembly (clang, -O0):
<_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     115f <_error+0x2f>
mov    -0x4(%rbp),%edi
lea    0xea6(%rip),%rsi
call   1050 <printparse@plt>
cmpq   $0x0,-0x10(%rbp)
je     1183 <_error+0x53>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <vfprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_error>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%rbp
test   %edi,%edi
js     114d <_error+0x1d>
lea    0xeb8(%rip),%rsi
call   1050 <printparse@plt>
test   %rbp,%rbp
je     116a <_error+0x3a>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
mov    %rbp,%rdx
call   1030 <fprintf@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <vfprintf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"error\00"
@stderr = global i32 0
@.str.1 = [5 x i8] c"%s: \00"
define void @_error(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* %5
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i32, i32* %5
%13 = call i32 @printparse(i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %11, %4
%15 = load i8*, i8** %6
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %6
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %17, %14
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %7
%24 = load i32, i32* %8
%25 = call i32 @vfprintf(i32 %22, i8* %23, i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"error\00"
@stderr = global i32 0
@.str.1 = [5 x i8] c"%s: \00"
define void @_error(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = icmp sgt i32 %0, -1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @printparse(i32 %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = icmp eq i8* %1, null
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* @stderr
%15 = tail call i32 @vfprintf(i32 %14, i8* %2, i32 %3)
ret void
}