#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_topology_t;
typedef int /*<<< orphan*/ *hwloc_obj_t;
typedef int /*<<< orphan*/ hwloc_bitmap_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ HWLOC_OBJ_NODE;
int /*<<< orphan*/ HWLOC_OBJ_SOCKET;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ hwloc_bitmap_alloc();
int /*<<< orphan*/ hwloc_bitmap_free(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_bitmap_sscanf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *hwloc_get_next_obj_covering_cpuset_by_depth(
    int /*<<< orphan*/, int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *hwloc_get_next_obj_covering_cpuset_by_type(
    int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
    int /*<<< orphan*/ *);
int /*<<< orphan*/ *hwloc_get_obj_by_depth(int /*<<< orphan*/, int, int);
int hwloc_get_type_depth(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_topology_destroy(int /*<<< orphan*/);
int hwloc_topology_init(int /*<<< orphan*/ *);
int hwloc_topology_load(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_topology_set_synthetic(int /*<<< orphan*/, char *);
int main(void) {
  hwloc_topology_t topology;
  hwloc_bitmap_t set;
  hwloc_obj_t obj;
  int depth;
  int err;
  err = hwloc_topology_init(&topology);
  if (err)
    return EXIT_FAILURE;
  set = hwloc_bitmap_alloc();
  hwloc_topology_set_synthetic(topology, "nodes:8 cores:2 1");
  err = hwloc_topology_load(topology);
  if (err)
    return EXIT_FAILURE;
  hwloc_bitmap_sscanf(set, "00008f18");
  obj = hwloc_get_next_obj_covering_cpuset_by_type(topology, set,
                                                   HWLOC_OBJ_NODE, NULL);
  assert(obj == hwloc_get_obj_by_depth(topology, 1, 1));
  obj = hwloc_get_next_obj_covering_cpuset_by_type(topology, set,
                                                   HWLOC_OBJ_NODE, obj);
  assert(obj == hwloc_get_obj_by_depth(topology, 1, 2));
  obj = hwloc_get_next_obj_covering_cpuset_by_type(topology, set,
                                                   HWLOC_OBJ_NODE, obj);
  assert(obj == hwloc_get_obj_by_depth(topology, 1, 4));
  obj = hwloc_get_next_obj_covering_cpuset_by_type(topology, set,
                                                   HWLOC_OBJ_NODE, obj);
  assert(obj == hwloc_get_obj_by_depth(topology, 1, 5));
  obj = hwloc_get_next_obj_covering_cpuset_by_type(topology, set,
                                                   HWLOC_OBJ_NODE, obj);
  assert(obj == hwloc_get_obj_by_depth(topology, 1, 7));
  obj = hwloc_get_next_obj_covering_cpuset_by_type(topology, set,
                                                   HWLOC_OBJ_NODE, obj);
  assert(!obj);
  hwloc_topology_set_synthetic(topology, "nodes:2 socket:5 cores:3 4");
  err = hwloc_topology_load(topology);
  if (err)
    return EXIT_FAILURE;
  hwloc_bitmap_sscanf(set, "0ff08000");
  depth = hwloc_get_type_depth(topology, HWLOC_OBJ_SOCKET);
  assert(depth == 2);
  obj = hwloc_get_next_obj_covering_cpuset_by_depth(topology, set, depth, NULL);
  assert(obj == hwloc_get_obj_by_depth(topology, depth, 1));
  obj = hwloc_get_next_obj_covering_cpuset_by_depth(topology, set, depth, obj);
  assert(obj == hwloc_get_obj_by_depth(topology, depth, 2));
  obj = hwloc_get_next_obj_covering_cpuset_by_depth(topology, set, depth, obj);
  assert(!obj);
  hwloc_bitmap_free(set);
  hwloc_topology_destroy(topology);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <hwloc_topology_init@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11f6 <main+0x36>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    152b <main+0x36b>
mov    $0x0,%al
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    0xdf6(%rip),%rsi
call   10c0 <hwloc_topology_set_synthetic@plt>
mov    -0x8(%rbp),%edi
call   1070 <hwloc_topology_load@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1235 <main+0x75>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    152b <main+0x36b>
mov    -0xc(%rbp),%edi
lea    0xdd3(%rip),%rsi
call   10d0 <hwloc_bitmap_sscanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2d97(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <hwloc_get_obj_by_depth@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2d4d(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2d00(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2cb3(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
mov    $0x5,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2c66(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
mov    $0x7,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2c19(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
lea    0xc1f(%rip),%rsi
call   10c0 <hwloc_topology_set_synthetic@plt>
mov    -0x8(%rbp),%edi
call   1070 <hwloc_topology_load@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1427 <main+0x267>
mov    0x2bb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    152b <main+0x36b>
mov    -0xc(%rbp),%edi
lea    0xc05(%rip),%rsi
call   10d0 <hwloc_bitmap_sscanf@plt>
mov    -0x8(%rbp),%edi
mov    0x2ba0(%rip),%rax
mov    (%rax),%esi
call   1080 <hwloc_get_type_depth@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   10b0 <hwloc_get_next_obj_covering_cpuset_by_depth@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x1,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   10b0 <hwloc_get_next_obj_covering_cpuset_by_depth@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x2,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   10b0 <hwloc_get_next_obj_covering_cpuset_by_depth@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0xc(%rbp),%edi
call   1050 <hwloc_bitmap_free@plt>
mov    -0x8(%rbp),%edi
call   10e0 <hwloc_topology_destroy@plt>
mov    0x2aa2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rdi
call   1060 <hwloc_topology_init@plt>
mov    0x2df8(%rip),%rbx
test   %eax,%eax
jne    143a <main+0x27a>
xor    %eax,%eax
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,%r15d
mov    0x4(%rsp),%edi
lea    0xe0b(%rip),%rsi
call   10c0 <hwloc_topology_set_synthetic@plt>
mov    0x4(%rsp),%edi
call   1070 <hwloc_topology_load@plt>
test   %eax,%eax
jne    143a <main+0x27a>
lea    0xe00(%rip),%rsi
mov    %r15d,%edi
call   10d0 <hwloc_bitmap_sscanf@plt>
mov    0x4(%rsp),%edi
mov    0x2dc3(%rip),%r14
mov    (%r14),%edx
mov    %r15d,%esi
xor    %ecx,%ecx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,%rbp
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
xor    %edi,%edi
cmp    %rax,%rbp
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    (%r14),%edx
mov    %r15d,%esi
mov    %rbp,%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,%rbp
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
xor    %edi,%edi
cmp    %rax,%rbp
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    (%r14),%edx
mov    %r15d,%esi
mov    %rbp,%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,%rbp
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
xor    %edi,%edi
cmp    %rax,%rbp
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    (%r14),%edx
mov    %r15d,%esi
mov    %rbp,%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,%rbp
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    $0x5,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
xor    %edi,%edi
cmp    %rax,%rbp
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    (%r14),%edx
mov    %r15d,%esi
mov    %rbp,%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
mov    %rax,%rbp
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    $0x7,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
xor    %edi,%edi
cmp    %rax,%rbp
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    (%r14),%edx
mov    %r15d,%esi
mov    %rbp,%rcx
call   10a0 <hwloc_get_next_obj_covering_cpuset_by_type@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
lea    0xcc2(%rip),%rsi
call   10c0 <hwloc_topology_set_synthetic@plt>
mov    0x4(%rsp),%edi
call   1070 <hwloc_topology_load@plt>
test   %eax,%eax
jne    143a <main+0x27a>
lea    0xcc0(%rip),%rsi
mov    %r15d,%edi
call   10d0 <hwloc_bitmap_sscanf@plt>
mov    0x4(%rsp),%edi
mov    0x2c57(%rip),%rax
mov    (%rax),%esi
call   1080 <hwloc_get_type_depth@plt>
mov    %eax,%ebp
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    %r15d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   10b0 <hwloc_get_next_obj_covering_cpuset_by_depth@plt>
mov    %rax,%r14
mov    0x4(%rsp),%edi
mov    %ebp,%esi
mov    $0x1,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
xor    %edi,%edi
cmp    %rax,%r14
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14,%rcx
call   10b0 <hwloc_get_next_obj_covering_cpuset_by_depth@plt>
mov    %rax,%r14
mov    0x4(%rsp),%edi
mov    %ebp,%esi
mov    $0x2,%edx
call   1040 <hwloc_get_obj_by_depth@plt>
xor    %edi,%edi
cmp    %rax,%r14
sete   %dil
call   1090 <assert@plt>
mov    0x4(%rsp),%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14,%rcx
call   10b0 <hwloc_get_next_obj_covering_cpuset_by_depth@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
mov    %r15d,%edi
call   1050 <hwloc_bitmap_free@plt>
mov    0x4(%rsp),%edi
call   10e0 <hwloc_topology_destroy@plt>
mov    0x2b8e(%rip),%rbx
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [18 x i8] c"nodes:8 cores:2 1\00"
@.str.1 = [9 x i8] c"00008f18\00"
@HWLOC_OBJ_NODE = global i32 0
@.str.2 = [27 x i8] c"nodes:2 socket:5 cores:3 4\00"
@.str.3 = [9 x i8] c"0ff08000\00"
@HWLOC_OBJ_SOCKET = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @hwloc_topology_init(i32* %2)
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = load i32, i32* @EXIT_FAILURE
store i32 %11, i32* %1
br label %145
12: ; preds = %0
%13 = call i32 (...) @hwloc_bitmap_alloc()
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = call i32 @hwloc_topology_set_synthetic(i32 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = call i32 @hwloc_topology_load(i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = load i32, i32* @EXIT_FAILURE
store i32 %21, i32* %1
br label %145
22: ; preds = %12
%23 = load i32, i32* %3
%24 = call i32 @hwloc_bitmap_sscanf(i32 %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = load i32, i32* @HWLOC_OBJ_NODE
%28 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %25, i32 %26, i32 %27, i32* null)
store i32* %28, i32** %4
%29 = load i32*, i32** %4
%30 = load i32, i32* %2
%31 = call i32* @hwloc_get_obj_by_depth(i32 %30, i32 1, i32 1)
%32 = icmp eq i32* %29, %31
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = load i32, i32* @HWLOC_OBJ_NODE
%38 = load i32*, i32** %4
%39 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %35, i32 %36, i32 %37, i32* %38)
store i32* %39, i32** %4
%40 = load i32*, i32** %4
%41 = load i32, i32* %2
%42 = call i32* @hwloc_get_obj_by_depth(i32 %41, i32 1, i32 2)
%43 = icmp eq i32* %40, %42
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = load i32, i32* @HWLOC_OBJ_NODE
%49 = load i32*, i32** %4
%50 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %46, i32 %47, i32 %48, i32* %49)
store i32* %50, i32** %4
%51 = load i32*, i32** %4
%52 = load i32, i32* %2
%53 = call i32* @hwloc_get_obj_by_depth(i32 %52, i32 1, i32 4)
%54 = icmp eq i32* %51, %53
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i32, i32* %2
%58 = load i32, i32* %3
%59 = load i32, i32* @HWLOC_OBJ_NODE
%60 = load i32*, i32** %4
%61 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %57, i32 %58, i32 %59, i32* %60)
store i32* %61, i32** %4
%62 = load i32*, i32** %4
%63 = load i32, i32* %2
%64 = call i32* @hwloc_get_obj_by_depth(i32 %63, i32 1, i32 5)
%65 = icmp eq i32* %62, %64
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load i32, i32* %2
%69 = load i32, i32* %3
%70 = load i32, i32* @HWLOC_OBJ_NODE
%71 = load i32*, i32** %4
%72 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %68, i32 %69, i32 %70, i32* %71)
store i32* %72, i32** %4
%73 = load i32*, i32** %4
%74 = load i32, i32* %2
%75 = call i32* @hwloc_get_obj_by_depth(i32 %74, i32 1, i32 7)
%76 = icmp eq i32* %73, %75
%77 = zext i1 %76 to i32
%78 = call i32 @assert(i32 %77)
%79 = load i32, i32* %2
%80 = load i32, i32* %3
%81 = load i32, i32* @HWLOC_OBJ_NODE
%82 = load i32*, i32** %4
%83 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %79, i32 %80, i32 %81, i32* %82)
store i32* %83, i32** %4
%84 = load i32*, i32** %4
%85 = icmp ne i32* %84, null
%86 = xor i1 %85, true
%87 = zext i1 %86 to i32
%88 = call i32 @assert(i32 %87)
%89 = load i32, i32* %2
%90 = call i32 @hwloc_topology_set_synthetic(i32 %89, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%91 = load i32, i32* %2
%92 = call i32 @hwloc_topology_load(i32 %91)
store i32 %92, i32* %6
%93 = load i32, i32* %6
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %22
%96 = load i32, i32* @EXIT_FAILURE
store i32 %96, i32* %1
br label %145
97: ; preds = %22
%98 = load i32, i32* %3
%99 = call i32 @hwloc_bitmap_sscanf(i32 %98, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%100 = load i32, i32* %2
%101 = load i32, i32* @HWLOC_OBJ_SOCKET
%102 = call i32 @hwloc_get_type_depth(i32 %100, i32 %101)
store i32 %102, i32* %5
%103 = load i32, i32* %5
%104 = icmp eq i32 %103, 2
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = load i32, i32* %2
%108 = load i32, i32* %3
%109 = load i32, i32* %5
%110 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %107, i32 %108, i32 %109, i32* null)
store i32* %110, i32** %4
%111 = load i32*, i32** %4
%112 = load i32, i32* %2
%113 = load i32, i32* %5
%114 = call i32* @hwloc_get_obj_by_depth(i32 %112, i32 %113, i32 1)
%115 = icmp eq i32* %111, %114
%116 = zext i1 %115 to i32
%117 = call i32 @assert(i32 %116)
%118 = load i32, i32* %2
%119 = load i32, i32* %3
%120 = load i32, i32* %5
%121 = load i32*, i32** %4
%122 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %118, i32 %119, i32 %120, i32* %121)
store i32* %122, i32** %4
%123 = load i32*, i32** %4
%124 = load i32, i32* %2
%125 = load i32, i32* %5
%126 = call i32* @hwloc_get_obj_by_depth(i32 %124, i32 %125, i32 2)
%127 = icmp eq i32* %123, %126
%128 = zext i1 %127 to i32
%129 = call i32 @assert(i32 %128)
%130 = load i32, i32* %2
%131 = load i32, i32* %3
%132 = load i32, i32* %5
%133 = load i32*, i32** %4
%134 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %130, i32 %131, i32 %132, i32* %133)
store i32* %134, i32** %4
%135 = load i32*, i32** %4
%136 = icmp ne i32* %135, null
%137 = xor i1 %136, true
%138 = zext i1 %137 to i32
%139 = call i32 @assert(i32 %138)
%140 = load i32, i32* %3
%141 = call i32 @hwloc_bitmap_free(i32 %140)
%142 = load i32, i32* %2
%143 = call i32 @hwloc_topology_destroy(i32 %142)
%144 = load i32, i32* @EXIT_SUCCESS
store i32 %144, i32* %1
br label %145
145: ; preds = %97, %95, %20, %10
%146 = load i32, i32* %1
ret i32 %146
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [18 x i8] c"nodes:8 cores:2 1\00"
@.str.1 = [9 x i8] c"00008f18\00"
@HWLOC_OBJ_NODE = global i32 0
@.str.2 = [27 x i8] c"nodes:2 socket:5 cores:3 4\00"
@.str.3 = [9 x i8] c"0ff08000\00"
@HWLOC_OBJ_SOCKET = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @hwloc_topology_init(i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %95
5: ; preds = %0
%6 = call i32 (...) @hwloc_bitmap_alloc()
%7 = load i32, i32* %1
%8 = call i32 @hwloc_topology_set_synthetic(i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = call i32 @hwloc_topology_load(i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %95
12: ; preds = %5
%13 = call i32 @hwloc_bitmap_sscanf(i32 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = load i32, i32* @HWLOC_OBJ_NODE
%16 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %14, i32 %6, i32 %15, i32* null)
%17 = load i32, i32* %1
%18 = call i32* @hwloc_get_obj_by_depth(i32 %17, i32 1, i32 1)
%19 = icmp eq i32* %16, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* %1
%23 = load i32, i32* @HWLOC_OBJ_NODE
%24 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %22, i32 %6, i32 %23, i32* %16)
%25 = load i32, i32* %1
%26 = call i32* @hwloc_get_obj_by_depth(i32 %25, i32 1, i32 2)
%27 = icmp eq i32* %24, %26
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load i32, i32* %1
%31 = load i32, i32* @HWLOC_OBJ_NODE
%32 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %30, i32 %6, i32 %31, i32* %24)
%33 = load i32, i32* %1
%34 = call i32* @hwloc_get_obj_by_depth(i32 %33, i32 1, i32 4)
%35 = icmp eq i32* %32, %34
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = load i32, i32* %1
%39 = load i32, i32* @HWLOC_OBJ_NODE
%40 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %38, i32 %6, i32 %39, i32* %32)
%41 = load i32, i32* %1
%42 = call i32* @hwloc_get_obj_by_depth(i32 %41, i32 1, i32 5)
%43 = icmp eq i32* %40, %42
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load i32, i32* %1
%47 = load i32, i32* @HWLOC_OBJ_NODE
%48 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %46, i32 %6, i32 %47, i32* %40)
%49 = load i32, i32* %1
%50 = call i32* @hwloc_get_obj_by_depth(i32 %49, i32 1, i32 7)
%51 = icmp eq i32* %48, %50
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = load i32, i32* %1
%55 = load i32, i32* @HWLOC_OBJ_NODE
%56 = call i32* @hwloc_get_next_obj_covering_cpuset_by_type(i32 %54, i32 %6, i32 %55, i32* %48)
%57 = icmp eq i32* %56, null
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = load i32, i32* %1
%61 = call i32 @hwloc_topology_set_synthetic(i32 %60, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%62 = load i32, i32* %1
%63 = call i32 @hwloc_topology_load(i32 %62)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %95
65: ; preds = %12
%66 = call i32 @hwloc_bitmap_sscanf(i32 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%67 = load i32, i32* %1
%68 = load i32, i32* @HWLOC_OBJ_SOCKET
%69 = call i32 @hwloc_get_type_depth(i32 %67, i32 %68)
%70 = icmp eq i32 %69, 2
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
%73 = load i32, i32* %1
%74 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %73, i32 %6, i32 %69, i32* null)
%75 = load i32, i32* %1
%76 = call i32* @hwloc_get_obj_by_depth(i32 %75, i32 %69, i32 1)
%77 = icmp eq i32* %74, %76
%78 = zext i1 %77 to i32
%79 = call i32 @assert(i32 %78)
%80 = load i32, i32* %1
%81 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %80, i32 %6, i32 %69, i32* %74)
%82 = load i32, i32* %1
%83 = call i32* @hwloc_get_obj_by_depth(i32 %82, i32 %69, i32 2)
%84 = icmp eq i32* %81, %83
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = load i32, i32* %1
%88 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %87, i32 %6, i32 %69, i32* %81)
%89 = icmp eq i32* %88, null
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = call i32 @hwloc_bitmap_free(i32 %6)
%93 = load i32, i32* %1
%94 = call i32 @hwloc_topology_destroy(i32 %93)
br label %95
95: ; preds = %12, %5, %0, %65
%96 = phi i32* [ @EXIT_SUCCESS, %65 ], [ @EXIT_FAILURE, %0 ], [ @EXIT_FAILURE, %5 ], [ @EXIT_FAILURE, %12 ]
%97 = load i32, i32* %96
ret i32 %97
}