#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]\n");
    return;
  }
  if (c == 4) {
    if (!strcmp(Cmd_Argv(3), "u")) {
      flags = 2;
    } else if (!strcmp(Cmd_Argv(3), "s")) {
      flags = 4;
    } else {
      Com_Printf("flags can only be 'u' or 's'\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    125b <Cvar_Set_f+0xfb>
cmpl   $0x4,-0x4(%rbp)
jne    123a <Cvar_Set_f+0xda>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%edi
lea    0xe73(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11ce <Cvar_Set_f+0x6e>
movl   $0x2,-0x8(%rbp)
jmp    1211 <Cvar_Set_f+0xb1>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%edi
lea    0xe48(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11fb <Cvar_Set_f+0x9b>
movl   $0x4,-0x8(%rbp)
jmp    120c <Cvar_Set_f+0xac>
lea    0xe29(%rip),%rdi
call   1070 <Com_Printf@plt>
jmp    125b <Cvar_Set_f+0xfb>
jmp    1211 <Cvar_Set_f+0xb1>
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    125b <Cvar_Set_f+0xfb>
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    11ca <Cvar_Set_f+0x6a>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
lea    0xe8d(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11ef <Cvar_Set_f+0x8f>
mov    $0x3,%edi
call   1080 <Cmd_Argv@plt>
lea    0xe73(%rip),%rsi
mov    %eax,%edi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11f6 <Cvar_Set_f+0x96>
lea    0xe63(%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    11fb <Cvar_Set_f+0x9b>
mov    $0x4,%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 = [39 x i8] c"usage: set <variable> <value> [u / s]\0A\00"
@.str.1 = [2 x i8] c"u\00"
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [30 x i8] c"flags can only be 'u' or 's'\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 ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %36
11: ; preds = %6, %0
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 4
br i1 %13, label %14, label %32
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 %27
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 %26
24: ; preds = %19
%25 = call i32 @Com_Printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %36
26: ; preds = %23
br label %27
27: ; preds = %26, %18
%28 = call i32 @Cmd_Argv(i32 1)
%29 = call i32 @Cmd_Argv(i32 2)
%30 = load i32, i32* %2
%31 = call i32 @Cvar_FullSet(i32 %28, i32 %29, i32 %30)
br label %36
32: ; preds = %11
%33 = call i32 @Cmd_Argv(i32 1)
%34 = call i32 @Cmd_Argv(i32 2)
%35 = call i32 @Cvar_Set(i32 %33, i32 %34)
br label %36
36: ; preds = %9, %24, %32, %27
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"usage: set <variable> <value> [u / s]\0A\00"
@.str.1 = [2 x i8] c"u\00"
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [30 x i8] c"flags can only be 'u' or 's'\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 ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %27
6: ; preds = %0
%7 = icmp eq i32 %1, 4
br i1 %7, label %8, label %23
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 %18, 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 %18, label %16
16: ; preds = %12
%17 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %27
18: ; preds = %12, %8
%19 = phi i32 [ 2, %8 ], [ 4, %12 ]
%20 = tail call i32 @Cmd_Argv(i32 1)
%21 = tail call i32 @Cmd_Argv(i32 2)
%22 = tail call i32 @Cvar_FullSet(i32 %20, i32 %21, i32 %19)
br label %27
23: ; preds = %6
%24 = tail call i32 @Cmd_Argv(i32 1)
%25 = tail call i32 @Cmd_Argv(i32 2)
%26 = tail call i32 @Cvar_Set(i32 %24, i32 %25)
br label %27
27: ; preds = %18, %23, %16, %4
ret void
}