#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 */
char *CG_Argv(int);
int /*<<< orphan*/ CG_Printf(char *);
int /*<<< orphan*/ Q_stricmp(char const *, char *);
int /*<<< orphan*/ trap_SendConsoleCommand(int /*<<< orphan*/);
int /*<<< orphan*/ va(char *, char const *);
void CG_Alias_f(void) {
  const char *token = CG_Argv(0);
  if (!Q_stricmp(token, "+alias")) {
    token = CG_Argv(1);
  } else if (!Q_stricmp(token, "-alias")) {
    token = CG_Argv(2);
  }
  if (!token) {
    CG_Printf("usage: +alias <cvar> <cvar>\n");
    return;
  }
  trap_SendConsoleCommand(va("vstr %s;", token));
}


x86 assembly (clang, -O0):
<CG_Alias_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <CG_Argv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1030 <Q_stricmp@plt>
cmp    $0x0,%eax
jne    118f <CG_Alias_f+0x3f>
mov    $0x1,%edi
call   1040 <CG_Argv@plt>
mov    %rax,-0x8(%rbp)
jmp    11bb <CG_Alias_f+0x6b>
mov    -0x8(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <Q_stricmp@plt>
cmp    $0x0,%eax
jne    11b6 <CG_Alias_f+0x66>
mov    $0x2,%edi
call   1040 <CG_Argv@plt>
mov    %rax,-0x8(%rbp)
jmp    11bb <CG_Alias_f+0x6b>
cmpq   $0x0,-0x8(%rbp)
jne    11d7 <CG_Alias_f+0x87>
lea    0xe41(%rip),%rdi
call   1050 <CG_Printf@plt>
jmp    11ee <CG_Alias_f+0x9e>
mov    -0x8(%rbp),%rsi
lea    0xe49(%rip),%rdi
call   1060 <va@plt>
mov    %eax,%edi
call   1070 <trap_SendConsoleCommand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_Alias_f>:
push   %rbx
xor    %edi,%edi
call   1040 <CG_Argv@plt>
mov    %rax,%rbx
lea    0xe9e(%rip),%rsi
mov    %rax,%rdi
call   1030 <Q_stricmp@plt>
test   %eax,%eax
je     119d <CG_Alias_f+0x4d>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1030 <Q_stricmp@plt>
test   %eax,%eax
je     11a4 <CG_Alias_f+0x54>
test   %rbx,%rbx
je     11b6 <CG_Alias_f+0x66>
lea    0xe9e(%rip),%rdi
mov    %rbx,%rsi
call   1060 <va@plt>
mov    %eax,%edi
pop    %rbx
jmp    1070 <trap_SendConsoleCommand@plt>
mov    $0x1,%edi
jmp    11a9 <CG_Alias_f+0x59>
mov    $0x2,%edi
call   1040 <CG_Argv@plt>
mov    %rax,%rbx
test   %rbx,%rbx
jne    1186 <CG_Alias_f+0x36>
lea    0xe51(%rip),%rdi
pop    %rbx
jmp    1050 <CG_Printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"+alias\00"
@.str.1 = [7 x i8] c"-alias\00"
@.str.2 = [29 x i8] c"usage: +alias <cvar> <cvar>\0A\00"
@.str.3 = [9 x i8] c"vstr %s;\00"
define void @CG_Alias_f() {
%1 = alloca i8*
%2 = call i8* @CG_Argv(i32 0)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @Q_stricmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i8* @CG_Argv(i32 1)
store i8* %7, i8** %1
br label %15
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i32 @Q_stricmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i8* @CG_Argv(i32 2)
store i8* %13, i8** %1
br label %14
14: ; preds = %12, %8
br label %15
15: ; preds = %14, %6
%16 = load i8*, i8** %1
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 @CG_Printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %24
20: ; preds = %15
%21 = load i8*, i8** %1
%22 = call i32 @va(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = call i32 @trap_SendConsoleCommand(i32 %22)
br label %24
24: ; preds = %20, %18
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"+alias\00"
@.str.1 = [7 x i8] c"-alias\00"
@.str.2 = [29 x i8] c"usage: +alias <cvar> <cvar>\0A\00"
@.str.3 = [9 x i8] c"vstr %s;\00"
define void @CG_Alias_f() {
%1 = tail call i8* @CG_Argv(i32 0)
%2 = tail call i32 @Q_stricmp(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i32 @Q_stricmp(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4, %0
%8 = phi i32 [ 1, %0 ], [ 2, %4 ]
%9 = tail call i8* @CG_Argv(i32 %8)
br label %10
10: ; preds = %7, %4
%11 = phi i8* [ %1, %4 ], [ %9, %7 ]
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @CG_Printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %18
15: ; preds = %10
%16 = tail call i32 @va(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%17 = tail call i32 @trap_SendConsoleCommand(i32 %16)
br label %18
18: ; preds = %15, %13
ret void
}