#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*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ trap_Cvar_VariableStringBuffer(char const *, char *, int);
char *UI_Cvar_VariableString(const char *var_name) {
  static char buffer[2][1024];
  static int toggle;
  toggle ^= 1;
  trap_Cvar_VariableStringBuffer(var_name, buffer[toggle], sizeof(buffer[0]));
  return buffer[toggle];
}


x86 assembly (clang, -O0):
<UI_Cvar_VariableString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x371e(%rip),%eax
xor    $0x1,%eax
mov    %eax,0x3715(%rip)
mov    -0x8(%rbp),%rdi
movslq 0x370a(%rip),%rax
lea    0x2f03(%rip),%rsi
shl    $0xa,%rax
add    %rax,%rsi
mov    $0x400,%edx
call   1030 <trap_Cvar_VariableStringBuffer@plt>
movslq 0x36eb(%rip),%rcx
lea    0x2ee4(%rip),%rax
shl    $0xa,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_Cvar_VariableString>:
push   %rbx
movslq 0x3728(%rip),%rsi
xor    $0x1,%rsi
mov    %esi,0x371e(%rip)
shl    $0xa,%rsi
lea    0x2f13(%rip),%rbx
add    %rbx,%rsi
mov    $0x400,%edx
call   1030 <trap_Cvar_VariableStringBuffer@plt>
movslq 0x36ff(%rip),%rax
shl    $0xa,%rax
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@UI_Cvar_VariableString.buffer = internal global [2 x [1024 x i8]] zeroinitializer
@UI_Cvar_VariableString.toggle = internal global i32 0
define i8* @UI_Cvar_VariableString(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @UI_Cvar_VariableString.toggle
%4 = xor i32 %3, 1
store i32 %4, i32* @UI_Cvar_VariableString.toggle
%5 = load i8*, i8** %2
%6 = load i32, i32* @UI_Cvar_VariableString.toggle
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @UI_Cvar_VariableString.buffer, i64 0, i64 %7
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%10 = call i32 @trap_Cvar_VariableStringBuffer(i8* %5, i8* %9, i32 1024)
%11 = load i32, i32* @UI_Cvar_VariableString.toggle
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @UI_Cvar_VariableString.buffer, i64 0, i64 %12
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
ret i8* %14
}

LLVM IR (-O2):
@UI_Cvar_VariableString.buffer = internal global [2 x [1024 x i8]] zeroinitializer
@UI_Cvar_VariableString.toggle = internal unnamed_addr global i32 0
define i8* @UI_Cvar_VariableString(i8* %0) {
%2 = load i32, i32* @UI_Cvar_VariableString.toggle
%3 = xor i32 %2, 1
store i32 %3, i32* @UI_Cvar_VariableString.toggle
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @UI_Cvar_VariableString.buffer, i64 0, i64 %4, i64 0
%6 = tail call i32 @trap_Cvar_VariableStringBuffer(i8* %0, i8* %5, i32 1024)
%7 = load i32, i32* @UI_Cvar_VariableString.toggle
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @UI_Cvar_VariableString.buffer, i64 0, i64 %8, i64 0
ret i8* %9
}