#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ hashtest_cycle(int *, char *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, int);
void hashtest(void) {
  int hits[(1 << (16)) + 5];
  int i;
  memset(hits, 0, sizeof hits);
  hashtest_cycle(hits, "192.168.99.100");
  hashtest_cycle(hits, "172.168.99.100");
  hashtest_cycle(hits, "142.168.99.100");
  for (i = 0; i < (1 << (16)) + 5; i++)
    printf("[%d. %d]\n", i, hits[i]);
  exit(0);
}


x86 assembly (clang, -O0):
<hashtest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40030,%rsp
lea    -0x40020(%rbp),%rdi
xor    %esi,%esi
mov    $0x40014,%edx
call   1040 <memset@plt>
lea    -0x40020(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1050 <hashtest_cycle@plt>
lea    -0x40020(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <hashtest_cycle@plt>
lea    -0x40020(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1050 <hashtest_cycle@plt>
movl   $0x0,-0x40024(%rbp)
cmpl   $0x10005,-0x40024(%rbp)
jge    11e5 <hashtest+0xa5>
mov    -0x40024(%rbp),%esi
movslq -0x40024(%rbp),%rax
mov    -0x40020(%rbp,%rax,4),%edx
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40024(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40024(%rbp)
jmp    11a1 <hashtest+0x61>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<hashtest>:
push   %r14
push   %rbx
sub    $0x40018,%rsp
mov    %rsp,%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x40014,%edx
call   1040 <memset@plt>
lea    0xe9b(%rip),%rsi
mov    %r14,%rdi
call   1050 <hashtest_cycle@plt>
lea    0xe9b(%rip),%rsi
mov    %r14,%rdi
call   1050 <hashtest_cycle@plt>
lea    0xe9b(%rip),%rsi
mov    %r14,%rdi
call   1050 <hashtest_cycle@plt>
lea    0xe9b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x10005,%rbx
jne    11a0 <hashtest+0x60>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"192.168.99.100\00"
@.str.1 = [15 x i8] c"172.168.99.100\00"
@.str.2 = [15 x i8] c"142.168.99.100\00"
@.str.3 = [10 x i8] c"[%d. %d]\0A\00"
define void @hashtest() {
%1 = alloca [65541 x i32]
%2 = alloca i32
%3 = getelementptr inbounds [65541 x i32], [65541 x i32]* %1, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 0, i32 262164)
%5 = getelementptr inbounds [65541 x i32], [65541 x i32]* %1, i64 0, i64 0
%6 = call i32 @hashtest_cycle(i32* %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [65541 x i32], [65541 x i32]* %1, i64 0, i64 0
%8 = call i32 @hashtest_cycle(i32* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [65541 x i32], [65541 x i32]* %1, i64 0, i64 0
%10 = call i32 @hashtest_cycle(i32* %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 65541
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [65541 x i32], [65541 x i32]* %1, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %11
24: ; preds = %11
%25 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"192.168.99.100\00"
@.str.1 = [15 x i8] c"172.168.99.100\00"
@.str.2 = [15 x i8] c"142.168.99.100\00"
@.str.3 = [10 x i8] c"[%d. %d]\0A\00"
define void @hashtest() {
%1 = alloca [65541 x i32]
%2 = bitcast [65541 x i32]* %1 to i8*
%3 = getelementptr inbounds [65541 x i32], [65541 x i32]* %1, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 0, i32 262164)
%5 = call i32 @hashtest_cycle(i32* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @hashtest_cycle(i32* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @hashtest_cycle(i32* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %0, %8
%9 = phi i64 [ 0, %0 ], [ %14, %8 ]
%10 = getelementptr inbounds [65541 x i32], [65541 x i32]* %1, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = trunc i64 %9 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %12, i32 %11)
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, 65541
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = call i32 @exit(i32 0)
unreachable
}