#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 uint64_t;

/* Variables and functions */
int gt_requiredUInt64Bits(uint64_t v) {
  int r;
  static const int MultiplyDeBruijnBitPosition[64] = {
      1,  2,  3,  57, 4,  33, 58, 47, 30, 5,  21, 34, 8,  59, 12, 48,
      63, 31, 19, 6,  17, 22, 35, 24, 54, 9,  60, 37, 26, 13, 49, 40,
      64, 56, 32, 46, 29, 20, 7,  11, 62, 18, 16, 23, 53, 36, 25, 39,
      55, 45, 28, 10, 61, 15, 52, 38, 44, 27, 14, 51, 43, 50, 42, 41};
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  v |= v >> 32;
  v = (v >> 1) + 1;
  r = MultiplyDeBruijnBitPosition[(v * (uint64_t)0x26752B916FC7B0DULL) >> 58];
  return r;
}


x86 assembly (clang, -O0):
<gt_requiredUInt64Bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
imul   $0x16fc7b0d,-0x4(%rbp),%eax
mov    $0x3a,%ecx
sar    %cl,%eax
movslq %eax,%rcx
lea    0xe89(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@gt_requiredUInt64Bits.MultiplyDeBruijnBitPosition = internal constant [64 x i32] [i32 1, i32 2, i32 3, i32 57, i32 4, i32 33, i32 58, i32 47, i32 30, i32 5, i32 21, i32 34, i32 8, i32 59, i32 12, i32 48, i32 63, i32 31, i32 19, i32 6, i32 17, i32 22, i32 35, i32 24, i32 54, i32 9, i32 60, i32 37, i32 26, i32 13, i32 49, i32 40, i32 64, i32 56, i32 32, i32 46, i32 29, i32 20, i32 7, i32 11, i32 62, i32 18, i32 16, i32 23, i32 53, i32 36, i32 25, i32 39, i32 55, i32 45, i32 28, i32 10, i32 61, i32 15, i32 52, i32 38, i32 44, i32 27, i32 14, i32 51, i32 43, i32 50, i32 42, i32 41]
define i32 @gt_requiredUInt64Bits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 1
%6 = load i32, i32* %2
%7 = or i32 %6, %5
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = ashr i32 %8, 2
%10 = load i32, i32* %2
%11 = or i32 %10, %9
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = ashr i32 %12, 4
%14 = load i32, i32* %2
%15 = or i32 %14, %13
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = ashr i32 %16, 8
%18 = load i32, i32* %2
%19 = or i32 %18, %17
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = ashr i32 %20, 16
%22 = load i32, i32* %2
%23 = or i32 %22, %21
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = ashr i32 %24, 32
%26 = load i32, i32* %2
%27 = or i32 %26, %25
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = ashr i32 %28, 1
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
%31 = load i32, i32* %2
%32 = mul nsw i32 %31, 385645325
%33 = ashr i32 %32, 58
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [64 x i32], [64 x i32]* @gt_requiredUInt64Bits.MultiplyDeBruijnBitPosition, i64 0, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %3
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @gt_requiredUInt64Bits(i32 %0) {
ret i32 undef
}