#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*/ search_replace_string(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void query_attribute_get_display_where_clause(char *display_where_clause,
                                              char *where_clause,
                                              char *application_name,
                                              char *folder_name) {
  char remove_folder_name_string[1024];
  strcpy(display_where_clause, where_clause);
  search_replace_string(display_where_clause, "1 = 1 and ", "");
  search_replace_string(display_where_clause, "1 = 1", "entire folder");
  sprintf(remove_folder_name_string, "%s_%s.", application_name, folder_name);
  search_replace_string(display_where_clause, remove_folder_name_string, "");
  sprintf(remove_folder_name_string, "%s.", folder_name);
  search_replace_string(display_where_clause, remove_folder_name_string, "");
}


x86 assembly (clang, -O0):
<query_attribute_get_display_where_clause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9d(%rip),%rsi
lea    0xea0(%rip),%rdx
call   1040 <search_replace_string@plt>
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
lea    0xe90(%rip),%rdx
call   1040 <search_replace_string@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
lea    0xe55(%rip),%rdx
call   1040 <search_replace_string@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
lea    0xe25(%rip),%rdx
call   1040 <search_replace_string@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<query_attribute_get_display_where_clause>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rdi,%rbx
call   1030 <strcpy@plt>
lea    0xeab(%rip),%rsi
lea    0xeae(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rdx
call   1040 <search_replace_string@plt>
lea    0xe9d(%rip),%rsi
lea    0xe9c(%rip),%rdx
mov    %rbx,%rdi
call   1040 <search_replace_string@plt>
lea    0xe9b(%rip),%rsi
mov    %rsp,%r13
mov    %r13,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1040 <search_replace_string@plt>
lea    0xe76(%rip),%rsi
mov    %r13,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1040 <search_replace_string@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"1 = 1 and \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [6 x i8] c"1 = 1\00"
@.str.3 = [14 x i8] c"entire folder\00"
@.str.4 = [7 x i8] c"%s_%s.\00"
@.str.5 = [4 x i8] c"%s.\00"
define void @query_attribute_get_display_where_clause(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [1024 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %5
%14 = call i32 @search_replace_string(i8* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8*, i8** %5
%16 = call i32 @search_replace_string(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %18, i8* %19)
%21 = load i8*, i8** %5
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%23 = call i32 @search_replace_string(i8* %21, i8* %22, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%25 = load i8*, i8** %8
%26 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %5
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%29 = call i32 @search_replace_string(i8* %27, i8* %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"1 = 1 and \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [6 x i8] c"1 = 1\00"
@.str.3 = [14 x i8] c"entire folder\00"
@.str.4 = [7 x i8] c"%s_%s.\00"
@.str.5 = [4 x i8] c"%s.\00"
define void @query_attribute_get_display_where_clause(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = tail call i32 @strcpy(i8* %0, i8* %1)
%8 = tail call i32 @search_replace_string(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @search_replace_string(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* %3)
%11 = call i32 @search_replace_string(i8* %0, i8* %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%13 = call i32 @search_replace_string(i8* %0, i8* %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}