#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 Cmd_Argv(int);
int /*<<< orphan*/ Com_Printf(char *, ...);
int GetCvar(char *);
int GetCvarFloat(char *);
int GetCvarInt(char *);
int Sys_Milliseconds();
void Cmd_Test() {
  Com_Printf("Test command\n");
  int argc = Cmd_Argc();
  Com_Printf("There are %i arguments passed:", argc);
  int i = 0;
  for (; i < argc; i++)
    Com_Printf(" %s", Cmd_Argv(i));
  Com_Printf("\n");
  Com_Printf("The current time is %i\n", Sys_Milliseconds());
  Com_Printf("The integer value of sv_maxclients is %d\n",
             GetCvarInt("sv_maxclients"));
  Com_Printf("The float value of sv_maxclients is %f\n",
             GetCvarFloat("sv_maxclients"));
  Com_Printf("The string value of sv_maxclients is %s\n",
             GetCvar("sv_maxclients"));
}


x86 assembly (clang, -O0):
<Cmd_Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
mov    $0x0,%al
call   1030 <Cmd_Argc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11da <Cmd_Test+0x6a>
mov    -0x8(%rbp),%edi
call   1080 <Cmd_Argv@plt>
mov    %eax,%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a8 <Cmd_Test+0x38>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
mov    $0x0,%al
call   1040 <Sys_Milliseconds@plt>
mov    %eax,%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
lea    0xe6d(%rip),%rdi
call   1050 <GetCvarInt@plt>
mov    %eax,%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
lea    0xe51(%rip),%rdi
call   1060 <GetCvarFloat@plt>
mov    %eax,%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
lea    0xe35(%rip),%rdi
call   1090 <GetCvar@plt>
mov    %eax,%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1070 <Com_Printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cmd_Test>:
push   %rbp
push   %r14
push   %rbx
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1070 <Com_Printf@plt>
xor    %eax,%eax
call   1030 <Cmd_Argc@plt>
mov    %eax,%ebx
lea    0xe7c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <Com_Printf@plt>
test   %ebx,%ebx
jle    11ca <Cmd_Test+0x5a>
lea    0xe87(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1080 <Cmd_Argv@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <Com_Printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11b0 <Cmd_Test+0x40>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1070 <Com_Printf@plt>
xor    %eax,%eax
call   1040 <Sys_Milliseconds@plt>
lea    0xe4b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <Com_Printf@plt>
lea    0xe7d(%rip),%rbx
mov    %rbx,%rdi
call   1050 <GetCvarInt@plt>
lea    0xe44(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <Com_Printf@plt>
mov    %rbx,%rdi
call   1060 <GetCvarFloat@plt>
lea    0xe64(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <Com_Printf@plt>
mov    %rbx,%rdi
call   1090 <GetCvar@plt>
lea    0xe74(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <Com_Printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Test command\0A\00"
@.str.1 = [31 x i8] c"There are %i arguments passed:\00"
@.str.2 = [4 x i8] c" %s\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [24 x i8] c"The current time is %i\0A\00"
@.str.5 = [42 x i8] c"The integer value of sv_maxclients is %d\0A\00"
@.str.6 = [14 x i8] c"sv_maxclients\00"
@.str.7 = [40 x i8] c"The float value of sv_maxclients is %f\0A\00"
@.str.8 = [41 x i8] c"The string value of sv_maxclients is %s\0A\00"
define void @Cmd_Test() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @Cmd_Argc()
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %5)
store i32 0, i32* %2
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i32, i32* %2
%13 = call i32 @Cmd_Argv(i32 %12)
%14 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (...) @Sys_Milliseconds()
%21 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i32 @GetCvarInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = call i32 @GetCvarFloat(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %24)
%26 = call i32 @GetCvar(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i32 %26)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Test command\0A\00"
@.str.1 = [31 x i8] c"There are %i arguments passed:\00"
@.str.2 = [4 x i8] c" %s\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [24 x i8] c"The current time is %i\0A\00"
@.str.5 = [42 x i8] c"The integer value of sv_maxclients is %d\0A\00"
@.str.6 = [14 x i8] c"sv_maxclients\00"
@.str.7 = [40 x i8] c"The float value of sv_maxclients is %f\0A\00"
@.str.8 = [41 x i8] c"The string value of sv_maxclients is %s\0A\00"
define void @Cmd_Test() {
%1 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @Cmd_Argc()
%3 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %11
5: ; preds = %0, %5
%6 = phi i32 [ %9, %5 ], [ 0, %0 ]
%7 = tail call i32 @Cmd_Argv(i32 %6)
%8 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, %2
br i1 %10, label %11, label %5
11: ; preds = %5, %0
%12 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 (...) @Sys_Milliseconds()
%14 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = tail call i32 @GetCvarInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = tail call i32 @GetCvarFloat(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %17)
%19 = tail call i32 @GetCvar(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @Com_Printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i32 %19)
ret void
}