#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*/ assert_equal_int(int, int, char *, char *);
int pl_count(char *, char *);
void test_count() {
  int ret_val = 0;
  ret_val = pl_count("one one two three one two four", "one");
  assert_equal_int(3, ret_val, "test_count", "Test 1: Count not right");
  ret_val = pl_count("one one two three one two four", "six");
  assert_equal_int(0, ret_val, "test_count", "Test 2: Count not right");
}


x86 assembly (clang, -O0):
<test_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <pl_count@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x3,%edi
lea    0xecf(%rip),%rdx
lea    0xed3(%rip),%rcx
call   1040 <assert_equal_int@plt>
lea    0xe99(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1030 <pl_count@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
xor    %edi,%edi
lea    0xea1(%rip),%rdx
lea    0xec1(%rip),%rcx
call   1040 <assert_equal_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_count>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
lea    0xeed(%rip),%rsi
mov    %rbx,%rdi
call   1030 <pl_count@plt>
lea    0xee2(%rip),%r14
lea    0xee6(%rip),%rcx
mov    $0x3,%edi
mov    %eax,%esi
mov    %r14,%rdx
call   1040 <assert_equal_int@plt>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <pl_count@plt>
lea    0xedd(%rip),%rcx
xor    %edi,%edi
mov    %eax,%esi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <assert_equal_int@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"one one two three one two four\00"
@.str.1 = [4 x i8] c"one\00"
@.str.2 = [11 x i8] c"test_count\00"
@.str.3 = [24 x i8] c"Test 1: Count not right\00"
@.str.4 = [4 x i8] c"six\00"
@.str.5 = [24 x i8] c"Test 2: Count not right\00"
define void @test_count() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @pl_count(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @assert_equal_int(i32 3, i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @pl_count(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = call i32 @assert_equal_int(i32 0, i32 %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"one one two three one two four\00"
@.str.1 = [4 x i8] c"one\00"
@.str.2 = [11 x i8] c"test_count\00"
@.str.3 = [24 x i8] c"Test 1: Count not right\00"
@.str.4 = [4 x i8] c"six\00"
@.str.5 = [24 x i8] c"Test 2: Count not right\00"
define void @test_count() {
%1 = tail call i32 @pl_count(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @assert_equal_int(i32 3, i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 @pl_count(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%4 = tail call i32 @assert_equal_int(i32 0, i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
ret void
}