#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_byte(char *);
void test_func() {
  int i;
  int b_count = 0;
  char user_input[200];
  for (i = 0; i < 60; ++i) {
    read_byte(user_input + i);
    if (user_input[i] == '\n') {
      break;
    }
    if (user_input[i] == 'B') {
      ++b_count;
    }
  }
  if (b_count == 35) {
    printf("There are 35 '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)
movl   $0x0,-0x4(%rbp)
cmpl   $0x3c,-0x4(%rbp)
jge    11a1 <test_func+0x81>
lea    -0xd0(%rbp),%rdi
movslq -0x4(%rbp),%rax
add    %rax,%rdi
call   1030 <read_byte@plt>
movslq -0x4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1170 <test_func+0x50>
jmp    11a1 <test_func+0x81>
movslq -0x4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%eax
ff
cmp    $0x42,%eax
jne    118e <test_func+0x6e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1193 <test_func+0x73>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1139 <test_func+0x19>
cmpl   $0x23,-0x8(%rbp)
jne    11c3 <test_func+0xa3>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_func>:
push   %rbp
push   %rbx
sub    $0xc8,%rsp
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    113d <test_func+0x1d>
nop
add    $0x1,%ebp
add    $0x1,%rbx
cmp    $0x3c,%rbx
je     1152 <test_func+0x32>
lea    (%rsp,%rbx,1),%rdi
call   1030 <read_byte@plt>
movzbl (%rsp,%rbx,1),%eax
cmp    $0x42,%al
je     1130 <test_func+0x10>
cmp    $0xa,%al
jne    1133 <test_func+0x13>
cmp    $0x23,%ebp
jne    116f <test_func+0x4f>
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"There are 35 '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
store i32 0, i32* %1
br label %4
4: ; preds = %31, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 60
br i1 %6, label %7, label %34
7: ; preds = %4
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* %1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = call i32 @read_byte(i8* %11)
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 10
br i1 %18, label %19, label %20
19: ; preds = %7
br label %34
20: ; preds = %7
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 66
br i1 %26, label %27, label %30
27: ; preds = %20
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %30
30: ; preds = %27, %20
br label %31
31: ; preds = %30
%32 = load i32, i32* %1
%33 = add nsw i32 %32, 1
store i32 %33, i32* %1
br label %4
34: ; preds = %19, %4
%35 = load i32, i32* %2
%36 = icmp eq i32 %35, 35
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %37, %34
ret void
}

LLVM IR (-O2):
@str = [33 x i8] c"There are 35 '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
br label %3
3: ; preds = %0, %11
%4 = phi i64 [ 0, %0 ], [ %13, %11 ]
%5 = phi i32 [ 0, %0 ], [ %12, %11 ]
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %4
%7 = call i32 @read_byte(i8* %6)
%8 = load i8, i8* %6
switch i8 %8, label %11 [
i8 10, label %15
i8 66, label %9
]
9: ; preds = %3
%10 = add nsw i32 %5, 1
br label %11
11: ; preds = %3, %9
%12 = phi i32 [ %10, %9 ], [ %5, %3 ]
%13 = add nuw nsw i64 %4, 1
%14 = icmp eq i64 %13, 60
br i1 %14, label %15, label %3
15: ; preds = %3, %11
%16 = phi i32 [ %5, %3 ], [ %12, %11 ]
%17 = icmp eq i32 %16, 35
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0))
br label %21
21: ; preds = %18, %15
ret void
}