#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 int const uint64_t;
typedef int /*<<< orphan*/ h1;
typedef int /*<<< orphan*/ h0;

/* Variables and functions */
int get_cache_slice(uint64_t phys_addr, int bad_bit) {
  static const int h0[] = {6,  10, 12, 14, 16, 17, 18, 20, 22, 24,
                           25, 26, 27, 28, 30, 32, 33, 35, 36};
  static const int h1[] = {7,  11, 13, 15, 17, 19, 20, 21, 22, 23,
                           24, 26, 28, 29, 31, 33, 34, 35, 37};
  int count = sizeof(h0) / sizeof(h0[0]);
  int hash = 0;
  for (int i = 0; i < count; i++) {
    hash ^= (phys_addr >> h0[i]) & 1;
  }
  count = sizeof(h1) / sizeof(h1[0]);
  int hash1 = 0;
  for (int i = 0; i < count; i++) {
    hash1 ^= (phys_addr >> h1[i]) & 1;
  }
  return hash1 << 1 | hash;
}


x86 assembly (clang, -O0):
<get_cache_slice>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x13,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1155 <get_cache_slice+0x55>
mov    -0x4(%rbp),%eax
movslq -0x14(%rbp),%rdx
lea    0xec7(%rip),%rcx
mov    (%rcx,%rdx,4),%ecx
sar    %cl,%eax
and    $0x1,%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111f <get_cache_slice+0x1f>
movl   $0x13,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a0 <get_cache_slice+0xa0>
mov    -0x4(%rbp),%eax
movslq -0x1c(%rbp),%rdx
lea    0xecc(%rip),%rcx
mov    (%rcx,%rdx,4),%ecx
sar    %cl,%eax
and    $0x1,%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116a <get_cache_slice+0x6a>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
or     -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@get_cache_slice.h0 = internal constant [19 x i32] [i32 6, i32 10, i32 12, i32 14, i32 16, i32 17, i32 18, i32 20, i32 22, i32 24, i32 25, i32 26, i32 27, i32 28, i32 30, i32 32, i32 33, i32 35, i32 36]
@get_cache_slice.h1 = internal constant [19 x i32] [i32 7, i32 11, i32 13, i32 15, i32 17, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 26, i32 28, i32 29, i32 31, i32 33, i32 34, i32 35, i32 37]
define i32 @get_cache_slice(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 19, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %10
10: ; preds = %24, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i32, i32* %3
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [19 x i32], [19 x i32]* @get_cache_slice.h0, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = ashr i32 %15, %19
%21 = and i32 %20, 1
%22 = load i32, i32* %6
%23 = xor i32 %22, %21
store i32 %23, i32* %6
br label %24
24: ; preds = %14
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %10
27: ; preds = %10
store i32 19, i32* %5
store i32 0, i32* %8
store i32 0, i32* %9
br label %28
28: ; preds = %42, %27
%29 = load i32, i32* %9
%30 = load i32, i32* %5
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %45
32: ; preds = %28
%33 = load i32, i32* %3
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [19 x i32], [19 x i32]* @get_cache_slice.h1, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = ashr i32 %33, %37
%39 = and i32 %38, 1
%40 = load i32, i32* %8
%41 = xor i32 %40, %39
store i32 %41, i32* %8
br label %42
42: ; preds = %32
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %28
45: ; preds = %28
%46 = load i32, i32* %8
%47 = shl i32 %46, 1
%48 = load i32, i32* %6
%49 = or i32 %47, %48
ret i32 %49
}

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