#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*/ t;
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
char *strrchr(char *, char);
int /*<<< orphan*/ trap_Cvar_VariableStringBuffer(int /*<<< orphan*/, char *,
                                                  int);
int /*<<< orphan*/ trap_SetConfigstring(int, char *);
int /*<<< orphan*/ va(char *, char *, int);
void bani_getmapxp(void) {
  int j;
  char s[1024];
  char t[1024];
  j = 0;
  trap_Cvar_VariableStringBuffer(va("%s_axismapxp%i", "warpig", j), s,
                                 sizeof(s));
  while (strrchr(s, '+')) {
    j++;
    *strrchr(s, '+') = (char)0;
    trap_Cvar_VariableStringBuffer(va("%s_axismapxp%i", "warpig", j), t,
                                   sizeof(t));
    strcat(s, t);
  }
  trap_SetConfigstring(34, s);
  j = 0;
  trap_Cvar_VariableStringBuffer(va("%s_alliedmapxp%i", "warpig", j), s,
                                 sizeof(s));
  while (strrchr(s, '+')) {
    j++;
    *strrchr(s, '+') = (char)0;
    trap_Cvar_VariableStringBuffer(va("%s_alliedmapxp%i", "warpig", j), t,
                                   sizeof(t));
    strcat(s, t);
  }
  trap_SetConfigstring(35, s);
}


x86 assembly (clang, -O0):
<bani_getmapxp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xe94(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <va@plt>
mov    %eax,%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
lea    -0x410(%rbp),%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
cmp    $0x0,%rax
je     1204 <bani_getmapxp+0xb4>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
movb   $0x0,(%rax)
mov    -0x4(%rbp),%edx
lea    0xe33(%rip),%rdi
lea    0xe3b(%rip),%rsi
call   1050 <va@plt>
mov    %eax,%edi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rsi
call   1060 <strcat@plt>
jmp    118b <bani_getmapxp+0x3b>
lea    -0x410(%rbp),%rsi
mov    $0x22,%edi
call   1070 <trap_SetConfigstring@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xdf0(%rip),%rdi
lea    0xde2(%rip),%rsi
call   1050 <va@plt>
mov    %eax,%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
lea    -0x410(%rbp),%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
cmp    $0x0,%rax
je     12be <bani_getmapxp+0x16e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
movb   $0x0,(%rax)
mov    -0x4(%rbp),%edx
lea    0xd8f(%rip),%rdi
lea    0xd81(%rip),%rsi
call   1050 <va@plt>
mov    %eax,%edi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rsi
call   1060 <strcat@plt>
jmp    1245 <bani_getmapxp+0xf5>
lea    -0x410(%rbp),%rsi
mov    $0x23,%edi
call   1070 <trap_SetConfigstring@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bani_getmapxp>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
lea    0xe99(%rip),%rdi
lea    0xea1(%rip),%rsi
xor    %edx,%edx
call   1050 <va@plt>
mov    %rsp,%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
mov    %rbx,%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     11ff <bani_getmapxp+0xaf>
mov    $0x1,%ebx
lea    0xe5b(%rip),%r14
lea    0xe63(%rip),%r15
lea    0x400(%rsp),%r12
mov    %rsp,%r13
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1050 <va@plt>
mov    %eax,%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %r13,%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    11c0 <bani_getmapxp+0x70>
mov    %rsp,%rbx
mov    $0x22,%edi
mov    %rbx,%rsi
call   1070 <trap_SetConfigstring@plt>
lea    0xe00(%rip),%rdi
lea    0xdf2(%rip),%rsi
xor    %edx,%edx
call   1050 <va@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
mov    %rbx,%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     12af <bani_getmapxp+0x15f>
mov    $0x1,%ebx
lea    0xdc5(%rip),%r14
lea    0xdb7(%rip),%r15
lea    0x400(%rsp),%r12
mov    %rsp,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1050 <va@plt>
mov    %eax,%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <trap_Cvar_VariableStringBuffer@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %r13,%rdi
mov    $0x2b,%esi
call   1030 <strrchr@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1270 <bani_getmapxp+0x120>
mov    %rsp,%rsi
mov    $0x23,%edi
call   1070 <trap_SetConfigstring@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%s_axismapxp%i\00"
@.str.1 = [7 x i8] c"warpig\00"
@.str.2 = [17 x i8] c"%s_alliedmapxp%i\00"
define void @bani_getmapxp() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
store i32 0, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @va(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%7 = call i32 @trap_Cvar_VariableStringBuffer(i32 %5, i8* %6, i32 1024)
br label %8
8: ; preds = %12, %0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i8* @strrchr(i8* %9, i8 signext 43)
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%16 = call i8* @strrchr(i8* %15, i8 signext 43)
store i8 0, i8* %16
%17 = load i32, i32* %1
%18 = call i32 @va(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%20 = call i32 @trap_Cvar_VariableStringBuffer(i32 %18, i8* %19, i32 1024)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%23 = call i32 @strcat(i8* %21, i8* %22)
br label %8
24: ; preds = %8
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%26 = call i32 @trap_SetConfigstring(i32 34, i8* %25)
store i32 0, i32* %1
%27 = load i32, i32* %1
%28 = call i32 @va(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%30 = call i32 @trap_Cvar_VariableStringBuffer(i32 %28, i8* %29, i32 1024)
br label %31
31: ; preds = %35, %24
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%33 = call i8* @strrchr(i8* %32, i8 signext 43)
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %47
35: ; preds = %31
%36 = load i32, i32* %1
%37 = add nsw i32 %36, 1
store i32 %37, i32* %1
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%39 = call i8* @strrchr(i8* %38, i8 signext 43)
store i8 0, i8* %39
%40 = load i32, i32* %1
%41 = call i32 @va(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%43 = call i32 @trap_Cvar_VariableStringBuffer(i32 %41, i8* %42, i32 1024)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%46 = call i32 @strcat(i8* %44, i8* %45)
br label %31
47: ; preds = %31
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%49 = call i32 @trap_SetConfigstring(i32 35, i8* %48)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s_axismapxp%i\00"
@.str.1 = [7 x i8] c"warpig\00"
@.str.2 = [17 x i8] c"%s_alliedmapxp%i\00"
define void @bani_getmapxp() {
%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 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @va(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 0)
%6 = call i32 @trap_Cvar_VariableStringBuffer(i32 %5, i8* %3, i32 1024)
%7 = call i8* @strrchr(i8* %3, i8 signext 43)
%8 = icmp eq i8* %7, null
br i1 %8, label %18, label %9
9: ; preds = %0, %9
%10 = phi i8* [ %16, %9 ], [ %7, %0 ]
%11 = phi i32 [ %12, %9 ], [ 0, %0 ]
%12 = add nuw nsw i32 %11, 1
store i8 0, i8* %10
%13 = call i32 @va(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i32 @trap_Cvar_VariableStringBuffer(i32 %13, i8* %4, i32 1024)
%15 = call i32 @strcat(i8* %3, i8* %4)
%16 = call i8* @strrchr(i8* %3, i8 signext 43)
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %9
18: ; preds = %9, %0
%19 = call i32 @trap_SetConfigstring(i32 34, i8* %3)
%20 = call i32 @va(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 0)
%21 = call i32 @trap_Cvar_VariableStringBuffer(i32 %20, i8* %3, i32 1024)
%22 = call i8* @strrchr(i8* %3, i8 signext 43)
%23 = icmp eq i8* %22, null
br i1 %23, label %33, label %24
24: ; preds = %18, %24
%25 = phi i8* [ %31, %24 ], [ %22, %18 ]
%26 = phi i32 [ %27, %24 ], [ 0, %18 ]
%27 = add nuw nsw i32 %26, 1
store i8 0, i8* %25
%28 = call i32 @va(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = call i32 @trap_Cvar_VariableStringBuffer(i32 %28, i8* %4, i32 1024)
%30 = call i32 @strcat(i8* %3, i8* %4)
%31 = call i8* @strrchr(i8* %3, i8 signext 43)
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %24
33: ; preds = %24, %18
%34 = call i32 @trap_SetConfigstring(i32 35, i8* %3)
ret void
}