#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 */
char *strdup(char *);
char *string_escape_character_array(char *, char *, char *);
char *security_sql_injection_escape(char *data) {
  char destination[131072];
  if (!data || !*data)
    return strdup("");
  return strdup(string_escape_character_array(destination, data, "`'$;%&="));
}


x86 assembly (clang, -O0):
<security_sql_injection_escape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20010,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1147 <security_sql_injection_escape+0x27>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    115c <security_sql_injection_escape+0x3c>
lea    0xeb9(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    117f <security_sql_injection_escape+0x5f>
lea    -0x20010(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe92(%rip),%rdx
call   1030 <string_escape_character_array@plt>
mov    %rax,%rdi
call   1040 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<security_sql_injection_escape>:
sub    $0x20008,%rsp
test   %rdi,%rdi
je     1153 <security_sql_injection_escape+0x33>
mov    %rdi,%rsi
cmpb   $0x0,(%rdi)
je     1153 <security_sql_injection_escape+0x33>
lea    0xec5(%rip),%rdx
mov    %rsp,%rdi
call   1030 <string_escape_character_array@plt>
mov    %rax,%rdi
call   1040 <strdup@plt>
add    $0x20008,%rsp
ret
lea    0xead(%rip),%rdi
add    $0x20008,%rsp
jmp    1040 <strdup@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"`'$;%&=\00"
define i8* @security_sql_injection_escape(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [131072 x i8]
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7, %1
%12 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %2
br label %18
13: ; preds = %7
%14 = getelementptr inbounds [131072 x i8], [131072 x i8]* %4, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = call i8* @string_escape_character_array(i8* %14, i8* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%17 = call i8* @strdup(i8* %16)
store i8* %17, i8** %2
br label %18
18: ; preds = %13, %11
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"`'$;%&=\00"
define noalias i8* @security_sql_injection_escape(i8* %0) {
%2 = alloca [131072 x i8]
%3 = getelementptr inbounds [131072 x i8], [131072 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5, %1
%9 = tail call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %5
%11 = call i8* @string_escape_character_array(i8* %3, i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = call i8* @strdup(i8* %11)
br label %13
13: ; preds = %10, %8
%14 = phi i8* [ %12, %10 ], [ %9, %8 ]
ret i8* %14
}