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

/* Variables and functions */
int /*<<< orphan*/ AddIPBan(char const *);
int /*<<< orphan*/ G_Printf(char *);
int G_refClientnumForName(void *, char *);
char *Info_ValueForKey(char *, char *);
int /*<<< orphan*/ trap_Argv(int, char *, int);
int /*<<< orphan*/ trap_GetUserinfo(int, char *, int);
void G_PlayerBan() {
  char cmd[1024];
  int bannum;
  trap_Argv(1, cmd, sizeof(cmd));
  if (!*cmd) {
    G_Printf("usage: ban <clientname>.");
    return;
  }
  bannum = G_refClientnumForName(((void *)0), cmd);
  if (bannum != 64) {
    const char *value;
    char userinfo[1024];
    trap_GetUserinfo(bannum, userinfo, sizeof(userinfo));
    value = Info_ValueForKey(userinfo, "ip");
    AddIPBan(value);
  }
}


x86 assembly (clang, -O0):
<G_PlayerBan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    -0x400(%rbp),%rsi
mov    $0x1,%edi
mov    $0x400,%edx
call   1070 <trap_Argv@plt>
cmpb   $0x0,-0x400(%rbp)
jne    119f <G_PlayerBan+0x3f>
lea    0xe6b(%rip),%rdi
call   1060 <G_Printf@plt>
jmp    11ff <G_PlayerBan+0x9f>
lea    -0x400(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1080 <G_refClientnumForName@plt>
mov    %eax,-0x404(%rbp)
cmpl   $0x40,-0x404(%rbp)
je     11ff <G_PlayerBan+0x9f>
mov    -0x404(%rbp),%edi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
call   1030 <trap_GetUserinfo@plt>
lea    -0x810(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1040 <Info_ValueForKey@plt>
mov    %rax,-0x410(%rbp)
mov    -0x410(%rbp),%rdi
call   1050 <AddIPBan@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G_PlayerBan>:
push   %rbx
sub    $0x800,%rsp
mov    %rsp,%rsi
mov    $0x1,%edi
mov    $0x400,%edx
call   1070 <trap_Argv@plt>
cmpb   $0x0,(%rsp)
je     11bf <G_PlayerBan+0x5f>
mov    %rsp,%rsi
xor    %edi,%edi
call   1080 <G_refClientnumForName@plt>
cmp    $0x40,%eax
je     11cb <G_PlayerBan+0x6b>
lea    0x400(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1030 <trap_GetUserinfo@plt>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <Info_ValueForKey@plt>
mov    %rax,%rdi
call   1050 <AddIPBan@plt>
jmp    11cb <G_PlayerBan+0x6b>
lea    0xe3a(%rip),%rdi
call   1060 <G_Printf@plt>
add    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"usage: ban <clientname>.\00"
@.str.1 = [3 x i8] c"ip\00"
define void @G_PlayerBan() {
%1 = alloca [1024 x i8]
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%6 = call i32 @trap_Argv(i32 1, i8* %5, i32 1024)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @G_Printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %25
12: ; preds = %0
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%14 = call i32 @G_refClientnumForName(i8* null, i8* %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 64
br i1 %16, label %17, label %25
17: ; preds = %12
%18 = load i32, i32* %2
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%20 = call i32 @trap_GetUserinfo(i32 %18, i8* %19, i32 1024)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%22 = call i8* @Info_ValueForKey(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %22, i8** %3
%23 = load i8*, i8** %3
%24 = call i32 @AddIPBan(i8* %23)
br label %25
25: ; preds = %10, %17, %12
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"usage: ban <clientname>.\00"
@.str.1 = [3 x i8] c"ip\00"
define void @G_PlayerBan() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = call i32 @trap_Argv(i32 1, i8* %3, i32 1024)
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @G_Printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %17
9: ; preds = %0
%10 = call i32 @G_refClientnumForName(i8* null, i8* %3)
%11 = icmp eq i32 %10, 64
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%14 = call i32 @trap_GetUserinfo(i32 %10, i8* %13, i32 1024)
%15 = call i8* @Info_ValueForKey(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @AddIPBan(i8* %15)
br label %17
17: ; preds = %9, %12, %7
ret void
}