#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 */
size_t _get_suite_name_length(const char *name) {
  size_t ret = 0;
  while (*name) {
    if (*name == ':') {
      name++;
      ret++;
      if (*name == ':') {
        return ret - 1;
      }
    } else {
      ret++;
      name++;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<_get_suite_name_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1188 <_get_suite_name_length+0x88>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    116b <_get_suite_name_length+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1166 <_get_suite_name_length+0x66>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1190 <_get_suite_name_length+0x90>
jmp    1183 <_get_suite_name_length+0x83>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <_get_suite_name_length+0x10>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_suite_name_length>:
xor    %eax,%eax
jmp    111e <_get_suite_name_length+0x1e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x3a,0x1(%rdi)
je     112a <_get_suite_name_length+0x2a>
add    $0x1,%rdi
add    $0x1,%rax
movzbl (%rdi),%ecx
cmp    $0x3a,%cl
je     1110 <_get_suite_name_length+0x10>
test   %cl,%cl
jne    1116 <_get_suite_name_length+0x16>
ret

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

LLVM IR (-O2):
define i64 @_get_suite_name_length(i8* nocapture %0) {
br label %2
2: ; preds = %12, %1
%3 = phi i8* [ %0, %1 ], [ %13, %12 ]
%4 = phi i64 [ 0, %1 ], [ %14, %12 ]
%5 = load i8, i8* %3
switch i8 %5, label %10 [
i8 0, label %15
i8 58, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 58
br i1 %9, label %15, label %12
10: ; preds = %2
%11 = getelementptr inbounds i8, i8* %3, i64 1
br label %12
12: ; preds = %6, %10
%13 = phi i8* [ %7, %6 ], [ %11, %10 ]
%14 = add i64 %4, 1
br label %2
15: ; preds = %2, %6
ret i64 %4
}