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

/* Variables and functions */
scalar_t__ strcmp(char *, char const *);
int /*<<< orphan*/ trap_GetConfigstring(int, char *, int);
int /*<<< orphan*/ trap_SetConfigstring(int, char *);
void G_RemoveConfigstringIndex(const char *name, int start, int max) {
  int i, j;
  char s[1024];
  if (!name || !name[0]) {
    return;
  }
  for (i = 1; i < max; i++) {
    trap_GetConfigstring(start + i, s, sizeof(s));
    if (!s[0]) {
      break;
    }
    if (strcmp(s, name) == 0) {
      trap_SetConfigstring(start + i, "");
      for (j = i + 1; j < max - 1; j++) {
        trap_GetConfigstring(start + j, s, sizeof(s));
        trap_SetConfigstring(start + j, "");
        trap_SetConfigstring(start + i, s);
      }
      break;
    }
  }
}


x86 assembly (clang, -O0):
<G_RemoveConfigstringIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115d <G_RemoveConfigstringIndex+0x2d>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1162 <G_RemoveConfigstringIndex+0x32>
jmp    1245 <G_RemoveConfigstringIndex+0x115>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1245 <G_RemoveConfigstringIndex+0x115>
mov    -0xc(%rbp),%edi
add    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1040 <trap_GetConfigstring@plt>
cmpb   $0x0,-0x420(%rbp)
jne    119e <G_RemoveConfigstringIndex+0x6e>
jmp    1245 <G_RemoveConfigstringIndex+0x115>
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1232 <G_RemoveConfigstringIndex+0x102>
mov    -0xc(%rbp),%edi
add    -0x14(%rbp),%edi
lea    0xe3b(%rip),%rsi
call   1050 <trap_SetConfigstring@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    122d <G_RemoveConfigstringIndex+0xfd>
mov    -0xc(%rbp),%edi
add    -0x18(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1040 <trap_GetConfigstring@plt>
mov    -0xc(%rbp),%edi
add    -0x18(%rbp),%edi
lea    0xdf8(%rip),%rsi
call   1050 <trap_SetConfigstring@plt>
mov    -0xc(%rbp),%edi
add    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
call   1050 <trap_SetConfigstring@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d3 <G_RemoveConfigstringIndex+0xa3>
jmp    1245 <G_RemoveConfigstringIndex+0x115>
jmp    1237 <G_RemoveConfigstringIndex+0x107>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <G_RemoveConfigstringIndex+0x39>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G_RemoveConfigstringIndex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rdx,0x8(%rsp)
test   %rdi,%rdi
je     121c <G_RemoveConfigstringIndex+0xec>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
je     121c <G_RemoveConfigstringIndex+0xec>
cmpl   $0x2,0x8(%rsp)
jl     121c <G_RemoveConfigstringIndex+0xec>
mov    %esi,%ebx
mov    0x8(%rsp),%rax
lea    -0x3(%rax),%ebp
add    $0x2,%ebx
mov    $0x2,%r14d
lea    0x10(%rsp),%r12
xchg   %ax,%ax
lea    -0x1(%rbx),%r13d
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <trap_GetConfigstring@plt>
cmpb   $0x0,0x10(%rsp)
je     121c <G_RemoveConfigstringIndex+0xec>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11c0 <G_RemoveConfigstringIndex+0x90>
add    $0xffffffff,%ebp
add    $0x1,%ebx
add    $0x1,%r14d
cmp    $0xfffffffe,%ebp
jne    1180 <G_RemoveConfigstringIndex+0x50>
jmp    121c <G_RemoveConfigstringIndex+0xec>
lea    0xe39(%rip),%rsi
mov    %r13d,%edi
call   1050 <trap_SetConfigstring@plt>
mov    0x8(%rsp),%rax
add    $0xffffffff,%eax
cmp    %eax,%r14d
jge    121c <G_RemoveConfigstringIndex+0xec>
lea    0x10(%rsp),%r14
lea    0xe18(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1040 <trap_GetConfigstring@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <trap_SetConfigstring@plt>
mov    %r13d,%edi
mov    %r14,%rsi
call   1050 <trap_SetConfigstring@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    11f0 <G_RemoveConfigstringIndex+0xc0>
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @G_RemoveConfigstringIndex(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1024 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %12, %3
br label %73
18: ; preds = %12
store i32 1, i32* %7
br label %19
19: ; preds = %70, %18
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %73
23: ; preds = %19
%24 = load i32, i32* %5
%25 = load i32, i32* %7
%26 = add nsw i32 %24, %25
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%28 = call i32 @trap_GetConfigstring(i32 %26, i8* %27, i32 1024)
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%30 = load i8, i8* %29
%31 = icmp ne i8 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %23
br label %73
33: ; preds = %23
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%35 = load i8*, i8** %4
%36 = call i64 @strcmp(i8* %34, i8* %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %69
38: ; preds = %33
%39 = load i32, i32* %5
%40 = load i32, i32* %7
%41 = add nsw i32 %39, %40
%42 = call i32 @trap_SetConfigstring(i32 %41, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %8
br label %45
45: ; preds = %65, %38
%46 = load i32, i32* %8
%47 = load i32, i32* %6
%48 = sub nsw i32 %47, 1
%49 = icmp slt i32 %46, %48
br i1 %49, label %50, label %68
50: ; preds = %45
%51 = load i32, i32* %5
%52 = load i32, i32* %8
%53 = add nsw i32 %51, %52
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%55 = call i32 @trap_GetConfigstring(i32 %53, i8* %54, i32 1024)
%56 = load i32, i32* %5
%57 = load i32, i32* %8
%58 = add nsw i32 %56, %57
%59 = call i32 @trap_SetConfigstring(i32 %58, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%60 = load i32, i32* %5
%61 = load i32, i32* %7
%62 = add nsw i32 %60, %61
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%64 = call i32 @trap_SetConfigstring(i32 %62, i8* %63)
br label %65
65: ; preds = %50
%66 = load i32, i32* %8
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
br label %45
68: ; preds = %45
br label %73
69: ; preds = %33
br label %70
70: ; preds = %69
%71 = load i32, i32* %7
%72 = add nsw i32 %71, 1
store i32 %72, i32* %7
br label %19
73: ; preds = %17, %68, %32, %19
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @G_RemoveConfigstringIndex(i8* %0, i32 %1, i32 %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = icmp eq i8* %0, null
br i1 %6, label %37, label %7
7: ; preds = %3
%8 = load i8, i8* %0
%9 = icmp ne i8 %8, 0
%10 = icmp sgt i32 %2, 1
%11 = and i1 %9, %10
br i1 %11, label %12, label %37
12: ; preds = %7, %34
%13 = phi i32 [ %35, %34 ], [ 1, %7 ]
%14 = add nsw i32 %13, %1
%15 = call i32 @trap_GetConfigstring(i32 %14, i8* %5, i32 1024)
%16 = load i8, i8* %5
%17 = icmp eq i8 %16, 0
br i1 %17, label %37, label %18
18: ; preds = %12
%19 = call i64 @strcmp(i8* %5, i8* %0)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %34
21: ; preds = %18
%22 = call i32 @trap_SetConfigstring(i32 %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%23 = add i32 %2, -1
%24 = add nuw nsw i32 %13, 1
%25 = icmp slt i32 %24, %23
br i1 %25, label %26, label %37
26: ; preds = %21, %26
%27 = phi i32 [ %32, %26 ], [ %24, %21 ]
%28 = add nsw i32 %27, %1
%29 = call i32 @trap_GetConfigstring(i32 %28, i8* %5, i32 1024)
%30 = call i32 @trap_SetConfigstring(i32 %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @trap_SetConfigstring(i32 %14, i8* %5)
%32 = add nuw nsw i32 %27, 1
%33 = icmp eq i32 %32, %23
br i1 %33, label %37, label %26
34: ; preds = %18
%35 = add nuw nsw i32 %13, 1
%36 = icmp eq i32 %35, %2
br i1 %36, label %37, label %12
37: ; preds = %12, %34, %26, %21, %3, %7
ret void
}