#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 */
unsigned long long rng__u64_in(unsigned long long, unsigned long long);
unsigned long long rng_u64_in(unsigned long long range) {
  unsigned long long mask;
  mask = range;
  mask = (mask | (mask >> 1));
  mask = (mask | (mask >> 2));
  mask = (mask | (mask >> 4));
  mask = (mask | (mask >> 8));
  mask = (mask | (mask >> 16));
  mask = (mask | (mask >> 32));
  return rng__u64_in(range, mask);
}


x86 assembly (clang, -O0):
<rng_u64_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x1,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x2,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x4,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x8,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x10,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x20,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <rng__u64_in@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rng_u64_in>:
mov    %rdi,%rax
shr    %rax
or     %rdi,%rax
mov    %rax,%rcx
shr    $0x2,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x4,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x8,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x10,%rax
or     %rcx,%rax
mov    %rax,%rsi
shr    $0x20,%rsi
or     %rax,%rsi
jmp    1030 <rng__u64_in@plt>

LLVM IR (-O0):
define i64 @rng_u64_in(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
%5 = load i64, i64* %3
%6 = load i64, i64* %3
%7 = lshr i64 %6, 1
%8 = or i64 %5, %7
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = load i64, i64* %3
%11 = lshr i64 %10, 2
%12 = or i64 %9, %11
store i64 %12, i64* %3
%13 = load i64, i64* %3
%14 = load i64, i64* %3
%15 = lshr i64 %14, 4
%16 = or i64 %13, %15
store i64 %16, i64* %3
%17 = load i64, i64* %3
%18 = load i64, i64* %3
%19 = lshr i64 %18, 8
%20 = or i64 %17, %19
store i64 %20, i64* %3
%21 = load i64, i64* %3
%22 = load i64, i64* %3
%23 = lshr i64 %22, 16
%24 = or i64 %21, %23
store i64 %24, i64* %3
%25 = load i64, i64* %3
%26 = load i64, i64* %3
%27 = lshr i64 %26, 32
%28 = or i64 %25, %27
store i64 %28, i64* %3
%29 = load i64, i64* %2
%30 = load i64, i64* %3
%31 = call i64 @rng__u64_in(i64 %29, i64 %30)
ret i64 %31
}

LLVM IR (-O2):
define i64 @rng_u64_in(i64 %0) {
%2 = lshr i64 %0, 1
%3 = or i64 %2, %0
%4 = lshr i64 %3, 2
%5 = or i64 %4, %3
%6 = lshr i64 %5, 4
%7 = or i64 %6, %5
%8 = lshr i64 %7, 8
%9 = or i64 %8, %7
%10 = lshr i64 %9, 16
%11 = or i64 %10, %9
%12 = lshr i64 %11, 32
%13 = or i64 %12, %11
%14 = tail call i64 @rng__u64_in(i64 %0, i64 %13)
ret i64 %14
}