#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 *_ircprot_skip_spaces(char *);
int _ircprot_count_params(char *message) {
  char *ptr;
  int count;
  count = 0;
  ptr = message;
  while (*ptr) {
    count++;
    if (*ptr == ':')
      break;
    while (*ptr && (*ptr != ' '))
      ptr++;
    ptr = _ircprot_skip_spaces(ptr);
  }
  return count;
}


x86 assembly (clang, -O0):
<_ircprot_count_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b3 <_ircprot_count_params+0xa3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1156 <_ircprot_count_params+0x46>
jmp    11b3 <_ircprot_count_params+0xa3>
jmp    115b <_ircprot_count_params+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     1180 <_ircprot_count_params+0x70>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1190 <_ircprot_count_params+0x80>
jmp    11a1 <_ircprot_count_params+0x91>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115b <_ircprot_count_params+0x4b>
mov    -0x10(%rbp),%rdi
call   1030 <_ircprot_skip_spaces@plt>
mov    %rax,-0x10(%rbp)
jmp    112b <_ircprot_count_params+0x1b>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ircprot_count_params>:
push   %rbx
mov    (%rdi),%cl
test   %cl,%cl
je     1154 <_ircprot_count_params+0x44>
mov    %rdi,%rax
xor    %ebx,%ebx
jmp    112e <_ircprot_count_params+0x1e>
xchg   %ax,%ax
mov    %rax,%rdi
call   1030 <_ircprot_skip_spaces@plt>
mov    (%rax),%cl
test   %cl,%cl
je     1156 <_ircprot_count_params+0x46>
add    $0x1,%ebx
cmp    $0x3a,%cl
je     1156 <_ircprot_count_params+0x46>
cs nopw 0x0(%rax,%rax,1)
test   $0xdf,%cl
je     1120 <_ircprot_count_params+0x10>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   $0xdf,%cl
jne    1145 <_ircprot_count_params+0x35>
jmp    1120 <_ircprot_count_params+0x10>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @_ircprot_count_params(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %20, label %4
4: ; preds = %1, %16
%5 = phi i8 [ %18, %16 ], [ %2, %1 ]
%6 = phi i32 [ %8, %16 ], [ 0, %1 ]
%7 = phi i8* [ %17, %16 ], [ %0, %1 ]
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i8 %5, 58
br i1 %9, label %20, label %10
10: ; preds = %4, %13
%11 = phi i8 [ %15, %13 ], [ %5, %4 ]
%12 = phi i8* [ %14, %13 ], [ %7, %4 ]
switch i8 %11, label %13 [
i8 0, label %16
i8 32, label %16
]
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %12, i64 1
%15 = load i8, i8* %14
br label %10
16: ; preds = %10, %10
%17 = tail call i8* @_ircprot_skip_spaces(i8* %12)
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %4
20: ; preds = %16, %4, %1
%21 = phi i32 [ 0, %1 ], [ %8, %4 ], [ %8, %16 ]
ret i32 %21
}