#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 */
scalar_t__ character_exists(char *, char);
int /*<<< orphan*/ search_replace_string(char *, char *, char *);
void convert_folder_data_delimiter(char *data, char *key) {
  if (!character_exists(key, '^') && character_exists(data, '^')) {
    char search[2] = {0};
    *search = '^';
    search_replace_string(data, search, "**");
  }
}


x86 assembly (clang, -O0):
<convert_folder_data_delimiter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5e,%esi
call   1040 <character_exists@plt>
cmp    $0x0,%rax
jne    1198 <convert_folder_data_delimiter+0x68>
mov    -0x8(%rbp),%rdi
mov    $0x5e,%esi
call   1040 <character_exists@plt>
cmp    $0x0,%rax
je     1198 <convert_folder_data_delimiter+0x68>
lea    -0x12(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1050 <memset@plt>
movb   $0x5e,-0x12(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x12(%rbp),%rsi
lea    0xe6d(%rip),%rdx
call   1030 <search_replace_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_folder_data_delimiter>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    $0x5e,%esi
call   1040 <character_exists@plt>
test   %rax,%rax
jne    1167 <convert_folder_data_delimiter+0x47>
mov    %rbx,%rdi
mov    $0x5e,%esi
call   1040 <character_exists@plt>
test   %rax,%rax
je     1167 <convert_folder_data_delimiter+0x47>
movw   $0x5e,0xe(%rsp)
lea    0xea6(%rip),%rdx
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <search_replace_string@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"**\00"
define void @convert_folder_data_delimiter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [2 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @character_exists(i8* %6, i8 signext 94)
%8 = icmp ne i64 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i64 @character_exists(i8* %10, i8 signext 94)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = bitcast [2 x i8]* %5 to i8*
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 94, i8* %15
%16 = load i8*, i8** %3
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%18 = call i32 @search_replace_string(i8* %16, i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %13, %9, %2
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"**\00"
define void @convert_folder_data_delimiter(i8* %0, i8* %1) {
%3 = alloca i16
%4 = tail call i64 @character_exists(i8* %1, i8 signext 94)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = tail call i64 @character_exists(i8* %0, i8 signext 94)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = bitcast i16* %3 to i8*
store i16 94, i16* %3
%11 = call i32 @search_replace_string(i8* %0, i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %6, %2
ret void
}