#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*/ string_escape_character(char *, char *, char);
int /*<<< orphan*/ string_strcpy(char *, char *, int);
char *string_escape_character_array(char *destination, char *source,
                                    char *character_array) {
  char local_source[131072];
  string_strcpy(local_source, source, 131072);
  while (*character_array) {
    string_escape_character(destination, local_source, *character_array);
    character_array++;
    if (*character_array) {
      string_strcpy(local_source, destination, 131072);
    }
  }
  return destination;
}


x86 assembly (clang, -O0):
<string_escape_character_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20020,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x20020(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x20000,%edx
call   1040 <string_strcpy@plt>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a3 <string_escape_character_array+0x83>
mov    -0x8(%rbp),%rdi
lea    -0x20020(%rbp),%rsi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
call   1030 <string_escape_character@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     119e <string_escape_character_array+0x7e>
lea    -0x20020(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x20000,%edx
call   1040 <string_strcpy@plt>
jmp    114c <string_escape_character_array+0x2c>
mov    -0x8(%rbp),%rax
add    $0x20020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_escape_character_array>:
push   %r15
push   %r14
push   %rbx
sub    $0x20000,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rsp,%rdi
mov    $0x20000,%edx
call   1040 <string_strcpy@plt>
mov    (%rbx),%al
test   %al,%al
je     117e <string_escape_character_array+0x5e>
add    $0x1,%rbx
mov    %rsp,%r15
nopl   0x0(%rax)
movsbl %al,%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <string_escape_character@plt>
cmpb   $0x0,(%rbx)
je     117e <string_escape_character_array+0x5e>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x20000,%edx
call   1040 <string_strcpy@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <string_escape_character_array+0x30>
mov    %r14,%rax
add    $0x20000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @string_escape_character_array(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [131072 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [131072 x i8], [131072 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = call i32 @string_strcpy(i8* %8, i8* %9, i32 131072)
br label %11
11: ; preds = %30, %3
%12 = load i8*, i8** %6
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = getelementptr inbounds [131072 x i8], [131072 x i8]* %7, i64 0, i64 0
%18 = load i8*, i8** %6
%19 = load i8, i8* %18
%20 = call i32 @string_escape_character(i8* %16, i8* %17, i8 signext %19)
%21 = load i8*, i8** %6
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = load i8, i8* %23
%25 = icmp ne i8 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %15
%27 = getelementptr inbounds [131072 x i8], [131072 x i8]* %7, i64 0, i64 0
%28 = load i8*, i8** %4
%29 = call i32 @string_strcpy(i8* %27, i8* %28, i32 131072)
br label %30
30: ; preds = %26, %15
br label %11
31: ; preds = %11
%32 = load i8*, i8** %4
ret i8* %32
}

LLVM IR (-O2):
define i8* @string_escape_character_array(i8* returned %0, i8* %1, i8* nocapture %2) {
%4 = alloca [131072 x i8]
%5 = getelementptr inbounds [131072 x i8], [131072 x i8]* %4, i64 0, i64 0
%6 = call i32 @string_strcpy(i8* %5, i8* %1, i32 131072)
%7 = load i8, i8* %2
%8 = icmp eq i8 %7, 0
br i1 %8, label %20, label %9
9: ; preds = %3, %16
%10 = phi i8 [ %18, %16 ], [ %7, %3 ]
%11 = phi i8* [ %13, %16 ], [ %2, %3 ]
%12 = call i32 @string_escape_character(i8* %0, i8* %5, i8 signext %10)
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %9
%17 = call i32 @string_strcpy(i8* %5, i8* %0, i32 131072)
%18 = load i8, i8* %13
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %9
20: ; preds = %9, %16, %3
ret i8* %0
}