#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 array_freq(char **, int, char *);
int /*<<< orphan*/ fail_test(int);
void test_freq() {
  char *empty_words[] = {};
  char *unique_words[] = {"abc", "def", "jhk", "lmn"};
  char *dupl_words[] = {"abc", "def", "abc", "lmn"};
  if (array_freq(empty_words, 0, "abc") != 0)
    fail_test(115);
  ;
  if (array_freq(unique_words, 4, "zzz") != 0)
    fail_test(117);
  ;
  if (array_freq(unique_words, 4, "jhk") != 1)
    fail_test(119);
  ;
  if (array_freq(dupl_words, 4, "abc") != 2)
    fail_test(121);
  ;
}


x86 assembly (clang, -O0):
<test_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x2cb1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cae(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cab(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2ca8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ca5(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2ca2(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2c9f(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c9c(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xe73(%rip),%rdx
call   1040 <array_freq@plt>
cmp    $0x0,%eax
je     11a5 <test_freq+0x85>
mov    $0x73,%edi
call   1030 <fail_test@plt>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
lea    0xe5b(%rip),%rdx
call   1040 <array_freq@plt>
cmp    $0x0,%eax
je     11cd <test_freq+0xad>
mov    $0x75,%edi
call   1030 <fail_test@plt>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
lea    0xe2b(%rip),%rdx
call   1040 <array_freq@plt>
cmp    $0x1,%eax
je     11f5 <test_freq+0xd5>
mov    $0x77,%edi
call   1030 <fail_test@plt>
lea    -0x50(%rbp),%rdi
mov    $0x4,%esi
lea    0xdfb(%rip),%rdx
call   1040 <array_freq@plt>
cmp    $0x2,%eax
je     121d <test_freq+0xfd>
mov    $0x79,%edi
call   1030 <fail_test@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_freq>:
sub    $0x58,%rsp
movaps 0x2cc5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2ca9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2ccd(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2cb1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xea5(%rip),%rdx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <array_freq@plt>
test   %eax,%eax
je     1175 <test_freq+0x55>
mov    $0x73,%edi
call   1030 <fail_test@plt>
lea    0xe94(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_freq@plt>
test   %eax,%eax
je     1199 <test_freq+0x79>
mov    $0x75,%edi
call   1030 <fail_test@plt>
lea    0xe68(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_freq@plt>
cmp    $0x1,%eax
je     11be <test_freq+0x9e>
mov    $0x77,%edi
call   1030 <fail_test@plt>
lea    0xe3b(%rip),%rdx
lea    0x30(%rsp),%rdi
mov    $0x4,%esi
call   1040 <array_freq@plt>
cmp    $0x2,%eax
je     11e3 <test_freq+0xc3>
mov    $0x79,%edi
call   1030 <fail_test@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"def\00"
@.str.2 = [4 x i8] c"jhk\00"
@.str.3 = [4 x i8] c"lmn\00"
@__const.test_freq.unique_words = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
@__const.test_freq.dupl_words = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [4 x i8] c"zzz\00"
define void @test_freq() {
%1 = alloca [0 x i8*]
%2 = alloca [4 x i8*]
%3 = alloca [4 x i8*]
%4 = bitcast [0 x i8*]* %1 to i8*
%5 = bitcast [4 x i8*]* %2 to i8*
%6 = bitcast [4 x i8*]* %3 to i8*
%7 = getelementptr inbounds [0 x i8*], [0 x i8*]* %1, i64 0, i64 0
%8 = call i32 @array_freq(i8** %7, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @fail_test(i32 115)
br label %12
12: ; preds = %10, %0
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%14 = call i32 @array_freq(i8** %13, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @fail_test(i32 117)
br label %18
18: ; preds = %16, %12
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%20 = call i32 @array_freq(i8** %19, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @fail_test(i32 119)
br label %24
24: ; preds = %22, %18
%25 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%26 = call i32 @array_freq(i8** %25, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%27 = icmp ne i32 %26, 2
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @fail_test(i32 121)
br label %30
30: ; preds = %28, %24
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"def\00"
@.str.2 = [4 x i8] c"jhk\00"
@.str.3 = [4 x i8] c"lmn\00"
@__const.test_freq.unique_words = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
@__const.test_freq.dupl_words = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [4 x i8] c"zzz\00"
define void @test_freq() {
%1 = alloca [0 x i8*]
%2 = alloca [4 x i8*]
%3 = alloca [4 x i8*]
%4 = bitcast [0 x i8*]* %1 to i8*
%5 = bitcast [4 x i8*]* %2 to i8*
%6 = bitcast [4 x i8*]* %3 to i8*
%7 = getelementptr inbounds [0 x i8*], [0 x i8*]* %1, i64 0, i64 0
%8 = call i32 @array_freq(i8** %7, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @fail_test(i32 115)
br label %12
12: ; preds = %10, %0
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%14 = call i32 @array_freq(i8** %13, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @fail_test(i32 117)
br label %18
18: ; preds = %16, %12
%19 = call i32 @array_freq(i8** %13, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, 1
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 @fail_test(i32 119)
br label %23
23: ; preds = %21, %18
%24 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%25 = call i32 @array_freq(i8** %24, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i32 %25, 2
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = call i32 @fail_test(i32 121)
br label %29
29: ; preds = %27, %23
ret void
}