#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 */
void message_custom(char const *, char *, char *, char *);
void message(const char *msg, const int code) {
  switch (code) {
  case 3:
    return message_custom(msg, "00", "31", "49");
  case 5:
    return message_custom(msg, "00", "34", "49");
  case 4:
    return message_custom(msg, "00", "33", "49");
  case 2:
    return message_custom(msg, "00", "32", "49");
  }
}


x86 assembly (clang, -O0):
<message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     11cf <message+0xbf>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
lea    0xeb9(%rip),%rdx
lea    0xeb5(%rip),%rcx
call   1030 <message_custom@plt>
jmp    11cf <message+0xbf>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
lea    0xe9c(%rip),%rdx
lea    0xe92(%rip),%rcx
call   1030 <message_custom@plt>
jmp    11cf <message+0xbf>
mov    -0x8(%rbp),%rdi
lea    0xe77(%rip),%rsi
lea    0xe7c(%rip),%rdx
lea    0xe6f(%rip),%rcx
call   1030 <message_custom@plt>
jmp    11cf <message+0xbf>
mov    -0x8(%rbp),%rdi
lea    0xe54(%rip),%rsi
lea    0xe5c(%rip),%rdx
lea    0xe4c(%rip),%rcx
call   1030 <message_custom@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<message>:
add    $0xfffffffe,%esi
cmp    $0x3,%esi
ja     113c <message+0x2c>
movslq %esi,%rax
lea    0xef2(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
lea    0xed0(%rip),%rsi
lea    0xecf(%rip),%rcx
jmp    1030 <message_custom@plt>
ret

LLVM IR (-O0):
@.str = [3 x i8] c"00\00"
@.str.1 = [3 x i8] c"31\00"
@.str.2 = [3 x i8] c"49\00"
@.str.3 = [3 x i8] c"34\00"
@.str.4 = [3 x i8] c"33\00"
@.str.5 = [3 x i8] c"32\00"
define void @message(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %14 [
i32 3, label %6
i32 5, label %8
i32 4, label %10
i32 2, label %12
]
6: ; preds = %2
%7 = load i8*, i8** %3
br label %14
8: ; preds = %2
%9 = load i8*, i8** %3
br label %14
10: ; preds = %2
%11 = load i8*, i8** %3
br label %14
12: ; preds = %2
%13 = load i8*, i8** %3
br label %14
14: ; preds = %6, %8, %10, %12, %2
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"00\00"
@.str.1 = [3 x i8] c"31\00"
@.str.2 = [3 x i8] c"49\00"
@.str.3 = [3 x i8] c"34\00"
@.str.4 = [3 x i8] c"33\00"
@.str.5 = [3 x i8] c"32\00"
@reltable.message = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([4 x i32]* @reltable.message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.message to i64)) to i32)]
define void @message(i8* %0, i32 %1) {
%3 = add i32 %1, -2
%4 = icmp ult i32 %3, 4
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.message to i8*), i64 %7)
tail call void @message_custom(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %2, %5
ret void
}