#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 Cmd_Argc();
int /*<<< orphan*/ Cmd_Argv(int);
int /*<<< orphan*/ Com_Printf(char *);
int /*<<< orphan*/ Cvar_FullSet(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ Cvar_Set(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, char *);
void Cvar_Set_f(void) {
  int c;
  int flags;
  c = Cmd_Argc();
  if (c != 3 && c != 4) {
    Com_Printf("usage: set <variable> <value> [u / s / g]\n");
    return;
  }
  if (c == 4) {
    if (!strcmp(Cmd_Argv(3), "u"))
      flags = 2;
    else if (!strcmp(Cmd_Argv(3), "s"))
      flags = 4;
    else if (!strcmp(Cmd_Argv(3), "g"))
      flags = 64;
    else {
      Com_Printf("flags can only be 'u', 's', or 'g'\n");
      return;
    }
    Cvar_FullSet(Cmd_Argv(1), Cmd_Argv(2), flags);
  } else
    Cvar_Set(Cmd_Argv(1), Cmd_Argv(2));
}


x86 assembly (clang, -O0):
<Cvar_Set_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Cmd_Argc@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     1197 <Cvar_Set_f+0x37>
cmpl   $0x4,-0x4(%rbp)
je     1197 <Cvar_Set_f+0x37>
lea    0xe73(%rip),%rdi
call   1070 <Com_Printf@plt>
jmp    128d <Cvar_Set_f+0x12d>
cmpl   $0x4,-0x4(%rbp)
jne    126c <Cvar_Set_f+0x10c>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%edi
lea    0xe77(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11ce <Cvar_Set_f+0x6e>
movl   $0x2,-0x8(%rbp)
jmp    1243 <Cvar_Set_f+0xe3>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%edi
lea    0xe4c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11fb <Cvar_Set_f+0x9b>
movl   $0x4,-0x8(%rbp)
jmp    123e <Cvar_Set_f+0xde>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%edi
lea    0xe21(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1228 <Cvar_Set_f+0xc8>
movl   $0x40,-0x8(%rbp)
jmp    1239 <Cvar_Set_f+0xd9>
lea    0xe02(%rip),%rdi
call   1070 <Com_Printf@plt>
jmp    128d <Cvar_Set_f+0x12d>
jmp    123e <Cvar_Set_f+0xde>
jmp    1243 <Cvar_Set_f+0xe3>
mov    $0x1,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,-0xc(%rbp)
mov    $0x2,%edi
call   1080 <Cmd_Argv@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
mov    -0x8(%rbp),%edx
call   1040 <Cvar_FullSet@plt>
jmp    128d <Cvar_Set_f+0x12d>
mov    $0x1,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,-0x10(%rbp)
mov    $0x2,%edi
call   1080 <Cmd_Argv@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1060 <Cvar_Set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cvar_Set_f>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <Cmd_Argc@plt>
lea    -0x5(%rax),%ecx
cmp    $0xfffffffd,%ecx
ja     1184 <Cvar_Set_f+0x24>
lea    0xe87(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <Com_Printf@plt>
cmp    $0x4,%eax
jne    11e6 <Cvar_Set_f+0x86>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
lea    0xe91(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %eax,%eax
je     120b <Cvar_Set_f+0xab>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
lea    0xe77(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1212 <Cvar_Set_f+0xb2>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
lea    0xe5d(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1219 <Cvar_Set_f+0xb9>
lea    0xe4d(%rip),%rdi
jmp    1179 <Cvar_Set_f+0x19>
mov    $0x1,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1080 <Cmd_Argv@plt>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <Cvar_Set@plt>
mov    $0x2,%ebx
jmp    121e <Cvar_Set_f+0xbe>
mov    $0x4,%ebx
jmp    121e <Cvar_Set_f+0xbe>
mov    $0x40,%ebx
mov    $0x1,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%ebp
mov    $0x2,%edi
call   1080 <Cmd_Argv@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <Cvar_FullSet@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"usage: set <variable> <value> [u / s / g]\0A\00"
@.str.1 = [2 x i8] c"u\00"
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [2 x i8] c"g\00"
@.str.4 = [36 x i8] c"flags can only be 'u', 's', or 'g'\0A\00"
define void @Cvar_Set_f() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @Cmd_Argc()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 3
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @Com_Printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %42
11: ; preds = %6, %0
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 4
br i1 %13, label %14, label %38
14: ; preds = %11
%15 = call i32 @Cmd_Argv(i32 3)
%16 = call i32 @strcmp(i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %14
store i32 2, i32* %2
br label %33
19: ; preds = %14
%20 = call i32 @Cmd_Argv(i32 3)
%21 = call i32 @strcmp(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %19
store i32 4, i32* %2
br label %32
24: ; preds = %19
%25 = call i32 @Cmd_Argv(i32 3)
%26 = call i32 @strcmp(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %24
store i32 64, i32* %2
br label %31
29: ; preds = %24
%30 = call i32 @Com_Printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %42
31: ; preds = %28
br label %32
32: ; preds = %31, %23
br label %33
33: ; preds = %32, %18
%34 = call i32 @Cmd_Argv(i32 1)
%35 = call i32 @Cmd_Argv(i32 2)
%36 = load i32, i32* %2
%37 = call i32 @Cvar_FullSet(i32 %34, i32 %35, i32 %36)
br label %42
38: ; preds = %11
%39 = call i32 @Cmd_Argv(i32 1)
%40 = call i32 @Cmd_Argv(i32 2)
%41 = call i32 @Cvar_Set(i32 %39, i32 %40)
br label %42
42: ; preds = %9, %29, %38, %33
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"usage: set <variable> <value> [u / s / g]\0A\00"
@.str.1 = [2 x i8] c"u\00"
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [2 x i8] c"g\00"
@.str.4 = [36 x i8] c"flags can only be 'u', 's', or 'g'\0A\00"
define void @Cvar_Set_f() {
%1 = tail call i32 (...) @Cmd_Argc()
%2 = add i32 %1, -5
%3 = icmp ult i32 %2, -2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %31
6: ; preds = %0
%7 = icmp eq i32 %1, 4
br i1 %7, label %8, label %27
8: ; preds = %6
%9 = tail call i32 @Cmd_Argv(i32 3)
%10 = tail call i32 @strcmp(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %8
%13 = tail call i32 @Cmd_Argv(i32 3)
%14 = tail call i32 @strcmp(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %12
%17 = tail call i32 @Cmd_Argv(i32 3)
%18 = tail call i32 @strcmp(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %31
22: ; preds = %16, %12, %8
%23 = phi i32 [ 2, %8 ], [ 4, %12 ], [ 64, %16 ]
%24 = tail call i32 @Cmd_Argv(i32 1)
%25 = tail call i32 @Cmd_Argv(i32 2)
%26 = tail call i32 @Cvar_FullSet(i32 %24, i32 %25, i32 %23)
br label %31
27: ; preds = %6
%28 = tail call i32 @Cmd_Argv(i32 1)
%29 = tail call i32 @Cmd_Argv(i32 2)
%30 = tail call i32 @Cvar_Set(i32 %28, i32 %29)
br label %31
31: ; preds = %22, %27, %20, %4
ret void
}