#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 *strchr(char const *, int);
scalar_t__ strncasecmp(char const *, char *, int);
void count_multi(const char *data, unsigned int *modes_left) {
  if (data == NULL)
    goto out;
  while (*data == ' ')
    data++;
  data = strchr(data, ' ');
  if (data == NULL)
    goto out;
  while (*data == ' ')
    data++;
  if (strncasecmp(data, "MODE ", 5) == 0) {
    *modes_left = 0;
    data += 5;
    data = strchr(data, (int)' ');
    if (data == NULL)
      return;
    while (*data == ' ')
      data++;
    if (data == NULL || (*data != '+' && *data != '-'))
      goto out;
    while (*data != '\0') {
      if (*data == '+' || *data == '-') {
        while (*data != ' ' && *data != '\0') {
          if (*data != '+' && *data != '-')
            ++*modes_left;
          data++;
        }
      } else
        while (*data != '+' && *data != '-' && *data != '\0')
          data++;
    }
  }
  return;
out:
  *modes_left = 1;
  return;
}


x86 assembly (clang, -O0):
<count_multi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1140 <count_multi+0x20>
jmp    137f <count_multi+0x25f>
jmp    1145 <count_multi+0x25>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1166 <count_multi+0x46>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1145 <count_multi+0x25>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1188 <count_multi+0x68>
jmp    137f <count_multi+0x25f>
jmp    118d <count_multi+0x6d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11ae <count_multi+0x8e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    118d <count_multi+0x6d>
mov    -0x8(%rbp),%rdi
lea    0xe47(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    137a <count_multi+0x25a>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1205 <count_multi+0xe5>
jmp    1389 <count_multi+0x269>
jmp    120a <count_multi+0xea>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    122b <count_multi+0x10b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    120a <count_multi+0xea>
cmpq   $0x0,-0x8(%rbp)
je     1256 <count_multi+0x136>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     125b <count_multi+0x13b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     125b <count_multi+0x13b>
jmp    137f <count_multi+0x25f>
jmp    1260 <count_multi+0x140>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1375 <count_multi+0x255>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     1290 <count_multi+0x170>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    130b <count_multi+0x1eb>
jmp    1295 <count_multi+0x175>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     12ba <count_multi+0x19a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    12ca <count_multi+0x1aa>
jmp    1306 <count_multi+0x1e6>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     12f5 <count_multi+0x1d5>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     12f5 <count_multi+0x1d5>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <count_multi+0x175>
jmp    1370 <count_multi+0x250>
jmp    1310 <count_multi+0x1f0>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2b,%ecx
mov    %al,-0x12(%rbp)
je     134a <count_multi+0x22a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x12(%rbp)
je     134a <count_multi+0x22a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    135a <count_multi+0x23a>
jmp    136b <count_multi+0x24b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1310 <count_multi+0x1f0>
jmp    1370 <count_multi+0x250>
jmp    1260 <count_multi+0x140>
jmp    137a <count_multi+0x25a>
jmp    1389 <count_multi+0x269>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_multi>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
test   %rdi,%rdi
je     1257 <count_multi+0x137>
add    $0xffffffffffffffff,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x20,0x1(%rdi)
lea    0x1(%rdi),%rdi
je     1140 <count_multi+0x20>
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1257 <count_multi+0x137>
mov    %rax,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     1170 <count_multi+0x50>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
jne    125e <count_multi+0x13e>
movl   $0x0,(%r14)
add    $0x5,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     125e <count_multi+0x13e>
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ebx
cmp    $0x20,%bl
jne    11ce <count_multi+0xae>
add    $0x1,%rax
jmp    11c0 <count_multi+0xa0>
cmp    $0x2d,%bl
je     11d8 <count_multi+0xb8>
cmp    $0x2b,%bl
jne    1257 <count_multi+0x137>
xor    %ecx,%ecx
movabs $0x280000000001,%rdx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %bl,%bl
je     125e <count_multi+0x13e>
cmp    $0x2b,%bl
je     122a <count_multi+0x10a>
cmp    $0x2d,%bl
jne    1208 <count_multi+0xe8>
jmp    122a <count_multi+0x10a>
movzbl 0x1(%rax),%ebx
add    $0x1,%rax
cmp    $0x2d,%bl
ja     1200 <count_multi+0xe0>
movzbl %bl,%esi
bt     %rsi,%rdx
jae    1200 <count_multi+0xe0>
jmp    11f0 <count_multi+0xd0>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %ecx,(%r14)
add    $0x1,%rax
movzbl (%rax),%ebx
cmp    $0x2c,%bl
jg     1250 <count_multi+0x130>
cmp    $0x2b,%bl
je     1226 <count_multi+0x106>
test   %bl,%bl
je     11f0 <count_multi+0xd0>
cmp    $0x20,%bl
jne    1220 <count_multi+0x100>
jmp    11f0 <count_multi+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x2d,%bl
je     1226 <count_multi+0x106>
jmp    1220 <count_multi+0x100>
movl   $0x1,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"MODE \00"
define void @count_multi(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %2
br label %140
8: ; preds = %2
br label %9
9: ; preds = %14, %8
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 32
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %9
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = call i8* @strchr(i8* %18, i32 32)
store i8* %19, i8** %3
%20 = load i8*, i8** %3
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %23
22: ; preds = %17
br label %140
23: ; preds = %17
br label %24
24: ; preds = %29, %23
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 32
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
br label %24
32: ; preds = %24
%33 = load i8*, i8** %3
%34 = call i64 @strncasecmp(i8* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %139
36: ; preds = %32
%37 = load i32*, i32** %4
store i32 0, i32* %37
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i64 5
store i8* %39, i8** %3
%40 = load i8*, i8** %3
%41 = call i8* @strchr(i8* %40, i32 32)
store i8* %41, i8** %3
%42 = load i8*, i8** %3
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %45
44: ; preds = %36
br label %142
45: ; preds = %36
br label %46
46: ; preds = %51, %45
%47 = load i8*, i8** %3
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 32
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = load i8*, i8** %3
%53 = getelementptr inbounds i8, i8* %52, i32 1
store i8* %53, i8** %3
br label %46
54: ; preds = %46
%55 = load i8*, i8** %3
%56 = icmp eq i8* %55, null
br i1 %56, label %67, label %57
57: ; preds = %54
%58 = load i8*, i8** %3
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp ne i32 %60, 43
br i1 %61, label %62, label %68
62: ; preds = %57
%63 = load i8*, i8** %3
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp ne i32 %65, 45
br i1 %66, label %67, label %68
67: ; preds = %62, %54
br label %140
68: ; preds = %62, %57
br label %69
69: ; preds = %137, %68
%70 = load i8*, i8** %3
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %138
74: ; preds = %69
%75 = load i8*, i8** %3
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 43
br i1 %78, label %84, label %79
79: ; preds = %74
%80 = load i8*, i8** %3
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 45
br i1 %83, label %84, label %115
84: ; preds = %79, %74
br label %85
85: ; preds = %111, %84
%86 = load i8*, i8** %3
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp ne i32 %88, 32
br i1 %89, label %90, label %95
90: ; preds = %85
%91 = load i8*, i8** %3
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp ne i32 %93, 0
br label %95
95: ; preds = %90, %85
%96 = phi i1 [ false, %85 ], [ %94, %90 ]
br i1 %96, label %97, label %114
97: ; preds = %95
%98 = load i8*, i8** %3
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp ne i32 %100, 43
br i1 %101, label %102, label %111
102: ; preds = %97
%103 = load i8*, i8** %3
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 45
br i1 %106, label %107, label %111
107: ; preds = %102
%108 = load i32*, i32** %4
%109 = load i32, i32* %108
%110 = add i32 %109, 1
store i32 %110, i32* %108
br label %111
111: ; preds = %107, %102, %97
%112 = load i8*, i8** %3
%113 = getelementptr inbounds i8, i8* %112, i32 1
store i8* %113, i8** %3
br label %85
114: ; preds = %95
br label %137
115: ; preds = %79
br label %116
116: ; preds = %133, %115
%117 = load i8*, i8** %3
%118 = load i8, i8* %117
%119 = sext i8 %118 to i32
%120 = icmp ne i32 %119, 43
br i1 %120, label %121, label %131
121: ; preds = %116
%122 = load i8*, i8** %3
%123 = load i8, i8* %122
%124 = sext i8 %123 to i32
%125 = icmp ne i32 %124, 45
br i1 %125, label %126, label %131
126: ; preds = %121
%127 = load i8*, i8** %3
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = icmp ne i32 %129, 0
br label %131
131: ; preds = %126, %121, %116
%132 = phi i1 [ false, %121 ], [ false, %116 ], [ %130, %126 ]
br i1 %132, label %133, label %136
133: ; preds = %131
%134 = load i8*, i8** %3
%135 = getelementptr inbounds i8, i8* %134, i32 1
store i8* %135, i8** %3
br label %116
136: ; preds = %131
br label %137
137: ; preds = %136, %114
br label %69
138: ; preds = %69
br label %139
139: ; preds = %138, %32
br label %142
140: ; preds = %67, %22, %7
%141 = load i32*, i32** %4
store i32 1, i32* %141
br label %142
142: ; preds = %140, %139, %44
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"MODE \00"
define void @count_multi(i8* %0, i32* nocapture %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %55, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %8, %4 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 32
%8 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %7, label %4, label %9
9: ; preds = %4
%10 = tail call i8* @strchr(i8* %5, i32 32)
%11 = icmp eq i8* %10, null
br i1 %11, label %55, label %12
12: ; preds = %9, %12
%13 = phi i8* [ %16, %12 ], [ %10, %9 ]
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 32
%16 = getelementptr inbounds i8, i8* %13, i64 1
br i1 %15, label %12, label %17
17: ; preds = %12
%18 = tail call i64 @strncasecmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %56
20: ; preds = %17
store i32 0, i32* %1
%21 = getelementptr inbounds i8, i8* %13, i64 5
%22 = tail call i8* @strchr(i8* %21, i32 32)
%23 = icmp eq i8* %22, null
br i1 %23, label %56, label %24
24: ; preds = %20, %28
%25 = phi i8* [ %29, %28 ], [ %22, %20 ]
%26 = load i8, i8* %25
switch i8 %26, label %55 [
i8 32, label %28
i8 43, label %27
i8 45, label %27
]
27: ; preds = %24, %24
br label %32
28: ; preds = %24
%29 = getelementptr inbounds i8, i8* %25, i64 1
br label %24
30: ; preds = %49, %49, %49
br label %36
31: ; preds = %40, %40
br label %32
32: ; preds = %27, %31
%33 = phi i32 [ 0, %27 ], [ %41, %31 ]
%34 = phi i8 [ %26, %27 ], [ %43, %31 ]
%35 = phi i8* [ %25, %27 ], [ %42, %31 ]
br label %36
36: ; preds = %32, %30
%37 = phi i8 [ %50, %30 ], [ %34, %32 ]
%38 = phi i8* [ %51, %30 ], [ %35, %32 ]
switch i8 %37, label %49 [
i8 0, label %56
i8 43, label %39
i8 45, label %39
]
39: ; preds = %36, %36
br label %40
40: ; preds = %39, %46
%41 = phi i32 [ %47, %46 ], [ %33, %39 ]
%42 = phi i8* [ %48, %46 ], [ %38, %39 ]
%43 = load i8, i8* %42
switch i8 %43, label %44 [
i8 32, label %31
i8 0, label %31
i8 43, label %46
i8 45, label %46
]
44: ; preds = %40
%45 = add i32 %41, 1
store i32 %45, i32* %1
br label %46
46: ; preds = %40, %40, %44
%47 = phi i32 [ %41, %40 ], [ %41, %40 ], [ %45, %44 ]
%48 = getelementptr inbounds i8, i8* %42, i64 1
br label %40
49: ; preds = %36, %52
%50 = phi i8 [ %54, %52 ], [ %37, %36 ]
%51 = phi i8* [ %53, %52 ], [ %38, %36 ]
switch i8 %50, label %52 [
i8 43, label %30
i8 45, label %30
i8 0, label %30
]
52: ; preds = %49
%53 = getelementptr inbounds i8, i8* %51, i64 1
%54 = load i8, i8* %53
br label %49
55: ; preds = %24, %9, %2
store i32 1, i32* %1
br label %56
56: ; preds = %36, %17, %20, %55
ret void
}