#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 */
scalar_t__ isalnum(char const);
void SkipColorCodes(const char **text, char *lastColor) {
  while (((*text) && *(*text) == '^' && *((*text) + 1) &&
          isalnum(*((*text) + 1)))) {
    lastColor[0] = (*text)[0];
    lastColor[1] = (*text)[1];
    (*text) += 2;
  }
}


x86 assembly (clang, -O0):
<SkipColorCodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x11(%rbp)
je     117e <SkipColorCodes+0x6e>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x5e,%ecx
mov    %al,-0x11(%rbp)
jne    117e <SkipColorCodes+0x6e>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     117e <SkipColorCodes+0x6e>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    118e <SkipColorCodes+0x7e>
jmp    11c1 <SkipColorCodes+0xb1>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
jmp    1120 <SkipColorCodes+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SkipColorCodes>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rax
test   %rax,%rax
je     1169 <SkipColorCodes+0x59>
cmpb   $0x5e,(%rax)
jne    1169 <SkipColorCodes+0x59>
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%eax
test   %al,%al
je     1169 <SkipColorCodes+0x59>
movsbl %al,%edi
call   1030 <isalnum@plt>
test   %rax,%rax
je     1169 <SkipColorCodes+0x59>
mov    (%rbx),%rax
movzbl (%rax),%eax
mov    %al,(%r14)
mov    (%rbx),%rax
movzbl 0x1(%rax),%eax
mov    %al,0x1(%r14)
mov    (%rbx),%rcx
lea    0x2(%rcx),%rax
mov    %rax,(%rbx)
cmpb   $0x5e,0x2(%rcx)
je     1130 <SkipColorCodes+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @SkipColorCodes(i8** nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %27, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %1, i64 1
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 94
br i1 %8, label %9, label %27
9: ; preds = %5, %17
%10 = phi i8* [ %24, %17 ], [ %3, %5 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %9
%15 = tail call i64 @isalnum(i8 signext %12)
%16 = icmp eq i64 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = load i8*, i8** %0
%19 = load i8, i8* %18
store i8 %19, i8* %1
%20 = load i8*, i8** %0
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
store i8 %22, i8* %6
%23 = load i8*, i8** %0
%24 = getelementptr inbounds i8, i8* %23, i64 2
store i8* %24, i8** %0
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 94
br i1 %26, label %9, label %27
27: ; preds = %17, %9, %14, %5, %2
ret void
}