#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 /*<<< orphan*/);
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 /*<<< orphan*/ 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 *);
scalar_t__ 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 && strcmp(string, expected))
    assert(0);
  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     1216 <check_cpuset+0x56>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1216 <check_cpuset+0x56>
xor    %edi,%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     1209 <check_cpuset+0x49>
mov    0x8(%rsp),%rdi
mov    %r14,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1209 <check_cpuset+0x49>
xor    %edi,%edi
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 %19
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = load i8*, i8** %4
%15 = call i64 @strcmp(i8* %13, i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @assert(i32 0)
br label %19
19: ; preds = %17, %12, %2
%20 = load i32, i32* %5
%21 = load i8*, i8** %6
%22 = call i32 @hwloc_bitmap_sscanf(i32 %20, i8* %21)
%23 = load i8*, i8** %6
%24 = call i32 @free(i8* %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %5
%27 = call i32 @hwloc_bitmap_isequal(i32 %25, i32 %26)
%28 = call i32 @assert(i32 %27)
%29 = load i32, i32* %3
%30 = call i32 @hwloc_bitmap_list_asprintf(i8** %6, i32 %29)
%31 = load i32, i32* %5
%32 = load i8*, i8** %6
%33 = call i32 @hwloc_bitmap_list_sscanf(i32 %31, i8* %32)
%34 = load i8*, i8** %6
%35 = call i32 @free(i8* %34)
%36 = load i32, i32* %3
%37 = load i32, i32* %5
%38 = call i32 @hwloc_bitmap_isequal(i32 %36, i32 %37)
%39 = call i32 @assert(i32 %38)
%40 = load i32, i32* %3
%41 = call i32 @hwloc_bitmap_taskset_asprintf(i8** %6, i32 %40)
%42 = load i32, i32* %5
%43 = load i8*, i8** %6
%44 = call i32 @hwloc_bitmap_taskset_sscanf(i32 %42, i8* %43)
%45 = load i8*, i8** %6
%46 = call i32 @free(i8* %45)
%47 = load i32, i32* %3
%48 = load i32, i32* %5
%49 = call i32 @hwloc_bitmap_isequal(i32 %47, i32 %48)
%50 = call i32 @assert(i32 %49)
%51 = load i32, i32* %5
%52 = call i32 @hwloc_bitmap_free(i32 %51)
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 i64 @strcmp(i8* %9, i8* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @assert(i32 0)
br label %14
14: ; preds = %12, %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
}