#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 */
size_t hash_func(const void *key) {
  int k = *(const int *)key;
  if (k == 1 || k == 2) {
    k = 3;
  } else if (k == 3 || k == 4) {
    k = 1;
  } else if (k == 5 || k == 6) {
    k = 2;
  }
  return 81 + k;
}


x86 assembly (clang, -O0):
<hash_func>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1125 <hash_func+0x25>
cmpl   $0x2,-0xc(%rbp)
jne    1131 <hash_func+0x31>
movl   $0x3,-0xc(%rbp)
jmp    1176 <hash_func+0x76>
cmpl   $0x3,-0xc(%rbp)
je     1145 <hash_func+0x45>
cmpl   $0x4,-0xc(%rbp)
jne    1151 <hash_func+0x51>
movl   $0x1,-0xc(%rbp)
jmp    1171 <hash_func+0x71>
cmpl   $0x5,-0xc(%rbp)
je     1165 <hash_func+0x65>
cmpl   $0x6,-0xc(%rbp)
jne    116c <hash_func+0x6c>
movl   $0x2,-0xc(%rbp)
jmp    1171 <hash_func+0x71>
jmp    1176 <hash_func+0x76>
mov    -0xc(%rbp),%eax
add    $0x51,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_func>:
mov    (%rdi),%ecx
lea    -0x1(%rcx),%edx
mov    $0x54,%eax
cmp    $0x2,%edx
jb     112f <hash_func+0x2f>
lea    -0x3(%rcx),%edx
mov    $0x52,%eax
cmp    $0x2,%edx
jb     112f <hash_func+0x2f>
lea    -0x5(%rcx),%eax
add    $0x51,%ecx
cmp    $0x2,%eax
mov    $0x53,%eax
cmovae %ecx,%eax
cltq
ret

LLVM IR (-O0):
define i64 @hash_func(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 1
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %9, %1
store i32 3, i32* %3
br label %29
13: ; preds = %9
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 3
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 4
br i1 %18, label %19, label %20
19: ; preds = %16, %13
store i32 1, i32* %3
br label %28
20: ; preds = %16
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 5
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 6
br i1 %25, label %26, label %27
26: ; preds = %23, %20
store i32 2, i32* %3
br label %27
27: ; preds = %26, %23
br label %28
28: ; preds = %27, %19
br label %29
29: ; preds = %28, %12
%30 = load i32, i32* %3
%31 = add nsw i32 81, %30
%32 = sext i32 %31 to i64
ret i64 %32
}

LLVM IR (-O2):
define i64 @hash_func(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = add i32 %3, -1
%5 = icmp ult i32 %4, 2
br i1 %5, label %15, label %6
6: ; preds = %1
%7 = add i32 %3, -3
%8 = icmp ult i32 %7, 2
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = add i32 %3, -5
%11 = icmp ult i32 %10, 2
%12 = add i32 %3, 81
%13 = select i1 %11, i32 83, i32 %12
%14 = sext i32 %13 to i64
br label %15
15: ; preds = %6, %1, %9
%16 = phi i64 [ %14, %9 ], [ 84, %1 ], [ 82, %6 ]
ret i64 %16
}