#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 *getToken(char **point) {
  char *localPoint = *point;
  char *start;
  start = localPoint;
  while (*localPoint != '~' && *localPoint != 0)
    localPoint++;
  if (*localPoint == 0)
    return NULL;
  *localPoint++ = 0;
  *point = localPoint;
  return start;
}


x86 assembly (clang, -O0):
<getToken>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x7e,%ecx
mov    %al,-0x21(%rbp)
je     1140 <getToken+0x40>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1150 <getToken+0x50>
jmp    1161 <getToken+0x61>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111b <getToken+0x1b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    117e <getToken+0x7e>
movq   $0x0,-0x8(%rbp)
jmp    11a3 <getToken+0xa3>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getToken>:
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
nopw   0x0(%rax,%rax,1)
movzbl -0x1(%rcx),%edx
test   %dl,%dl
je     1123 <getToken+0x23>
cmp    $0x7e,%dl
je     1126 <getToken+0x26>
add    $0x1,%rcx
jmp    1110 <getToken+0x10>
xor    %eax,%eax
ret
movb   $0x0,-0x1(%rcx)
mov    %rcx,(%rdi)
ret

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

LLVM IR (-O2):
define i8* @getToken(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %6, %1
%4 = phi i8* [ %2, %1 ], [ %7, %6 ]
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %10
i8 126, label %8
]
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
store i8 0, i8* %4
store i8* %9, i8** %0
br label %10
10: ; preds = %3, %8
%11 = phi i8* [ %2, %8 ], [ null, %3 ]
ret i8* %11
}