#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 count_number_in_array(int *, int, int);
int /*<<< orphan*/ printf(char *);
void test__count_number_in_array() {
  int arr[10] = {2, 2, 3, 3, 3, 4, 4, 4, 4, 4};
  if (2 == count_number_in_array(arr, 10, 2) &&
      3 == count_number_in_array(arr, 10, 3) &&
      5 == count_number_in_array(arr, 10, 4))
    printf("TEST count_number_in_array PASSED!\n");
  else
    printf("TEST count_number_in_array FAILED!\n");
}


x86 assembly (clang, -O0):
<test__count_number_in_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1040 <count_number_in_array@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
jne    11c4 <test__count_number_in_array+0x94>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x3,%edx
call   1040 <count_number_in_array@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
jne    11c4 <test__count_number_in_array+0x94>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
call   1040 <count_number_in_array@plt>
mov    %eax,%ecx
mov    $0x5,%eax
cmp    %ecx,%eax
jne    11c4 <test__count_number_in_array+0x94>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    11d0 <test__count_number_in_array+0xa0>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test__count_number_in_array>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1040 <count_number_in_array@plt>
cmp    $0x2,%eax
jne    1195 <test__count_number_in_array+0x75>
mov    %rsp,%rdi
mov    $0xa,%esi
mov    $0x3,%edx
call   1040 <count_number_in_array@plt>
cmp    $0x3,%eax
jne    1195 <test__count_number_in_array+0x75>
mov    %rsp,%rdi
mov    $0xa,%esi
mov    $0x4,%edx
call   1040 <count_number_in_array@plt>
cmp    $0x5,%eax
jne    1195 <test__count_number_in_array+0x75>
lea    0xeb8(%rip),%rdi
jmp    119c <test__count_number_in_array+0x7c>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test__count_number_in_array.arr = [10 x i32] [i32 2, i32 2, i32 3, i32 3, i32 3, i32 4, i32 4, i32 4, i32 4, i32 4]
@.str = [36 x i8] c"TEST count_number_in_array PASSED!\0A\00"
@.str.1 = [36 x i8] c"TEST count_number_in_array FAILED!\0A\00"
define void @test__count_number_in_array() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @count_number_in_array(i32* %3, i32 10, i32 2)
%5 = icmp eq i32 2, %4
br i1 %5, label %6, label %16
6: ; preds = %0
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = call i32 @count_number_in_array(i32* %7, i32 10, i32 3)
%9 = icmp eq i32 3, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%12 = call i32 @count_number_in_array(i32* %11, i32 10, i32 4)
%13 = icmp eq i32 5, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %10, %6, %0
%17 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
ret void
}

LLVM IR (-O2):
@__const.test__count_number_in_array.arr = [10 x i32] [i32 2, i32 2, i32 3, i32 3, i32 3, i32 4, i32 4, i32 4, i32 4, i32 4]
@str = [35 x i8] c"TEST count_number_in_array FAILED!\00"
@str.2 = [35 x i8] c"TEST count_number_in_array PASSED!\00"
define void @test__count_number_in_array() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @count_number_in_array(i32* %3, i32 10, i32 2)
%5 = icmp eq i32 %4, 2
br i1 %5, label %6, label %12
6: ; preds = %0
%7 = call i32 @count_number_in_array(i32* %3, i32 10, i32 3)
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = call i32 @count_number_in_array(i32* %3, i32 10, i32 4)
%11 = icmp eq i32 %10, 5
br i1 %11, label %13, label %12
12: ; preds = %9, %6, %0
br label %13
13: ; preds = %9, %12
%14 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0), %12 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @str.2, i64 0, i64 0), %9 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
ret void
}