#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*/ escape_character(char *, char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
void escape_special_characters(char *data) {
  char buffer[4096];
  if (!*data)
    return;
  strcpy(buffer, data);
  escape_character(data, buffer, '=');
  strcpy(buffer, data);
  escape_character(data, buffer, '\'');
  strcpy(buffer, data);
  escape_character(data, buffer, '$');
  strcpy(buffer, data);
  escape_character(data, buffer, '&');
  strcpy(buffer, data);
  escape_character(data, buffer, '`');
}


x86 assembly (clang, -O0):
<escape_special_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1141 <escape_special_characters+0x21>
jmp    11fa <escape_special_characters+0xda>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
mov    $0x3d,%edx
call   1040 <escape_character@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
mov    $0x27,%edx
call   1040 <escape_character@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
mov    $0x24,%edx
call   1040 <escape_character@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
mov    $0x26,%edx
call   1040 <escape_character@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
mov    $0x60,%edx
call   1040 <escape_character@plt>
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escape_special_characters>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
cmpb   $0x0,(%rdi)
je     11c0 <escape_special_characters+0xa0>
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3d,%edx
call   1040 <escape_character@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x27,%edx
call   1040 <escape_character@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x24,%edx
call   1040 <escape_character@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x26,%edx
call   1040 <escape_character@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x60,%edx
call   1040 <escape_character@plt>
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @escape_special_characters(i8* %0) {
%2 = alloca i8*
%3 = alloca [4096 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
br label %39
8: ; preds = %1
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %2
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%14 = call i32 @escape_character(i8* %12, i8* %13, i8 signext 61)
%15 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%16 = load i8*, i8** %2
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = load i8*, i8** %2
%19 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%20 = call i32 @escape_character(i8* %18, i8* %19, i8 signext 39)
%21 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%22 = load i8*, i8** %2
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = load i8*, i8** %2
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%26 = call i32 @escape_character(i8* %24, i8* %25, i8 signext 36)
%27 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%28 = load i8*, i8** %2
%29 = call i32 @strcpy(i8* %27, i8* %28)
%30 = load i8*, i8** %2
%31 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%32 = call i32 @escape_character(i8* %30, i8* %31, i8 signext 38)
%33 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%34 = load i8*, i8** %2
%35 = call i32 @strcpy(i8* %33, i8* %34)
%36 = load i8*, i8** %2
%37 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%38 = call i32 @escape_character(i8* %36, i8* %37, i8 signext 96)
br label %39
39: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
define void @escape_special_characters(i8* %0) {
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %1
%7 = call i32 @strcpy(i8* %3, i8* %0)
%8 = call i32 @escape_character(i8* %0, i8* %3, i8 signext 61)
%9 = call i32 @strcpy(i8* %3, i8* %0)
%10 = call i32 @escape_character(i8* %0, i8* %3, i8 signext 39)
%11 = call i32 @strcpy(i8* %3, i8* %0)
%12 = call i32 @escape_character(i8* %0, i8* %3, i8 signext 36)
%13 = call i32 @strcpy(i8* %3, i8* %0)
%14 = call i32 @escape_character(i8* %0, i8* %3, i8 signext 38)
%15 = call i32 @strcpy(i8* %3, i8* %0)
%16 = call i32 @escape_character(i8* %0, i8* %3, i8 signext 96)
br label %17
17: ; preds = %1, %6
ret void
}