#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 *numSmallerByFrequency(char **, int, char **, int, int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char *queries[4] = {"bbb", "cc", "yzffdd", "d"};
  char *words[5] = {"a", "aa", "aaa", "aaaa", "hhhisiisii"};
  int size = 0;
  int *list = numSmallerByFrequency(queries, 4, words, 5, &size);
  for (int i = 0; i < size; i++) {
    printf("%d\n", list[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cb7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cb4(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cb1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cae(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xe8c(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe80(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe74(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe68(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe62(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x64(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rdx
mov    $0x4,%esi
mov    $0x5,%ecx
lea    -0x64(%rbp),%r8
call   1050 <numSmallerByFrequency@plt>
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1213 <main+0xe3>
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11e2 <main+0xb2>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
movaps 0x2ce0(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2cc4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0xec9(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xebc(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xeaf(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xea2(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xe9b(%rip),%rax
mov    %rax,0x30(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%r8
mov    $0x4,%esi
mov    $0x5,%ecx
call   1040 <numSmallerByFrequency@plt>
cmpl   $0x0,0xc(%rsp)
jle    11da <main+0xba>
mov    %rax,%r15
xor    %ebx,%ebx
lea    0xe68(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11c0 <main+0xa0>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"bbb\00"
@.str.1 = [3 x i8] c"cc\00"
@.str.2 = [7 x i8] c"yzffdd\00"
@.str.3 = [2 x i8] c"d\00"
@__const.main.queries = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [3 x i8] c"aa\00"
@.str.6 = [4 x i8] c"aaa\00"
@.str.7 = [5 x i8] c"aaaa\00"
@.str.8 = [11 x i8] c"hhhisiisii\00"
@.str.9 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca [5 x i8*]
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [4 x i8*]* %2 to i8*
%8 = bitcast [5 x i8*]* %3 to i8*
%9 = bitcast i8* %8 to [5 x i8*]*
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i32 0, i32 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i32 0, i32 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i32 0, i32 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i32 0, i32 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i32 0, i32 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i32 0, i32 0), i8** %14
store i32 0, i32* %4
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
%17 = call i32* @numSmallerByFrequency(i8** %15, i32 4, i8** %16, i32 5, i32* %4)
store i32* %17, i32** %5
store i32 0, i32* %6
br label %18
18: ; preds = %29, %0
%19 = load i32, i32* %6
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32*, i32** %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %18
32: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"bbb\00"
@.str.1 = [3 x i8] c"cc\00"
@.str.2 = [7 x i8] c"yzffdd\00"
@.str.3 = [2 x i8] c"d\00"
@__const.main.queries = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [3 x i8] c"aa\00"
@.str.6 = [4 x i8] c"aaa\00"
@.str.7 = [5 x i8] c"aaaa\00"
@.str.8 = [11 x i8] c"hhhisiisii\00"
@.str.9 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [4 x i8*]
%2 = alloca [5 x i8*]
%3 = alloca i32
%4 = bitcast [4 x i8*]* %1 to i8*
%5 = bitcast [5 x i8*]* %2 to i8*
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8** %10
%11 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%13 = call i32* @numSmallerByFrequency(i8** %12, i32 4, i8** %6, i32 5, i32* %3)
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %17, %0
ret i32 0
17: ; preds = %0, %17
%18 = phi i64 [ %22, %17 ], [ 0, %0 ]
%19 = getelementptr inbounds i32, i32* %13, i64 %18
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i64 %18, 1
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %17, label %16
}