#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 /*<<< orphan*/ Com_sprintf(char *, int, char *, char *, int, char const *);
int /*<<< orphan*/ Q_strncpyz(char *, char const *, int);
char *Com_LocalPlayerCvarName(int localPlayerNum, const char *in_cvarName) {
  static char localPlayerCvarName[256];
  if (localPlayerNum == 0) {
    Q_strncpyz(localPlayerCvarName, in_cvarName, 256);
  } else {
    char prefix[2];
    const char *cvarName;
    prefix[1] = '\0';
    cvarName = in_cvarName;
    if (cvarName[0] == '+' || cvarName[0] == '-') {
      prefix[0] = cvarName[0];
      cvarName++;
    } else {
      prefix[0] = '\0';
    }
    Com_sprintf(localPlayerCvarName, 256, "%s%d%s", prefix, localPlayerNum + 1,
                cvarName);
  }
  return localPlayerCvarName;
}


x86 assembly (clang, -O0):
<Com_LocalPlayerCvarName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1153 <Com_LocalPlayerCvarName+0x33>
mov    -0x10(%rbp),%rsi
lea    0x2efc(%rip),%rdi
mov    $0x100,%edx
call   1040 <Q_strncpyz@plt>
jmp    11c5 <Com_LocalPlayerCvarName+0xa5>
movb   $0x0,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     117f <Com_LocalPlayerCvarName+0x5f>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1199 <Com_LocalPlayerCvarName+0x79>
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    119d <Com_LocalPlayerCvarName+0x7d>
movb   $0x0,-0x12(%rbp)
lea    -0x12(%rbp),%rcx
mov    -0x4(%rbp),%r8d
add    $0x1,%r8d
mov    -0x20(%rbp),%r9
lea    0x2e8c(%rip),%rdi
mov    $0x100,%esi
lea    0xe40(%rip),%rdx
call   1030 <Com_sprintf@plt>
lea    0x2e74(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Com_LocalPlayerCvarName>:
push   %rax
mov    %rsi,%r9
test   %edi,%edi
je     1145 <Com_LocalPlayerCvarName+0x25>
mov    %edi,%r8d
movb   $0x0,0x7(%rsp)
mov    (%r9),%al
cmp    $0x2d,%al
je     113b <Com_LocalPlayerCvarName+0x1b>
cmp    $0x2b,%al
jne    115b <Com_LocalPlayerCvarName+0x3b>
mov    %al,0x6(%rsp)
add    $0x1,%r9
jmp    1160 <Com_LocalPlayerCvarName+0x40>
lea    0x2ef4(%rip),%rdi
mov    %r9,%rsi
mov    $0x100,%edx
call   1040 <Q_strncpyz@plt>
jmp    1181 <Com_LocalPlayerCvarName+0x61>
movb   $0x0,0x6(%rsp)
add    $0x1,%r8d
lea    0x2ed5(%rip),%rdi
lea    0xe8e(%rip),%rdx
lea    0x6(%rsp),%rcx
mov    $0x100,%esi
call   1030 <Com_sprintf@plt>
lea    0x2eb8(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@Com_LocalPlayerCvarName.localPlayerCvarName = internal global [256 x i8] zeroinitializer
@.str = [7 x i8] c"%s%d%s\00"
define i8* @Com_LocalPlayerCvarName(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [2 x i8]
%6 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @Q_strncpyz(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Com_LocalPlayerCvarName.localPlayerCvarName, i64 0, i64 0), i8* %10, i32 256)
br label %41
12: ; preds = %2
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 0, i8* %13
%14 = load i8*, i8** %4
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 43
br i1 %19, label %26, label %20
20: ; preds = %12
%21 = load i8*, i8** %6
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 45
br i1 %25, label %26, label %33
26: ; preds = %20, %12
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 %29, i8* %30
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %6
br label %35
33: ; preds = %20
%34 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 0, i8* %34
br label %35
35: ; preds = %33, %26
%36 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
%39 = load i8*, i8** %6
%40 = call i32 @Com_sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Com_LocalPlayerCvarName.localPlayerCvarName, i64 0, i64 0), i32 256, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %36, i32 %38, i8* %39)
br label %41
41: ; preds = %35, %9
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Com_LocalPlayerCvarName.localPlayerCvarName, i64 0, i64 0)
}

LLVM IR (-O2):
@Com_LocalPlayerCvarName.localPlayerCvarName = internal global [256 x i8] zeroinitializer
@.str = [7 x i8] c"%s%d%s\00"
define i8* @Com_LocalPlayerCvarName(i32 %0, i8* %1) {
%3 = alloca [2 x i8]
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @Q_strncpyz(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Com_LocalPlayerCvarName.localPlayerCvarName, i64 0, i64 0), i8* %1, i32 256)
br label %18
7: ; preds = %2
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 0, i8* %9
%10 = load i8, i8* %1
switch i8 %10, label %13 [
i8 43, label %11
i8 45, label %11
]
11: ; preds = %7, %7
store i8 %10, i8* %8
%12 = getelementptr inbounds i8, i8* %1, i64 1
br label %14
13: ; preds = %7
store i8 0, i8* %8
br label %14
14: ; preds = %13, %11
%15 = phi i8* [ %12, %11 ], [ %1, %13 ]
%16 = add nsw i32 %0, 1
%17 = call i32 @Com_sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Com_LocalPlayerCvarName.localPlayerCvarName, i64 0, i64 0), i32 256, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %16, i8* %15)
br label %18
18: ; preds = %14, %5
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Com_LocalPlayerCvarName.localPlayerCvarName, i64 0, i64 0)
}