#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*/ printf(char *, char const *);
void print(int level, const char *msg) {
  switch (level) {
  case 1:
    printf("[INF] %s\n", msg);
    break;
  case 2:
    printf("[WAN] %s\n", msg);
    break;
  case 3:
    printf("[ERR] %s\n", msg);
    break;
  default:
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<print>:
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     1155 <print+0x45>
jmp    1133 <print+0x23>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     116a <print+0x5a>
jmp    1144 <print+0x34>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     117f <print+0x6f>
jmp    1194 <print+0x84>
mov    -0x10(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <print+0x89>
mov    -0x10(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <print+0x89>
mov    -0x10(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <print+0x89>
jmp    1199 <print+0x89>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     112e <print+0x1e>
movslq %edi,%rax
lea    0xefe(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [10 x i8] c"[INF] %s\0A\00"
@.str.1 = [10 x i8] c"[WAN] %s\0A\00"
@.str.2 = [10 x i8] c"[ERR] %s\0A\00"
define void @print(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 %15 [
i32 1, label %6
i32 2, label %9
i32 3, label %12
]
6: ; preds = %2
%7 = load i8*, i8** %4
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %16
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %16
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"[INF] %s\0A\00"
@.str.1 = [10 x i8] c"[WAN] %s\0A\00"
@.str.2 = [10 x i8] c"[ERR] %s\0A\00"
@reltable.print = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.print to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.print to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.print to i64)) to i32)]
define void @print(i32 %0, i8* %1) {
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 3
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.print to i8*), i64 %7)
%9 = tail call i32 @printf(i8* %8, i8* %1)
br label %10
10: ; preds = %2, %5
ret void
}