#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 */
int /*<<< orphan*/ __bitmap_shift_left(unsigned long *, unsigned long const *,
                                       int, int);
__attribute__((always_)) void bitmap_shift_left(unsigned long *dst,
                                                const unsigned long *src, int n,
                                                int nbits) {
  if (nbits <= 32)
    *dst = (*src << n) & (((nbits) % 32) ? (1UL << ((nbits) % 32)) - 1 : ~0UL);
  else
    __bitmap_shift_left(dst, src, n, nbits);
}


x86 assembly (clang, -O0):
<bitmap_shift_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x20,-0x18(%rbp)
jg     11a0 <bitmap_shift_left+0x90>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x14(%rbp),%ecx
shl    %cl,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1179 <bitmap_shift_left+0x69>
mov    -0x18(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1189 <bitmap_shift_left+0x79>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1189 <bitmap_shift_left+0x79>
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
and    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    11b3 <bitmap_shift_left+0xa3>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <__bitmap_shift_left@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_shift_left>:
mov    %ecx,%eax
cmp    $0x20,%ecx
jg     114b <bitmap_shift_left+0x3b>
mov    (%rsi),%rsi
mov    %edx,%ecx
shl    %cl,%rsi
lea    0x1f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffe0,%ecx
sub    %ecx,%eax
mov    $0xffffffffffffffff,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
cmp    $0x1,%eax
sbb    %rax,%rax
not    %rdx
or     %rdx,%rax
and    %rsi,%rax
mov    %rax,(%rdi)
ret
mov    %eax,%ecx
jmp    1030 <__bitmap_shift_left@plt>

LLVM IR (-O0):
define void @bitmap_shift_left(i64* %0, i64* %1, i32 %2, i32 %3) {
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i32
%8 = alloca i32
store i64* %0, i64** %5
store i64* %1, i64** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp sle i32 %9, 32
br i1 %10, label %11, label %31
11: ; preds = %4
%12 = load i64*, i64** %6
%13 = load i64, i64* %12
%14 = load i32, i32* %7
%15 = zext i32 %14 to i64
%16 = shl i64 %13, %15
%17 = load i32, i32* %8
%18 = srem i32 %17, 32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %11
%21 = load i32, i32* %8
%22 = srem i32 %21, 32
%23 = zext i32 %22 to i64
%24 = shl i64 1, %23
%25 = sub i64 %24, 1
br label %27
26: ; preds = %11
br label %27
27: ; preds = %26, %20
%28 = phi i64 [ %25, %20 ], [ -1, %26 ]
%29 = and i64 %16, %28
%30 = load i64*, i64** %5
store i64 %29, i64* %30
br label %37
31: ; preds = %4
%32 = load i64*, i64** %5
%33 = load i64*, i64** %6
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = call i32 @__bitmap_shift_left(i64* %32, i64* %33, i32 %34, i32 %35)
br label %37
37: ; preds = %31, %27
ret void
}

LLVM IR (-O2):
define void @bitmap_shift_left(i64* %0, i64* %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %3, 33
br i1 %5, label %6, label %17
6: ; preds = %4
%7 = load i64, i64* %1
%8 = zext i32 %2 to i64
%9 = shl i64 %7, %8
%10 = srem i32 %3, 32
%11 = icmp eq i32 %10, 0
%12 = zext i32 %10 to i64
%13 = shl nsw i64 -1, %12
%14 = xor i64 %13, -1
%15 = select i1 %11, i64 -1, i64 %14
%16 = and i64 %9, %15
store i64 %16, i64* %0
br label %19
17: ; preds = %4
%18 = tail call i32 @__bitmap_shift_left(i64* %0, i64* %1, i32 %2, i32 %3)
br label %19
19: ; preds = %17, %6
ret void
}