#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 /*<<< orphan*/ hwloc_bitmap_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ hwloc_bitmap_alloc();
int /*<<< orphan*/ hwloc_bitmap_compare(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_fill(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_free(int /*<<< orphan*/);
int hwloc_bitmap_isequal(int /*<<< orphan*/, int /*<<< orphan*/);
int hwloc_bitmap_iszero(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_set(int /*<<< orphan*/, int);
int /*<<< orphan*/ hwloc_bitmap_singlify(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_zero(int /*<<< orphan*/);
int main(void) {
  hwloc_bitmap_t orig, expected;
  orig = hwloc_bitmap_alloc();
  expected = hwloc_bitmap_alloc();
  hwloc_bitmap_singlify(orig);
  assert(hwloc_bitmap_iszero(orig));
  hwloc_bitmap_fill(orig);
  hwloc_bitmap_singlify(orig);
  hwloc_bitmap_zero(expected);
  hwloc_bitmap_set(expected, 0);
  assert(hwloc_bitmap_isequal(orig, expected));
  assert(!hwloc_bitmap_compare(orig, expected));
  hwloc_bitmap_zero(orig);
  hwloc_bitmap_set(orig, 45);
  hwloc_bitmap_set(orig, 46);
  hwloc_bitmap_set(orig, 517);
  hwloc_bitmap_singlify(orig);
  hwloc_bitmap_zero(expected);
  hwloc_bitmap_set(expected, 45);
  assert(hwloc_bitmap_isequal(orig, expected));
  assert(!hwloc_bitmap_compare(orig, expected));
  hwloc_bitmap_free(orig);
  hwloc_bitmap_free(expected);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   10b0 <hwloc_bitmap_singlify@plt>
mov    -0x8(%rbp),%edi
call   1050 <hwloc_bitmap_iszero@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%edi
call   10c0 <hwloc_bitmap_fill@plt>
mov    -0x8(%rbp),%edi
call   10b0 <hwloc_bitmap_singlify@plt>
mov    -0xc(%rbp),%edi
call   10a0 <hwloc_bitmap_zero@plt>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1090 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <hwloc_bitmap_compare@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%edi
call   10a0 <hwloc_bitmap_zero@plt>
mov    -0x8(%rbp),%edi
mov    $0x2d,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    -0x8(%rbp),%edi
mov    $0x2e,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    -0x8(%rbp),%edi
mov    $0x205,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    -0x8(%rbp),%edi
call   10b0 <hwloc_bitmap_singlify@plt>
mov    -0xc(%rbp),%edi
call   10a0 <hwloc_bitmap_zero@plt>
mov    -0xc(%rbp),%edi
mov    $0x2d,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1090 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <hwloc_bitmap_compare@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%edi
call   1040 <hwloc_bitmap_free@plt>
mov    -0xc(%rbp),%edi
call   1040 <hwloc_bitmap_free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   10b0 <hwloc_bitmap_singlify@plt>
mov    %ebx,%edi
call   1050 <hwloc_bitmap_iszero@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    %ebx,%edi
call   10c0 <hwloc_bitmap_fill@plt>
mov    %ebx,%edi
call   10b0 <hwloc_bitmap_singlify@plt>
mov    %ebp,%edi
call   10a0 <hwloc_bitmap_zero@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1090 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <hwloc_bitmap_compare@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    %ebx,%edi
call   10a0 <hwloc_bitmap_zero@plt>
mov    %ebx,%edi
mov    $0x2d,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    %ebx,%edi
mov    $0x2e,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    %ebx,%edi
mov    $0x205,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    %ebx,%edi
call   10b0 <hwloc_bitmap_singlify@plt>
mov    %ebp,%edi
call   10a0 <hwloc_bitmap_zero@plt>
mov    %ebp,%edi
mov    $0x2d,%esi
call   1060 <hwloc_bitmap_set@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1090 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <hwloc_bitmap_compare@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    %ebx,%edi
call   1040 <hwloc_bitmap_free@plt>
mov    %ebp,%edi
call   1040 <hwloc_bitmap_free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @hwloc_bitmap_alloc()
store i32 %4, i32* %2
%5 = call i32 (...) @hwloc_bitmap_alloc()
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @hwloc_bitmap_singlify(i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @hwloc_bitmap_iszero(i32 %8)
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @hwloc_bitmap_fill(i32 %11)
%13 = load i32, i32* %2
%14 = call i32 @hwloc_bitmap_singlify(i32 %13)
%15 = load i32, i32* %3
%16 = call i32 @hwloc_bitmap_zero(i32 %15)
%17 = load i32, i32* %3
%18 = call i32 @hwloc_bitmap_set(i32 %17, i32 0)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @hwloc_bitmap_isequal(i32 %19, i32 %20)
%22 = call i32 @assert(i32 %21)
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @hwloc_bitmap_compare(i32 %23, i32 %24)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load i32, i32* %2
%31 = call i32 @hwloc_bitmap_zero(i32 %30)
%32 = load i32, i32* %2
%33 = call i32 @hwloc_bitmap_set(i32 %32, i32 45)
%34 = load i32, i32* %2
%35 = call i32 @hwloc_bitmap_set(i32 %34, i32 46)
%36 = load i32, i32* %2
%37 = call i32 @hwloc_bitmap_set(i32 %36, i32 517)
%38 = load i32, i32* %2
%39 = call i32 @hwloc_bitmap_singlify(i32 %38)
%40 = load i32, i32* %3
%41 = call i32 @hwloc_bitmap_zero(i32 %40)
%42 = load i32, i32* %3
%43 = call i32 @hwloc_bitmap_set(i32 %42, i32 45)
%44 = load i32, i32* %2
%45 = load i32, i32* %3
%46 = call i32 @hwloc_bitmap_isequal(i32 %44, i32 %45)
%47 = call i32 @assert(i32 %46)
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = call i32 @hwloc_bitmap_compare(i32 %48, i32 %49)
%51 = icmp ne i32 %50, 0
%52 = xor i1 %51, true
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = load i32, i32* %2
%56 = call i32 @hwloc_bitmap_free(i32 %55)
%57 = load i32, i32* %3
%58 = call i32 @hwloc_bitmap_free(i32 %57)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @hwloc_bitmap_alloc()
%2 = tail call i32 (...) @hwloc_bitmap_alloc()
%3 = tail call i32 @hwloc_bitmap_singlify(i32 %1)
%4 = tail call i32 @hwloc_bitmap_iszero(i32 %1)
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @hwloc_bitmap_fill(i32 %1)
%7 = tail call i32 @hwloc_bitmap_singlify(i32 %1)
%8 = tail call i32 @hwloc_bitmap_zero(i32 %2)
%9 = tail call i32 @hwloc_bitmap_set(i32 %2, i32 0)
%10 = tail call i32 @hwloc_bitmap_isequal(i32 %1, i32 %2)
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i32 @hwloc_bitmap_compare(i32 %1, i32 %2)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @hwloc_bitmap_zero(i32 %1)
%17 = tail call i32 @hwloc_bitmap_set(i32 %1, i32 45)
%18 = tail call i32 @hwloc_bitmap_set(i32 %1, i32 46)
%19 = tail call i32 @hwloc_bitmap_set(i32 %1, i32 517)
%20 = tail call i32 @hwloc_bitmap_singlify(i32 %1)
%21 = tail call i32 @hwloc_bitmap_zero(i32 %2)
%22 = tail call i32 @hwloc_bitmap_set(i32 %2, i32 45)
%23 = tail call i32 @hwloc_bitmap_isequal(i32 %1, i32 %2)
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @hwloc_bitmap_compare(i32 %1, i32 %2)
%26 = icmp eq i32 %25, 0
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = tail call i32 @hwloc_bitmap_free(i32 %1)
%30 = tail call i32 @hwloc_bitmap_free(i32 %2)
ret i32 0
}