#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 slow_bitmap_andnot(unsigned long *, unsigned long const *,
                       unsigned long const *, int);
int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
                  const unsigned long *src2, int nbits) {
  if (((nbits) <= (sizeof(unsigned long) * 8))) {
    return (*dst = *src1 & ~(*src2)) != 0;
  }
  return slow_bitmap_andnot(dst, src1, src2, nbits);
}


x86 assembly (clang, -O0):
<bitmap_andnot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x40,%rax
ja     1165 <bitmap_andnot+0x55>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    117c <bitmap_andnot+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <slow_bitmap_andnot@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_andnot>:
cmp    $0x40,%ecx
ja     1127 <bitmap_andnot+0x17>
mov    (%rdx),%rcx
not    %rcx
xor    %eax,%eax
and    (%rsi),%rcx
mov    %rcx,(%rdi)
setne  %al
ret
jmp    1030 <slow_bitmap_andnot@plt>

LLVM IR (-O0):
define i32 @bitmap_andnot(i64* %0, i64* %1, i64* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca i32
store i64* %0, i64** %6
store i64* %1, i64** %7
store i64* %2, i64** %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = icmp ule i64 %11, 64
br i1 %12, label %13, label %23
13: ; preds = %4
%14 = load i64*, i64** %7
%15 = load i64, i64* %14
%16 = load i64*, i64** %8
%17 = load i64, i64* %16
%18 = xor i64 %17, -1
%19 = and i64 %15, %18
%20 = load i64*, i64** %6
store i64 %19, i64* %20
%21 = icmp ne i64 %19, 0
%22 = zext i1 %21 to i32
store i32 %22, i32* %5
br label %29
23: ; preds = %4
%24 = load i64*, i64** %6
%25 = load i64*, i64** %7
%26 = load i64*, i64** %8
%27 = load i32, i32* %9
%28 = call i32 @slow_bitmap_andnot(i64* %24, i64* %25, i64* %26, i32 %27)
store i32 %28, i32* %5
br label %29
29: ; preds = %23, %13
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @bitmap_andnot(i64* %0, i64* %1, i64* %2, i32 %3) {
%5 = icmp ult i32 %3, 65
br i1 %5, label %6, label %13
6: ; preds = %4
%7 = load i64, i64* %1
%8 = load i64, i64* %2
%9 = xor i64 %8, -1
%10 = and i64 %7, %9
store i64 %10, i64* %0
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
br label %15
13: ; preds = %4
%14 = tail call i32 @slow_bitmap_andnot(i64* %0, i64* %1, i64* %2, i32 %3)
br label %15
15: ; preds = %13, %6
%16 = phi i32 [ %12, %6 ], [ %14, %13 ]
ret i32 %16
}