#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 */
typedef int /*<<< orphan*/ SPACE_MARK;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *EscapeSpaceDependency(const char *name) {
  static char buffer[8 * 1024];
  static const char SPACE_MARK[] = "__&NBSP;__";
  char *bp = buffer;
  const char *np = name;
  while (*np) {
    if (*np == ' ') {
      memcpy(bp, SPACE_MARK, sizeof(SPACE_MARK));
      bp += sizeof(SPACE_MARK) - 1;
    } else {
      *bp = *np;
      bp++;
    }
    np++;
  }
  *bp = 0;
  return buffer;
}


x86 assembly (clang, -O0):
<EscapeSpaceDependency>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     119b <EscapeSpaceDependency+0x8b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1172 <EscapeSpaceDependency+0x62>
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0xb,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x10(%rbp)
jmp    118a <EscapeSpaceDependency+0x7a>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112f <EscapeSpaceDependency+0x1f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2e97(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EscapeSpaceDependency>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0x2f21(%rip),%r14
lea    0xeda(%rip),%r15
jmp    114c <EscapeSpaceDependency+0x3c>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0xb,%edx
call   1030 <memcpy@plt>
mov    $0xa,%eax
add    %rax,%r14
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1130 <EscapeSpaceDependency+0x20>
test   %al,%al
je     1161 <EscapeSpaceDependency+0x51>
mov    %al,(%r14)
mov    $0x1,%eax
jmp    1145 <EscapeSpaceDependency+0x35>
movb   $0x0,(%r14)
lea    0x2ed4(%rip),%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EscapeSpaceDependency.buffer = internal global [8192 x i8] zeroinitializer
@EscapeSpaceDependency.SPACE_MARK = internal constant [11 x i8] c"__&NBSP;__\00"
define i8* @EscapeSpaceDependency(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @EscapeSpaceDependency.buffer, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %2
store i8* %5, i8** %4
br label %6
6: ; preds = %26, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = call i32 @memcpy(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @EscapeSpaceDependency.SPACE_MARK, i64 0, i64 0), i32 11)
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 10
store i8* %19, i8** %3
br label %26
20: ; preds = %10
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = load i8*, i8** %3
store i8 %22, i8* %23
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
br label %26
26: ; preds = %20, %15
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %4
br label %6
29: ; preds = %6
%30 = load i8*, i8** %3
store i8 0, i8* %30
ret i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @EscapeSpaceDependency.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@EscapeSpaceDependency.buffer = internal global [8192 x i8] zeroinitializer
@EscapeSpaceDependency.SPACE_MARK = internal constant [11 x i8] c"__&NBSP;__\00"
define i8* @EscapeSpaceDependency(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @EscapeSpaceDependency.buffer, i64 0, i64 0), %1 ], [ %11, %9 ]
%4 = phi i8* [ %0, %1 ], [ %12, %9 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %13
i8 32, label %6
]
6: ; preds = %2
%7 = tail call i32 @memcpy(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @EscapeSpaceDependency.SPACE_MARK, i64 0, i64 0), i32 11)
br label %9
8: ; preds = %2
store i8 %5, i8* %3
br label %9
9: ; preds = %8, %6
%10 = phi i64 [ 1, %8 ], [ 10, %6 ]
%11 = getelementptr inbounds i8, i8* %3, i64 %10
%12 = getelementptr inbounds i8, i8* %4, i64 1
br label %2
13: ; preds = %2
store i8 0, i8* %3
ret i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @EscapeSpaceDependency.buffer, i64 0, i64 0)
}