char *FindNextSubType(char *p) {
  while (*p) {
    if (p[0] == '\\' && p[1])
      p += 2;
    else if (p[0] == ',') {
      if (p[1])
        *p++ = 0;
      return (p);
    } else if (p[0] == '.')
      return (0L);
    else
      p++;
  }
  return (p);
}


x86 assembly (clang, -O0):
<FindNextSubType>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11bc <FindNextSubType+0xbc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1147 <FindNextSubType+0x47>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1147 <FindNextSubType+0x47>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    11b7 <FindNextSubType+0xb7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    1184 <FindNextSubType+0x84>
mov    -0x10(%rbp),%rax
cmpb   $0x0,0x1(%rax)
je     1177 <FindNextSubType+0x77>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11c4 <FindNextSubType+0xc4>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11a1 <FindNextSubType+0xa1>
movq   $0x0,-0x8(%rbp)
jmp    11c4 <FindNextSubType+0xc4>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11b2 <FindNextSubType+0xb2>
jmp    11b7 <FindNextSubType+0xb7>
jmp    1108 <FindNextSubType+0x8>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindNextSubType>:
mov    %rdi,%rax
jmp    1118 <FindNextSubType+0x18>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%ecx
add    %rcx,%rax
movzbl (%rax),%ecx
cmp    $0x5b,%cl
jle    1140 <FindNextSubType+0x40>
cmp    $0x5c,%cl
jne    1110 <FindNextSubType+0x10>
mov    $0x2,%ecx
cmpb   $0x0,0x1(%rax)
je     1110 <FindNextSubType+0x10>
add    %rcx,%rax
jmp    1118 <FindNextSubType+0x18>
cs nopw 0x0(%rax,%rax,1)
nop
test   %cl,%cl
je     1150 <FindNextSubType+0x50>
cmp    $0x2c,%cl
je     1151 <FindNextSubType+0x51>
cmp    $0x2e,%cl
jne    1110 <FindNextSubType+0x10>
xor    %eax,%eax
ret
cmpb   $0x0,0x1(%rax)
je     1150 <FindNextSubType+0x50>
movb   $0x0,(%rax)
add    $0x1,%rax
ret

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

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