#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void print_error(char *type) {
  if (strcmp(type, "alloc") == 0) {
    fprintf(stderr, "%sERROR:%s Can't allocate memory.\n", "\x1b[31m",
            "\x1b[0m");
  } else if (strcmp(type, "rules") == 0) {
    fprintf(stderr, "%sERROR:%s Incorrect rules file.\n", "\x1b[31m",
            "\x1b[0m");
  } else if (strcmp(type, "net") == 0) {
    fprintf(stderr, "%sERROR:%s Incorrect net file.\n", "\x1b[31m", "\x1b[0m");
  } else {
    fprintf(stderr, "%sERROR%s\n", "\x1b[31m", "\x1b[0m");
  }
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    117e <print_error+0x4e>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xebb(%rip),%rcx
call   1040 <fprintf@plt>
jmp    122f <print_error+0xff>
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11c0 <print_error+0x90>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
lea    0xe7a(%rip),%rdx
lea    0xe79(%rip),%rcx
call   1040 <fprintf@plt>
jmp    122a <print_error+0xfa>
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1202 <print_error+0xd2>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
lea    0xe38(%rip),%rdx
lea    0xe37(%rip),%rcx
call   1040 <fprintf@plt>
jmp    1225 <print_error+0xf5>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
lea    0xe10(%rip),%rdx
lea    0xe0f(%rip),%rcx
call   1040 <fprintf@plt>
jmp    122a <print_error+0xfa>
jmp    122f <print_error+0xff>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<print_error>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    114e <print_error+0x1e>
lea    0xeba(%rip),%rsi
jmp    118f <print_error+0x5f>
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    116b <print_error+0x3b>
lea    0xed1(%rip),%rsi
jmp    118f <print_error+0x5f>
lea    0xeea(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
lea    0xedc(%rip),%rax
lea    0xef5(%rip),%rsi
cmove  %rax,%rsi
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rdx
lea    0xe89(%rip),%rcx
call   1040 <fprintf@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"alloc\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"%sERROR:%s Can't allocate memory.\0A\00"
@.str.2 = [6 x i8] c"\1B[31m\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@.str.4 = [6 x i8] c"rules\00"
@.str.5 = [34 x i8] c"%sERROR:%s Incorrect rules file.\0A\00"
@.str.6 = [4 x i8] c"net\00"
@.str.7 = [32 x i8] c"%sERROR:%s Incorrect net file.\0A\00"
@.str.8 = [11 x i8] c"%sERROR%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @print_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %28
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %27
16: ; preds = %9
%17 = load i8*, i8** %2
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %26
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %13
br label %28
28: ; preds = %27, %6
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
}

LLVM IR (-O2):
@.str = [6 x i8] c"alloc\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"%sERROR:%s Can't allocate memory.\0A\00"
@.str.2 = [6 x i8] c"\1B[31m\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@.str.4 = [6 x i8] c"rules\00"
@.str.5 = [34 x i8] c"%sERROR:%s Incorrect rules file.\0A\00"
@.str.6 = [4 x i8] c"net\00"
@.str.7 = [32 x i8] c"%sERROR:%s Incorrect net file.\0A\00"
@.str.8 = [11 x i8] c"%sERROR%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @print_error(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0)
br label %11
11: ; preds = %4, %1, %7
%12 = phi i8* [ %10, %7 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), %4 ]
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
}