void cJSONUtils_InplaceDecodePointerString(char *string) {
  char *s2 = string;
  for (; *string; s2++, string++)
    *s2 = (*string != '~') ? (*string) : ((*(++string) == '0') ? '~' : '/');
  *s2 = 0;
}


x86 assembly (clang, -O0):
<cJSONUtils_InplaceDecodePointerString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     118a <cJSONUtils_InplaceDecodePointerString+0x8a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7e,%eax
je     113c <cJSONUtils_InplaceDecodePointerString+0x3c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <cJSONUtils_InplaceDecodePointerString+0x62>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl 0x1(%rax),%edx
mov    $0x2f,%eax
mov    $0x7e,%ecx
cmp    $0x30,%edx
cmove  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <cJSONUtils_InplaceDecodePointerString+0x10>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cJSONUtils_InplaceDecodePointerString>:
mov    $0x7e,%eax
mov    %rdi,%rcx
jmp    112a <cJSONUtils_InplaceDecodePointerString+0x2a>
nopw   0x0(%rax,%rax,1)
cmpb   $0x30,0x1(%rdi)
lea    0x1(%rdi),%rdi
mov    $0x2f,%edx
cmove  %eax,%edx
mov    %dl,(%rcx)
add    $0x1,%rcx
add    $0x1,%rdi
movzbl (%rdi),%edx
cmp    $0x7e,%dl
je     1110 <cJSONUtils_InplaceDecodePointerString+0x10>
test   %dl,%dl
jne    1120 <cJSONUtils_InplaceDecodePointerString+0x20>
movb   $0x0,(%rcx)
ret

LLVM IR (-O0):
define void @cJSONUtils_InplaceDecodePointerString(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %30, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %35
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 126
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
br label %26
18: ; preds = %9
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 48
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 126, i32 47
br label %26
26: ; preds = %18, %14
%27 = phi i32 [ %17, %14 ], [ %25, %18 ]
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %3
store i8 %28, i8* %29
br label %30
30: ; preds = %26
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
%33 = load i8*, i8** %2
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %2
br label %5
35: ; preds = %5
%36 = load i8*, i8** %3
store i8 0, i8* %36
ret void
}

LLVM IR (-O2):
define void @cJSONUtils_InplaceDecodePointerString(i8* nocapture %0) {
br label %2
2: ; preds = %11, %1
%3 = phi i8* [ %0, %1 ], [ %15, %11 ]
%4 = phi i8* [ %0, %1 ], [ %14, %11 ]
%5 = load i8, i8* %3
switch i8 %5, label %11 [
i8 0, label %16
i8 126, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 48
%10 = select i1 %9, i8 126, i8 47
br label %11
11: ; preds = %2, %6
%12 = phi i8* [ %7, %6 ], [ %3, %2 ]
%13 = phi i8 [ %10, %6 ], [ %5, %2 ]
store i8 %13, i8* %4
%14 = getelementptr inbounds i8, i8* %4, i64 1
%15 = getelementptr inbounds i8, i8* %12, i64 1
br label %2
16: ; preds = %2
store i8 0, i8* %4
ret void
}