#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 */
typedef int /*<<< orphan*/ name;

/* Variables and functions */
char *Cmd_Argv(int);
int /*<<< orphan*/ Com_Printf(char *, char *);
int /*<<< orphan*/ Cvar_Set(char *, char *);
int /*<<< orphan*/ Cvar_VariableStringBuffer(char *, char *, int);
void CL_SetModel_f(void) {
  char *arg;
  char name[256];
  arg = Cmd_Argv(1);
  if (arg[0]) {
    Cvar_Set("model", arg);
    Cvar_Set("headmodel", arg);
  } else {
    Cvar_VariableStringBuffer("model", name, sizeof(name));
    Com_Printf("model is set to %s\n", name);
  }
}


x86 assembly (clang, -O0):
<CL_SetModel_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    $0x1,%edi
call   1050 <Cmd_Argv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     118b <CL_SetModel_f+0x4b>
mov    -0x8(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <Cvar_Set@plt>
mov    -0x8(%rbp),%rsi
lea    0xe7f(%rip),%rdi
call   1030 <Cvar_Set@plt>
jmp    11b6 <CL_SetModel_f+0x76>
lea    -0x110(%rbp),%rsi
lea    0xe6b(%rip),%rdi
mov    $0x100,%edx
call   1060 <Cvar_VariableStringBuffer@plt>
lea    -0x110(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1040 <Com_Printf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_SetModel_f>:
push   %rbx
sub    $0x100,%rsp
mov    $0x1,%edi
call   1050 <Cmd_Argv@plt>
cmpb   $0x0,(%rax)
je     1180 <CL_SetModel_f+0x40>
mov    %rax,%rbx
lea    0xea3(%rip),%rdi
mov    %rax,%rsi
call   1030 <Cvar_Set@plt>
lea    0xe90(%rip),%rdi
mov    %rbx,%rsi
add    $0x100,%rsp
pop    %rbx
jmp    1030 <Cvar_Set@plt>
lea    0xe7d(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x100,%edx
call   1060 <Cvar_VariableStringBuffer@plt>
lea    0xe6c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <Com_Printf@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"model\00"
@.str.1 = [10 x i8] c"headmodel\00"
@.str.2 = [20 x i8] c"model is set to %s\0A\00"
define void @CL_SetModel_f() {
%1 = alloca i8*
%2 = alloca [256 x i8]
%3 = call i8* @Cmd_Argv(i32 1)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i32 @Cvar_Set(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %1
%12 = call i32 @Cvar_Set(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %18
13: ; preds = %0
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%15 = call i32 @Cvar_VariableStringBuffer(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %14, i32 256)
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%17 = call i32 @Com_Printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %13, %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"model\00"
@.str.1 = [10 x i8] c"headmodel\00"
@.str.2 = [20 x i8] c"model is set to %s\0A\00"
define void @CL_SetModel_f() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i8* @Cmd_Argv(i32 1)
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = tail call i32 @Cvar_Set(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3)
%8 = tail call i32 @Cvar_Set(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %12
9: ; preds = %0
%10 = call i32 @Cvar_VariableStringBuffer(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2, i32 256)
%11 = call i32 @Com_Printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %12
12: ; preds = %9, %6
ret void
}