#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*/ printf(char *);
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
void test_func() {
  int i;
  int b_count = 0;
  char user_input[200];
  read(0, user_input, 200);
  for (i = 0; i < 20; ++i) {
    if (user_input[i] == 'B') {
      ++b_count;
    }
  }
  if (b_count == 10) {
    printf("There are 10 'B's in your input.\n");
    printf("Easter egg triggered!\n");
  }
}


x86 assembly (clang, -O0):
<test_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x8(%rbp)
lea    -0xd0(%rbp),%rsi
xor    %edi,%edi
mov    $0xc8,%edx
call   1040 <read@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x14,-0x4(%rbp)
jge    1187 <test_func+0x67>
movslq -0x4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%eax
ff
cmp    $0x42,%eax
jne    1174 <test_func+0x54>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <test_func+0x59>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114c <test_func+0x2c>
cmpl   $0xa,-0x8(%rbp)
jne    11a9 <test_func+0x89>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_func>:
sub    $0xc8,%rsp
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0xc8,%edx
call   1040 <read@plt>
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
pcmpeqb 0xeb7(%rip),%xmm0
pmovmskb %xmm0,%eax
mov    %eax,%ecx
shr    %ecx
and    $0x5555,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
and    $0x3333,%ecx
shr    $0x2,%eax
and    $0x3333,%eax
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %eax,%ecx
and    $0xf0f,%ecx
mov    %ecx,%eax
shl    $0x8,%eax
add    %ecx,%eax
movzbl %ah,%eax
pcmpeqb 0xe86(%rip),%xmm1
punpcklbw %xmm1,%xmm0
punpcklwd %xmm0,%xmm0
movmskps %xmm0,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ecx
add    %eax,%ecx
cmp    $0xa,%ecx
jne    11de <test_func+0xbe>
lea    0xe5a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
add    $0xc8,%rsp
jmp    1030 <puts@plt>
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"There are 10 'B's in your input.\0A\00"
@.str.1 = [23 x i8] c"Easter egg triggered!\0A\00"
define void @test_func() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [200 x i8]
store i32 0, i32* %2
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 200)
store i32 0, i32* %1
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 66
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %9
br label %20
20: ; preds = %19
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %6
23: ; preds = %6
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 10
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %26, %23
ret void
}

LLVM IR (-O2):
@str = [33 x i8] c"There are 10 'B's in your input.\00"
@str.2 = [22 x i8] c"Easter egg triggered!\00"
define void @test_func() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 200)
%4 = bitcast [200 x i8]* %1 to <16 x i8>*
%5 = load <16 x i8>, <16 x i8>* %4
%6 = icmp eq <16 x i8> %5, <i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66, i8 66>
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 16
%8 = bitcast i8* %7 to <4 x i8>*
%9 = load <4 x i8>, <4 x i8>* %8
%10 = icmp eq <4 x i8> %9, <i8 66, i8 66, i8 66, i8 66>
%11 = bitcast <16 x i1> %6 to i16
%12 = call i16 @llvm.ctpop.i16(i16 %11)
%13 = zext i16 %12 to i32
%14 = bitcast <4 x i1> %10 to i4
%15 = call i4 @llvm.ctpop.i4(i4 %14)
%16 = zext i4 %15 to i32
%17 = add nuw nsw i32 %13, %16
%18 = icmp eq i32 %17, 10
br i1 %18, label %19, label %22
19: ; preds = %0
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0))
br label %22
22: ; preds = %19, %0
ret void
}