#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void print_error(int error, char *message, int iswarning) {
  if (iswarning)
    fprintf(stderr,
            "\x1B[33m"
            "WARNING %d"
            "\033[0m",
            error);
  else
    fprintf(stderr,
            "\x1B[31m"
            "ERROR %d"
            "\033[0m",
            error);
  fprintf(stdout, ": %s\n", message);
  return;
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     114b <print_error+0x3b>
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1165 <print_error+0x55>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%eax
test   %edx,%edx
mov    0x2ec1(%rip),%rcx
mov    (%rcx),%edi
lea    0xeec(%rip),%rcx
lea    0xed1(%rip),%rsi
cmove  %rcx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeda(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"\1B[33mWARNING %d\1B[0m\00"
@.str.1 = [18 x i8] c"\1B[31mERROR %d\1B[0m\00"
@stdout = global i32 0
@.str.2 = [6 x i8] c": %s\0A\00"
define void @print_error(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = load i32, i32* %4
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %17
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i32, i32* %4
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* @stdout
%19 = load i8*, i8** %5
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %19)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"\1B[33mWARNING %d\1B[0m\00"
@.str.1 = [18 x i8] c"\1B[31mERROR %d\1B[0m\00"
@stdout = global i32 0
@.str.2 = [6 x i8] c": %s\0A\00"
define void @print_error(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = load i32, i32* @stderr
%6 = select i1 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* %6, i32 %0)
%8 = load i32, i32* @stdout
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %1)
ret void
}