#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*/ free(char *);
int /*<<< orphan*/ hwloc_bitmap_alloc();
int /*<<< orphan*/ hwloc_bitmap_asprintf(char **, int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_free(int /*<<< orphan*/);
int hwloc_bitmap_isequal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_list_asprintf(char **, int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_list_sscanf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ hwloc_bitmap_sscanf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ hwloc_bitmap_taskset_asprintf(char **, int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_taskset_sscanf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strcmp(char *, char const *);
void check_cpuset(hwloc_bitmap_t set, const char *expected) {
  hwloc_bitmap_t set2 = hwloc_bitmap_alloc();
  char *string = NULL;
  hwloc_bitmap_asprintf(&string, set);
  if (expected)
    assert(!strcmp(string, expected));
  hwloc_bitmap_sscanf(set2, string);
  free(string);
  assert(hwloc_bitmap_isequal(set, set2));
  hwloc_bitmap_list_asprintf(&string, set);
  hwloc_bitmap_list_sscanf(set2, string);
  free(string);
  assert(hwloc_bitmap_isequal(set, set2));
  hwloc_bitmap_taskset_asprintf(&string, set);
  hwloc_bitmap_taskset_sscanf(set2, string);
  free(string);
  assert(hwloc_bitmap_isequal(set, set2));
  hwloc_bitmap_free(set2);
}


x86 assembly (clang, -O0):
<check_cpuset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%esi
lea    -0x20(%rbp),%rdi
call   1060 <hwloc_bitmap_asprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1217 <check_cpuset+0x57>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   10c0 <hwloc_bitmap_sscanf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10b0 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    -0x4(%rbp),%esi
lea    -0x20(%rbp),%rdi
call   10d0 <hwloc_bitmap_list_asprintf@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   10e0 <hwloc_bitmap_list_sscanf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10b0 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    -0x4(%rbp),%esi
lea    -0x20(%rbp),%rdi
call   1070 <hwloc_bitmap_taskset_asprintf@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   10a0 <hwloc_bitmap_taskset_sscanf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10b0 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    -0x14(%rbp),%edi
call   1050 <hwloc_bitmap_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_cpuset>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,%ebx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    %ebp,%esi
call   1060 <hwloc_bitmap_asprintf@plt>
test   %r14,%r14
je     120a <check_cpuset+0x4a>
mov    0x8(%rsp),%rdi
mov    %r14,%rsi
call   1080 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1090 <assert@plt>
mov    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10c0 <hwloc_bitmap_sscanf@plt>
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   10b0 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1090 <assert@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    %ebp,%esi
call   10d0 <hwloc_bitmap_list_asprintf@plt>
mov    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10e0 <hwloc_bitmap_list_sscanf@plt>
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   10b0 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1070 <hwloc_bitmap_taskset_asprintf@plt>
mov    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10a0 <hwloc_bitmap_taskset_sscanf@plt>
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   10b0 <hwloc_bitmap_isequal@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    %ebx,%edi
call   1050 <hwloc_bitmap_free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @check_cpuset(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = call i32 (...) @hwloc_bitmap_alloc()
store i32 %7, i32* %5
store i8* null, i8** %6
%8 = load i32, i32* %3
%9 = call i32 @hwloc_bitmap_asprintf(i8** %6, i32 %8)
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = load i8*, i8** %4
%15 = call i32 @strcmp(i8* %13, i8* %14)
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
br label %20
20: ; preds = %12, %2
%21 = load i32, i32* %5
%22 = load i8*, i8** %6
%23 = call i32 @hwloc_bitmap_sscanf(i32 %21, i8* %22)
%24 = load i8*, i8** %6
%25 = call i32 @free(i8* %24)
%26 = load i32, i32* %3
%27 = load i32, i32* %5
%28 = call i32 @hwloc_bitmap_isequal(i32 %26, i32 %27)
%29 = call i32 @assert(i32 %28)
%30 = load i32, i32* %3
%31 = call i32 @hwloc_bitmap_list_asprintf(i8** %6, i32 %30)
%32 = load i32, i32* %5
%33 = load i8*, i8** %6
%34 = call i32 @hwloc_bitmap_list_sscanf(i32 %32, i8* %33)
%35 = load i8*, i8** %6
%36 = call i32 @free(i8* %35)
%37 = load i32, i32* %3
%38 = load i32, i32* %5
%39 = call i32 @hwloc_bitmap_isequal(i32 %37, i32 %38)
%40 = call i32 @assert(i32 %39)
%41 = load i32, i32* %3
%42 = call i32 @hwloc_bitmap_taskset_asprintf(i8** %6, i32 %41)
%43 = load i32, i32* %5
%44 = load i8*, i8** %6
%45 = call i32 @hwloc_bitmap_taskset_sscanf(i32 %43, i8* %44)
%46 = load i8*, i8** %6
%47 = call i32 @free(i8* %46)
%48 = load i32, i32* %3
%49 = load i32, i32* %5
%50 = call i32 @hwloc_bitmap_isequal(i32 %48, i32 %49)
%51 = call i32 @assert(i32 %50)
%52 = load i32, i32* %5
%53 = call i32 @hwloc_bitmap_free(i32 %52)
ret void
}

LLVM IR (-O2):
define void @check_cpuset(i32 %0, i8* %1) {
%3 = alloca i8*
%4 = tail call i32 (...) @hwloc_bitmap_alloc()
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = call i32 @hwloc_bitmap_asprintf(i8** %3, i32 %0)
%7 = icmp eq i8* %1, null
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @strcmp(i8* dereferenceable(1) %9, i8* %1)
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
br label %14
14: ; preds = %8, %2
%15 = load i8*, i8** %3
%16 = call i32 @hwloc_bitmap_sscanf(i32 %4, i8* %15)
%17 = load i8*, i8** %3
%18 = call i32 @free(i8* %17)
%19 = call i32 @hwloc_bitmap_isequal(i32 %0, i32 %4)
%20 = call i32 @assert(i32 %19)
%21 = call i32 @hwloc_bitmap_list_asprintf(i8** %3, i32 %0)
%22 = load i8*, i8** %3
%23 = call i32 @hwloc_bitmap_list_sscanf(i32 %4, i8* %22)
%24 = load i8*, i8** %3
%25 = call i32 @free(i8* %24)
%26 = call i32 @hwloc_bitmap_isequal(i32 %0, i32 %4)
%27 = call i32 @assert(i32 %26)
%28 = call i32 @hwloc_bitmap_taskset_asprintf(i8** %3, i32 %0)
%29 = load i8*, i8** %3
%30 = call i32 @hwloc_bitmap_taskset_sscanf(i32 %4, i8* %29)
%31 = load i8*, i8** %3
%32 = call i32 @free(i8* %31)
%33 = call i32 @hwloc_bitmap_isequal(i32 %0, i32 %4)
%34 = call i32 @assert(i32 %33)
%35 = call i32 @hwloc_bitmap_free(i32 %4)
ret void
}