#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*/ Cbuf_AddText(char *);
int /*<<< orphan*/ Cbuf_InsertText(char *);
int /*<<< orphan*/ Cmd_ExecuteString(char *);
int /*<<< orphan*/ Com_Error(int /*<<< orphan*/, char *);
void Cbuf_ExecuteText(int exec_when, char *text) {
  switch (exec_when) {
  case 0:
    Cmd_ExecuteString(text);
    break;
  case 1:
    Cbuf_InsertText(text);
    break;
  case 2:
    Cbuf_AddText(text);
    break;
  default:
    Com_Error(0, "Cbuf_ExecuteText: bad exec_when");
  }
}


x86 assembly (clang, -O0):
<Cbuf_ExecuteText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1184 <Cbuf_ExecuteText+0x44>
jmp    1162 <Cbuf_ExecuteText+0x22>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1192 <Cbuf_ExecuteText+0x52>
jmp    1173 <Cbuf_ExecuteText+0x33>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11a0 <Cbuf_ExecuteText+0x60>
jmp    11ae <Cbuf_ExecuteText+0x6e>
mov    -0x10(%rbp),%rdi
call   1050 <Cmd_ExecuteString@plt>
jmp    11bc <Cbuf_ExecuteText+0x7c>
mov    -0x10(%rbp),%rdi
call   1040 <Cbuf_InsertText@plt>
jmp    11bc <Cbuf_ExecuteText+0x7c>
mov    -0x10(%rbp),%rdi
call   1030 <Cbuf_AddText@plt>
jmp    11bc <Cbuf_ExecuteText+0x7c>
xor    %edi,%edi
lea    0xe49(%rip),%rsi
call   1060 <Com_Error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cbuf_ExecuteText>:
cmp    $0x2,%edi
je     1156 <Cbuf_ExecuteText+0x16>
cmp    $0x1,%edi
je     115e <Cbuf_ExecuteText+0x1e>
test   %edi,%edi
jne    1166 <Cbuf_ExecuteText+0x26>
mov    %rsi,%rdi
jmp    1050 <Cmd_ExecuteString@plt>
mov    %rsi,%rdi
jmp    1030 <Cbuf_AddText@plt>
mov    %rsi,%rdi
jmp    1040 <Cbuf_InsertText@plt>
lea    0xe93(%rip),%rsi
xor    %edi,%edi
jmp    1060 <Com_Error@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Cbuf_ExecuteText: bad exec_when\00"
define void @Cbuf_ExecuteText(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 0, label %6
i32 1, label %9
i32 2, label %12
]
6: ; preds = %2
%7 = load i8*, i8** %4
%8 = call i32 @Cmd_ExecuteString(i8* %7)
br label %17
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @Cbuf_InsertText(i8* %10)
br label %17
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @Cbuf_AddText(i8* %13)
br label %17
15: ; preds = %2
%16 = call i32 @Com_Error(i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Cbuf_ExecuteText: bad exec_when\00"
define void @Cbuf_ExecuteText(i32 %0, i8* %1) {
switch i32 %0, label %9 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
]
3: ; preds = %2
%4 = tail call i32 @Cmd_ExecuteString(i8* %1)
br label %11
5: ; preds = %2
%6 = tail call i32 @Cbuf_InsertText(i8* %1)
br label %11
7: ; preds = %2
%8 = tail call i32 @Cbuf_AddText(i8* %1)
br label %11
9: ; preds = %2
%10 = tail call i32 @Com_Error(i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %7, %5, %3
ret void
}