#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*/ AddSearchReplacePair(char *, char *);
char *DL_GetIniValue(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void InitUserDefinedSubstitution(void) {
  char *SearchString, *ReplaceString;
  char Tempbuffer[50];
  int i;
  for (i = 1; i < 100; i++) {
    sprintf(Tempbuffer, "XF_USERSUB%02d_SEARCH", i);
    SearchString = DL_GetIniValue(Tempbuffer, NULL);
    sprintf(Tempbuffer, "XF_USERSUB%02d_REPLACE", i);
    ReplaceString = DL_GetIniValue(Tempbuffer, NULL);
    if (SearchString != NULL && ReplaceString != NULL)
      AddSearchReplacePair(SearchString, ReplaceString);
  }
}


x86 assembly (clang, -O0):
<InitUserDefinedSubstitution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x1,-0x54(%rbp)
cmpl   $0x64,-0x54(%rbp)
jge    11c7 <InitUserDefinedSubstitution+0x97>
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xea9(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <DL_GetIniValue@plt>
mov    %rax,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xe9b(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <DL_GetIniValue@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11b4 <InitUserDefinedSubstitution+0x84>
cmpq   $0x0,-0x10(%rbp)
je     11b4 <InitUserDefinedSubstitution+0x84>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <AddSearchReplacePair@plt>
jmp    11b9 <InitUserDefinedSubstitution+0x89>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    113f <InitUserDefinedSubstitution+0xf>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitUserDefinedSubstitution>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    $0x1,%ebx
lea    0xeb7(%rip),%r14
mov    %rsp,%r15
lea    0xec3(%rip),%r12
jmp    1168 <InitUserDefinedSubstitution+0x38>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
cmp    $0x64,%ebx
je     11b0 <InitUserDefinedSubstitution+0x80>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <DL_GetIniValue@plt>
mov    %rax,%r13
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <DL_GetIniValue@plt>
test   %r13,%r13
je     1160 <InitUserDefinedSubstitution+0x30>
test   %rax,%rax
je     1160 <InitUserDefinedSubstitution+0x30>
mov    %r13,%rdi
mov    %rax,%rsi
call   1030 <AddSearchReplacePair@plt>
jmp    1160 <InitUserDefinedSubstitution+0x30>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"XF_USERSUB%02d_SEARCH\00"
@.str.1 = [23 x i8] c"XF_USERSUB%02d_REPLACE\00"
define void @InitUserDefinedSubstitution() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca [50 x i8]
%4 = alloca i32
store i32 1, i32* %4
br label %5
5: ; preds = %29, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%13 = call i8* @DL_GetIniValue(i8* %12, i32* null)
store i8* %13, i8** %1
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%18 = call i8* @DL_GetIniValue(i8* %17, i32* null)
store i8* %18, i8** %2
%19 = load i8*, i8** %1
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %28
21: ; preds = %8
%22 = load i8*, i8** %2
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i8*, i8** %1
%26 = load i8*, i8** %2
%27 = call i32 @AddSearchReplacePair(i8* %25, i8* %26)
br label %28
28: ; preds = %24, %21, %8
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %5
32: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"XF_USERSUB%02d_SEARCH\00"
@.str.1 = [23 x i8] c"XF_USERSUB%02d_REPLACE\00"
define void @InitUserDefinedSubstitution() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %14
%4 = phi i32 [ 1, %0 ], [ %15, %14 ]
%5 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i8* @DL_GetIniValue(i8* %2, i32* null)
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%8 = call i8* @DL_GetIniValue(i8* %2, i32* null)
%9 = icmp ne i8* %6, null
%10 = icmp ne i8* %8, null
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @AddSearchReplacePair(i8* %6, i8* %8)
br label %14
14: ; preds = %3, %12
%15 = add nuw nsw i32 %4, 1
%16 = icmp eq i32 %15, 100
br i1 %16, label %17, label %3
17: ; preds = %14
ret void
}