#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 __WORDSIZE;
int /*<<< orphan*/ __bitmap_shift_left(unsigned long *, unsigned long const *,
                                       int, int);
void bitmap_shift_left(unsigned long *dst, const unsigned long *src, int n,
                       int nbits) {
  if (nbits <= __WORDSIZE)
    *dst =
        (*src << n) &
        (((nbits) % __WORDSIZE) ? (1UL << ((nbits) % __WORDSIZE)) - 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)
mov    -0x18(%rbp),%eax
mov    0x2eb8(%rip),%rcx
cmp    (%rcx),%eax
jg     11ac <bitmap_shift_left+0x9c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x14(%rbp),%ecx
shl    %cl,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e95(%rip),%rcx
cltd
idivl  (%rcx)
cmp    $0x0,%edx
je     1185 <bitmap_shift_left+0x75>
mov    -0x18(%rbp),%eax
mov    0x2e7f(%rip),%rcx
cltd
idivl  (%rcx)
mov    %edx,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1195 <bitmap_shift_left+0x85>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1195 <bitmap_shift_left+0x85>
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
and    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    11bf <bitmap_shift_left+0xaf>
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
mov    0x2ecf(%rip),%rcx
mov    (%rcx),%r8d
cmp    %eax,%r8d
jge    1128 <bitmap_shift_left+0x18>
mov    %eax,%ecx
jmp    1030 <__bitmap_shift_left@plt>
mov    (%rsi),%rsi
mov    %edx,%ecx
shl    %cl,%rsi
cltd
idiv   %r8d
mov    %edx,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
cmp    $0x1,%edx
sbb    %rcx,%rcx
not    %rax
or     %rax,%rcx
and    %rsi,%rcx
mov    %rcx,(%rdi)
ret

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

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