#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 */
void cJSONUtils_InplaceDecodePointerString(unsigned char *string) {
  unsigned char *s2 = string;
  if (string == NULL) {
    return;
  }
  for (; *string; (void)s2++, string++) {
    *s2 =
        (unsigned char)((*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)
cmpq   $0x0,-0x8(%rbp)
jne    1120 <cJSONUtils_InplaceDecodePointerString+0x20>
jmp    11a6 <cJSONUtils_InplaceDecodePointerString+0xa6>
jmp    1125 <cJSONUtils_InplaceDecodePointerString+0x25>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     119f <cJSONUtils_InplaceDecodePointerString+0x9f>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x7e,%eax
je     1151 <cJSONUtils_InplaceDecodePointerString+0x51>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <cJSONUtils_InplaceDecodePointerString+0x77>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl 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    1125 <cJSONUtils_InplaceDecodePointerString+0x25>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cJSONUtils_InplaceDecodePointerString>:
test   %rdi,%rdi
je     1139 <cJSONUtils_InplaceDecodePointerString+0x39>
mov    $0x7e,%eax
mov    %rdi,%rcx
jmp    112a <cJSONUtils_InplaceDecodePointerString+0x2a>
nop
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
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
br label %41
8: ; preds = %1
br label %9
9: ; preds = %34, %8
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %39
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = icmp ne i32 %16, 126
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
br label %30
22: ; preds = %13
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %2
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = icmp eq i32 %26, 48
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 126, i32 47
br label %30
30: ; preds = %22, %18
%31 = phi i32 [ %21, %18 ], [ %29, %22 ]
%32 = trunc i32 %31 to i8
%33 = load i8*, i8** %3
store i8 %32, i8* %33
br label %34
34: ; preds = %30
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %3
%37 = load i8*, i8** %2
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %2
br label %9
39: ; preds = %9
%40 = load i8*, i8** %3
store i8 0, i8* %40
br label %41
41: ; preds = %39, %7
ret void
}

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