#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 */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int main() {
  int i, j, n, m;
  char ar[1005];
  while (fgets(ar, 1005, stdin) != NULL) {
    n = 0;
    for (i = 0; ar[i] != '\0'; i++) {
      if (ar[i] == 'a') {
        n++;
      }
    }
    if (n % 3 == 0)
      printf("yes\n");
    else
      printf("no\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    $0x3ed,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11e0 <main+0xc0>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11aa <main+0x8a>
movslq -0x8(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x61,%eax
jne    1197 <main+0x77>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119c <main+0x7c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x44>
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11cf <main+0xaf>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
jmp    11db <main+0xbb>
lea    0xe2f(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x3f8,%rsp
mov    0x2eb3(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rdi
mov    $0x3ed,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11c9 <main+0xa9>
xor    %ecx,%ecx
lea    0xeb0(%rip),%r15
lea    0xea6(%rip),%r12
mov    %rsp,%rbx
xor    %edx,%edx
jmp    1174 <main+0x54>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rcx
movzbl (%rsp,%rcx,1),%eax
test   %al,%al
je     1190 <main+0x70>
cmp    $0x61,%al
jne    1170 <main+0x50>
add    $0x1,%edx
jmp    1170 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nop
imul   $0xaaaaaaab,%edx,%eax
add    $0x2aaaaaaa,%eax
mov    %r15,%rdi
cmp    $0x55555555,%eax
jb     11a8 <main+0x88>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x3ed,%esi
call   1040 <fgets@plt>
xor    %ecx,%ecx
mov    $0x0,%edx
test   %rax,%rax
jne    1174 <main+0x54>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"yes\0A\00"
@.str.1 = [4 x i8] c"no\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1005 x i8]
store i32 0, i32* %1
br label %7
7: ; preds = %42, %0
%8 = getelementptr inbounds [1005 x i8], [1005 x i8]* %6, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %8, i32 1005, i32 %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %43
12: ; preds = %7
store i32 0, i32* %4
store i32 0, i32* %2
br label %13
13: ; preds = %31, %12
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1005 x i8], [1005 x i8]* %6, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %34
20: ; preds = %13
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1005 x i8], [1005 x i8]* %6, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 97
br i1 %26, label %27, label %30
27: ; preds = %20
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %30
30: ; preds = %27, %20
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %13
34: ; preds = %13
%35 = load i32, i32* %4
%36 = srem i32 %35, 3
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %42
40: ; preds = %34
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
br label %7
43: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@str = [3 x i8] c"no\00"
@str.2 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = alloca [1005 x i8]
%2 = getelementptr inbounds [1005 x i8], [1005 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32* @fgets(i8* %2, i32 1005, i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %27, label %6
6: ; preds = %0, %16
%7 = phi i64 [ %17, %16 ], [ 0, %0 ]
%8 = phi i32 [ %18, %16 ], [ 0, %0 ]
%9 = getelementptr inbounds [1005 x i8], [1005 x i8]* %1, i64 0, i64 %7
%10 = load i8, i8* %9
switch i8 %10, label %13 [
i8 0, label %19
i8 97, label %11
]
11: ; preds = %6
%12 = add nsw i32 %8, 1
br label %13
13: ; preds = %6, %11
%14 = phi i32 [ %12, %11 ], [ %8, %6 ]
%15 = add nuw i64 %7, 1
br label %16
16: ; preds = %13, %19
%17 = phi i64 [ %15, %13 ], [ 0, %19 ]
%18 = phi i32 [ %14, %13 ], [ 0, %19 ]
br label %6
19: ; preds = %6
%20 = srem i32 %8, 3
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%23 = call i32 @puts(i8* dereferenceable(1) %22)
%24 = load i32, i32* @stdin
%25 = call i32* @fgets(i8* %2, i32 1005, i32 %24)
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %16
27: ; preds = %19, %0
ret i32 0
}