#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;
  set = hwloc_bitmap_alloc();
  err = hwloc_topology_init(&topology);
  if (err)
    return EXIT_FAILURE;
  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_destroy(topology);
  err = hwloc_topology_init(&topology);
  if (err)
    return EXIT_FAILURE;
  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_topology_destroy(topology);
  hwloc_bitmap_free(set);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <hwloc_topology_init@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1200 <main+0x40>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    155a <main+0x39a>
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    155a <main+0x39a>
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
call   10e0 <hwloc_topology_destroy@plt>
lea    -0x8(%rbp),%rdi
call   1060 <hwloc_topology_init@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1421 <main+0x261>
mov    0x2bb9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    155a <main+0x39a>
mov    -0x8(%rbp),%edi
lea    0xbf0(%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     1456 <main+0x296>
mov    0x2b84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    155a <main+0x39a>
mov    -0xc(%rbp),%edi
lea    0xbd6(%rip),%rsi
call   10d0 <hwloc_bitmap_sscanf@plt>
mov    -0x8(%rbp),%edi
mov    0x2b71(%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    -0x8(%rbp),%edi
call   10e0 <hwloc_topology_destroy@plt>
mov    -0xc(%rbp),%edi
call   1050 <hwloc_bitmap_free@plt>
mov    0x2a73(%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
xor    %eax,%eax
call   1030 <hwloc_bitmap_alloc@plt>
mov    %eax,%r15d
lea    0x4(%rsp),%rdi
call   1060 <hwloc_topology_init@plt>
mov    0x2dee(%rip),%rbx
test   %eax,%eax
jne    1455 <main+0x295>
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    1455 <main+0x295>
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
call   10e0 <hwloc_topology_destroy@plt>
lea    0x4(%rsp),%rdi
call   1060 <hwloc_topology_init@plt>
test   %eax,%eax
jne    1455 <main+0x295>
mov    0x4(%rsp),%edi
lea    0xca7(%rip),%rsi
call   10c0 <hwloc_topology_set_synthetic@plt>
mov    0x4(%rsp),%edi
call   1070 <hwloc_topology_load@plt>
test   %eax,%eax
jne    1455 <main+0x295>
lea    0xca5(%rip),%rsi
mov    %r15d,%edi
call   10d0 <hwloc_bitmap_sscanf@plt>
mov    0x4(%rsp),%edi
mov    0x2c3c(%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    0x4(%rsp),%edi
call   10e0 <hwloc_topology_destroy@plt>
mov    %r15d,%edi
call   1050 <hwloc_bitmap_free@plt>
mov    0x2b73(%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_bitmap_alloc()
store i32 %7, i32* %3
%8 = call i32 @hwloc_topology_init(i32* %2)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = load i32, i32* @EXIT_FAILURE
store i32 %12, i32* %1
br label %153
13: ; preds = %0
%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 = %13
%21 = load i32, i32* @EXIT_FAILURE
store i32 %21, i32* %1
br label %153
22: ; preds = %13
%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_destroy(i32 %89)
%91 = call i32 @hwloc_topology_init(i32* %2)
store i32 %91, i32* %6
%92 = load i32, i32* %6
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %22
%95 = load i32, i32* @EXIT_FAILURE
store i32 %95, i32* %1
br label %153
96: ; preds = %22
%97 = load i32, i32* %2
%98 = call i32 @hwloc_topology_set_synthetic(i32 %97, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%99 = load i32, i32* %2
%100 = call i32 @hwloc_topology_load(i32 %99)
store i32 %100, i32* %6
%101 = load i32, i32* %6
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %96
%104 = load i32, i32* @EXIT_FAILURE
store i32 %104, i32* %1
br label %153
105: ; preds = %96
%106 = load i32, i32* %3
%107 = call i32 @hwloc_bitmap_sscanf(i32 %106, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%108 = load i32, i32* %2
%109 = load i32, i32* @HWLOC_OBJ_SOCKET
%110 = call i32 @hwloc_get_type_depth(i32 %108, i32 %109)
store i32 %110, i32* %5
%111 = load i32, i32* %5
%112 = icmp eq i32 %111, 2
%113 = zext i1 %112 to i32
%114 = call i32 @assert(i32 %113)
%115 = load i32, i32* %2
%116 = load i32, i32* %3
%117 = load i32, i32* %5
%118 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %115, i32 %116, i32 %117, i32* null)
store i32* %118, i32** %4
%119 = load i32*, i32** %4
%120 = load i32, i32* %2
%121 = load i32, i32* %5
%122 = call i32* @hwloc_get_obj_by_depth(i32 %120, i32 %121, i32 1)
%123 = icmp eq i32* %119, %122
%124 = zext i1 %123 to i32
%125 = call i32 @assert(i32 %124)
%126 = load i32, i32* %2
%127 = load i32, i32* %3
%128 = load i32, i32* %5
%129 = load i32*, i32** %4
%130 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %126, i32 %127, i32 %128, i32* %129)
store i32* %130, i32** %4
%131 = load i32*, i32** %4
%132 = load i32, i32* %2
%133 = load i32, i32* %5
%134 = call i32* @hwloc_get_obj_by_depth(i32 %132, i32 %133, i32 2)
%135 = icmp eq i32* %131, %134
%136 = zext i1 %135 to i32
%137 = call i32 @assert(i32 %136)
%138 = load i32, i32* %2
%139 = load i32, i32* %3
%140 = load i32, i32* %5
%141 = load i32*, i32** %4
%142 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %138, i32 %139, i32 %140, i32* %141)
store i32* %142, i32** %4
%143 = load i32*, i32** %4
%144 = icmp ne i32* %143, null
%145 = xor i1 %144, true
%146 = zext i1 %145 to i32
%147 = call i32 @assert(i32 %146)
%148 = load i32, i32* %2
%149 = call i32 @hwloc_topology_destroy(i32 %148)
%150 = load i32, i32* %3
%151 = call i32 @hwloc_bitmap_free(i32 %150)
%152 = load i32, i32* @EXIT_SUCCESS
store i32 %152, i32* %1
br label %153
153: ; preds = %105, %103, %94, %20, %11
%154 = load i32, i32* %1
ret i32 %154
}

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 = tail call i32 (...) @hwloc_bitmap_alloc()
%4 = call i32 @hwloc_topology_init(i32* %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %100
6: ; preds = %0
%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 %100
12: ; preds = %6
%13 = call i32 @hwloc_bitmap_sscanf(i32 %3, 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 %3, 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 %3, 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 %3, 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 %3, 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 %3, 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 %3, 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_destroy(i32 %60)
%62 = call i32 @hwloc_topology_init(i32* %1)
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %100
64: ; preds = %12
%65 = load i32, i32* %1
%66 = call i32 @hwloc_topology_set_synthetic(i32 %65, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%67 = load i32, i32* %1
%68 = call i32 @hwloc_topology_load(i32 %67)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %100
70: ; preds = %64
%71 = call i32 @hwloc_bitmap_sscanf(i32 %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%72 = load i32, i32* %1
%73 = load i32, i32* @HWLOC_OBJ_SOCKET
%74 = call i32 @hwloc_get_type_depth(i32 %72, i32 %73)
%75 = icmp eq i32 %74, 2
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = load i32, i32* %1
%79 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %78, i32 %3, i32 %74, i32* null)
%80 = load i32, i32* %1
%81 = call i32* @hwloc_get_obj_by_depth(i32 %80, i32 %74, i32 1)
%82 = icmp eq i32* %79, %81
%83 = zext i1 %82 to i32
%84 = call i32 @assert(i32 %83)
%85 = load i32, i32* %1
%86 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %85, i32 %3, i32 %74, i32* %79)
%87 = load i32, i32* %1
%88 = call i32* @hwloc_get_obj_by_depth(i32 %87, i32 %74, i32 2)
%89 = icmp eq i32* %86, %88
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = load i32, i32* %1
%93 = call i32* @hwloc_get_next_obj_covering_cpuset_by_depth(i32 %92, i32 %3, i32 %74, i32* %86)
%94 = icmp eq i32* %93, null
%95 = zext i1 %94 to i32
%96 = call i32 @assert(i32 %95)
%97 = load i32, i32* %1
%98 = call i32 @hwloc_topology_destroy(i32 %97)
%99 = call i32 @hwloc_bitmap_free(i32 %3)
br label %100
100: ; preds = %64, %12, %6, %0, %70
%101 = phi i32* [ @EXIT_SUCCESS, %70 ], [ @EXIT_FAILURE, %0 ], [ @EXIT_FAILURE, %6 ], [ @EXIT_FAILURE, %12 ], [ @EXIT_FAILURE, %64 ]
%102 = load i32, i32* %101
ret i32 %102
}