#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 */
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
unsigned hash_ip(uint32_t ip) {
  uint8_t *p = (uint8_t *)&ip;
  unsigned h = 0;
  int i;
  for (i = 0; i < 4; i++, p++) {
    h += *p;
    h += (h << 10);
    h ^= (h >> 6);
  }
  h += (h << 3);
  h ^= (h >> 11);
  h += (h << 15);
  return h & 0xfff;
}


x86 assembly (clang, -O0):
<hash_ip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    1169 <hash_ip+0x69>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x14(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0xa,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shr    $0x6,%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    111d <hash_ip+0x1d>
mov    -0x14(%rbp),%eax
shl    $0x3,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shr    $0xb,%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0xf,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xfff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_ip>:
ret

LLVM IR (-O0):
define i32 @hash_ip(i32 %0) {
%2 = alloca i32
%3 = alloca i64*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = bitcast i32* %2 to i64*
store i64* %6, i64** %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %25, %1
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %30
10: ; preds = %7
%11 = load i64*, i64** %3
%12 = load i64, i64* %11
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = shl i32 %17, 10
%19 = load i32, i32* %4
%20 = add i32 %19, %18
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = lshr i32 %21, 6
%23 = load i32, i32* %4
%24 = xor i32 %23, %22
store i32 %24, i32* %4
br label %25
25: ; preds = %10
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
%28 = load i64*, i64** %3
%29 = getelementptr inbounds i64, i64* %28, i32 1
store i64* %29, i64** %3
br label %7
30: ; preds = %7
%31 = load i32, i32* %4
%32 = shl i32 %31, 3
%33 = load i32, i32* %4
%34 = add i32 %33, %32
store i32 %34, i32* %4
%35 = load i32, i32* %4
%36 = lshr i32 %35, 11
%37 = load i32, i32* %4
%38 = xor i32 %37, %36
store i32 %38, i32* %4
%39 = load i32, i32* %4
%40 = shl i32 %39, 15
%41 = load i32, i32* %4
%42 = add i32 %41, %40
store i32 %42, i32* %4
%43 = load i32, i32* %4
%44 = and i32 %43, 4095
ret i32 %44
}

LLVM IR (-O2):
define i32 @hash_ip(i32 %0) {
ret i32 poison
}