#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 */
const char *next_cat(const char *s) {
  int esc;
  esc = 0;
  for (;;)
    switch (*s++) {
    case '\0':
      return (NULL);
    case '\\':
      esc = 1;
      break;
    case ':':
      if (!esc)
        return (s);
    default:
      esc = 0;
      break;
    }
}


x86 assembly (clang, -O0):
<next_cat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     1153 <next_cat+0x53>
jmp    1131 <next_cat+0x31>
mov    -0x18(%rbp),%eax
sub    $0x3a,%eax
je     116c <next_cat+0x6c>
jmp    1142 <next_cat+0x42>
mov    -0x18(%rbp),%eax
sub    $0x5c,%eax
je     1160 <next_cat+0x60>
jmp    1188 <next_cat+0x88>
movq   $0x0,-0x8(%rbp)
jmp    1194 <next_cat+0x94>
movl   $0x1,-0x14(%rbp)
jmp    118f <next_cat+0x8f>
cmpl   $0x0,-0x14(%rbp)
jne    1183 <next_cat+0x83>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1194 <next_cat+0x94>
jmp    1188 <next_cat+0x88>
movl   $0x0,-0x14(%rbp)
jmp    110f <next_cat+0xf>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_cat>:
mov    %rdi,%rax
add    $0x1,%rax
mov    $0x1,%cl
jmp    1116 <next_cat+0x16>
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
add    $0x1,%rax
movsbl -0x1(%rax),%edx
cmp    $0x3a,%edx
je     1130 <next_cat+0x30>
cmp    $0x5c,%edx
je     1110 <next_cat+0x10>
test   %edx,%edx
jne    1135 <next_cat+0x35>
jmp    113d <next_cat+0x3d>
nopw   0x0(%rax,%rax,1)
test   $0x1,%cl
jne    113f <next_cat+0x3f>
mov    $0x1,%cl
add    $0x1,%rax
jmp    1116 <next_cat+0x16>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @next_cat(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
switch i32 %9, label %18 [
i32 0, label %10
i32 92, label %11
i32 58, label %12
]
10: ; preds = %5
store i8* null, i8** %2
br label %20
11: ; preds = %5
store i32 1, i32* %4
br label %19
12: ; preds = %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = load i8*, i8** %3
store i8* %16, i8** %2
br label %20
17: ; preds = %12
br label %18
18: ; preds = %5, %17
store i32 0, i32* %4
br label %19
19: ; preds = %18, %11
br label %5
20: ; preds = %15, %10
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
define i8* @next_cat(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %5, %8 ]
%4 = phi i1 [ true, %1 ], [ %9, %8 ]
%5 = getelementptr inbounds i8, i8* %3, i64 1
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
switch i32 %7, label %11 [
i32 0, label %12
i32 92, label %8
i32 58, label %10
]
8: ; preds = %2, %11
%9 = phi i1 [ false, %2 ], [ true, %11 ]
br label %2
10: ; preds = %2
br i1 %4, label %12, label %11
11: ; preds = %10, %2
br label %8
12: ; preds = %10, %2
%13 = phi i8* [ null, %2 ], [ %5, %10 ]
ret i8* %13
}