#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(int);
int /*<<< orphan*/ printf(char *, char *);
void print_message(int level, char *msg) {
  switch (level) {
  case 1:
    printf("ERROR: %s\n", msg);
    exit(-1);
    break;
  case 2:
    printf("WARNING: %s\n", msg);
    break;
  case 3:
    printf("INFO: %s\n", msg);
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<print_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     1165 <print_message+0x45>
jmp    1143 <print_message+0x23>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     117f <print_message+0x5f>
jmp    1154 <print_message+0x34>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1194 <print_message+0x74>
jmp    11a4 <print_message+0x84>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    11a4 <print_message+0x84>
mov    -0x10(%rbp),%rsi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_message>:
cmp    $0x2,%edi
je     1130 <print_message+0x10>
cmp    $0x3,%edi
je     113c <print_message+0x1c>
cmp    $0x1,%edi
je     1148 <print_message+0x28>
ret
lea    0xed4(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xed5(%rip),%rdi
jmp    1030 <printf@plt>
push   %rax
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"ERROR: %s\0A\00"
@.str.1 = [13 x i8] c"WARNING: %s\0A\00"
@.str.2 = [10 x i8] c"INFO: %s\0A\00"
define void @print_message(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
switch i32 %5, label %16 [
i32 1, label %6
i32 2, label %10
i32 3, label %13
]
6: ; preds = %2
%7 = load i8*, i8** %4
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 @exit(i32 -1)
unreachable
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %16
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %2, %13, %10
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"ERROR: %s\0A\00"
@.str.1 = [13 x i8] c"WARNING: %s\0A\00"
@.str.2 = [10 x i8] c"INFO: %s\0A\00"
define void @print_message(i32 %0, i8* %1) {
switch i32 %0, label %10 [
i32 1, label %3
i32 2, label %7
i32 3, label %6
]
3: ; preds = %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = tail call i32 @exit(i32 -1)
unreachable
6: ; preds = %2
br label %7
7: ; preds = %2, %6
%8 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %2 ]
%9 = tail call i32 @printf(i8* %8, i8* %1)
br label %10
10: ; preds = %7, %2
ret void
}