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

/* Variables and functions */
int /*<<< orphan*/ trap_SP_GetStringTextString(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ va(char *, char *, char *);
const char *CG_GetStripEdString(char *refSection, char *refName) {
  static char text[2][1024] = {0};
  static int index = 0;
  index ^= 1;
  trap_SP_GetStringTextString(va("%s_%s", refSection, refName), text[index],
                              sizeof(text[0]));
  return text[index];
}


x86 assembly (clang, -O0):
<CG_GetStripEdString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x370a(%rip),%eax
xor    $0x1,%eax
mov    %eax,0x3701(%rip)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeb2(%rip),%rdi
call   1040 <va@plt>
mov    %eax,%edi
movslq 0x36e4(%rip),%rax
lea    0x2edd(%rip),%rsi
shl    $0xa,%rax
add    %rax,%rsi
mov    $0x400,%edx
call   1030 <trap_SP_GetStringTextString@plt>
movslq 0x36c5(%rip),%rcx
lea    0x2ebe(%rip),%rax
shl    $0xa,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_GetStripEdString>:
push   %rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
xorb   $0x1,0x3712(%rip)
lea    0xecb(%rip),%rdi
call   1040 <va@plt>
movslq 0x36ff(%rip),%rsi
shl    $0xa,%rsi
lea    0x2ef4(%rip),%rbx
add    %rbx,%rsi
mov    %eax,%edi
mov    $0x400,%edx
call   1030 <trap_SP_GetStringTextString@plt>
movslq 0x36de(%rip),%rax
shl    $0xa,%rax
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@CG_GetStripEdString.text = internal global [2 x [1024 x i8]] zeroinitializer
@CG_GetStripEdString.index = internal global i32 0
@.str = [6 x i8] c"%s_%s\00"
define i8* @CG_GetStripEdString(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @CG_GetStripEdString.index
%6 = xor i32 %5, 1
store i32 %6, i32* @CG_GetStripEdString.index
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @va(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = load i32, i32* @CG_GetStripEdString.index
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @CG_GetStripEdString.text, i64 0, i64 %11
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%14 = call i32 @trap_SP_GetStringTextString(i32 %9, i8* %13, i32 1024)
%15 = load i32, i32* @CG_GetStripEdString.index
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @CG_GetStripEdString.text, i64 0, i64 %16
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
ret i8* %18
}

LLVM IR (-O2):
@CG_GetStripEdString.text = internal global [2 x [1024 x i8]] zeroinitializer
@CG_GetStripEdString.index = internal unnamed_addr global i32 0
@.str = [6 x i8] c"%s_%s\00"
define i8* @CG_GetStripEdString(i8* %0, i8* %1) {
%3 = load i32, i32* @CG_GetStripEdString.index
%4 = xor i32 %3, 1
store i32 %4, i32* @CG_GetStripEdString.index
%5 = tail call i32 @va(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = load i32, i32* @CG_GetStripEdString.index
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @CG_GetStripEdString.text, i64 0, i64 %7, i64 0
%9 = tail call i32 @trap_SP_GetStringTextString(i32 %5, i8* %8, i32 1024)
%10 = load i32, i32* @CG_GetStripEdString.index
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [2 x [1024 x i8]], [2 x [1024 x i8]]* @CG_GetStripEdString.text, i64 0, i64 %11, i64 0
ret i8* %12
}