#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;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ hwloc_get_root_obj(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_obj_add_info(int /*<<< orphan*/, char *, char *);
scalar_t__ hwloc_obj_get_info_by_name(int /*<<< orphan*/, char *);
int /*<<< orphan*/ hwloc_topology_destroy(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_topology_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ hwloc_topology_load(int /*<<< orphan*/);
scalar_t__ strcmp(scalar_t__, char *);
int main(void) {
  hwloc_topology_t topology;
  hwloc_obj_t obj;
  hwloc_topology_init(&topology);
  hwloc_topology_load(topology);
  obj = hwloc_get_root_obj(topology);
  if (hwloc_obj_get_info_by_name(obj, "foobar") ||
      hwloc_obj_get_info_by_name(obj, "foobaz"))
    return 0;
  hwloc_obj_add_info(obj, "foobar", "myvalue");
  assert(!hwloc_obj_get_info_by_name(obj, "foobaz"));
  hwloc_obj_add_info(obj, "foobaz", "myothervalue");
  if (strcmp(hwloc_obj_get_info_by_name(obj, "foobar"), "myvalue"))
    assert(0);
  if (strcmp(hwloc_obj_get_info_by_name(obj, "foobaz"), "myothervalue"))
    assert(0);
  hwloc_topology_destroy(topology);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <hwloc_topology_init@plt>
mov    -0x8(%rbp),%edi
call   1050 <hwloc_topology_load@plt>
mov    -0x8(%rbp),%edi
call   1090 <hwloc_get_root_obj@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xe4b(%rip),%rsi
call   1040 <hwloc_obj_get_info_by_name@plt>
cmp    $0x0,%rax
jne    11dd <main+0x5d>
mov    -0xc(%rbp),%edi
lea    0xe39(%rip),%rsi
call   1040 <hwloc_obj_get_info_by_name@plt>
cmp    $0x0,%rax
je     11e9 <main+0x69>
movl   $0x0,-0x4(%rbp)
jmp    12a4 <main+0x124>
mov    -0xc(%rbp),%edi
lea    0xe0d(%rip),%rsi
lea    0xe14(%rip),%rdx
call   1060 <hwloc_obj_add_info@plt>
mov    -0xc(%rbp),%edi
lea    0xdfe(%rip),%rsi
call   1040 <hwloc_obj_get_info_by_name@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0xc(%rbp),%edi
lea    0xddc(%rip),%rsi
lea    0xde4(%rip),%rdx
call   1060 <hwloc_obj_add_info@plt>
mov    -0xc(%rbp),%edi
lea    0xdbf(%rip),%rsi
call   1040 <hwloc_obj_get_info_by_name@plt>
mov    %rax,%rdi
lea    0xdbe(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1266 <main+0xe6>
xor    %edi,%edi
call   1080 <assert@plt>
mov    -0xc(%rbp),%edi
lea    0xd97(%rip),%rsi
call   1040 <hwloc_obj_get_info_by_name@plt>
mov    %rax,%rdi
lea    0xd97(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1295 <main+0x115>
xor    %edi,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%edi
call   10a0 <hwloc_topology_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <hwloc_topology_init@plt>
mov    0x4(%rsp),%edi
call   1050 <hwloc_topology_load@plt>
mov    0x4(%rsp),%edi
call   1090 <hwloc_get_root_obj@plt>
mov    %eax,%ebx
lea    0xe53(%rip),%rsi
mov    %eax,%edi
call   1040 <hwloc_obj_get_info_by_name@plt>
test   %rax,%rax
jne    1272 <main+0xf2>
lea    0xe43(%rip),%rsi
mov    %ebx,%edi
call   1040 <hwloc_obj_get_info_by_name@plt>
test   %rax,%rax
jne    1272 <main+0xf2>
lea    0xe25(%rip),%r15
lea    0xe2c(%rip),%r14
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <hwloc_obj_add_info@plt>
lea    0xe11(%rip),%r12
mov    %ebx,%edi
mov    %r12,%rsi
call   1040 <hwloc_obj_get_info_by_name@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
lea    0xe01(%rip),%rdx
mov    %ebx,%edi
mov    %r12,%rsi
call   1060 <hwloc_obj_add_info@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <hwloc_obj_get_info_by_name@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1240 <main+0xc0>
xor    %edi,%edi
call   1080 <assert@plt>
lea    0xdc0(%rip),%rsi
mov    %ebx,%edi
call   1040 <hwloc_obj_get_info_by_name@plt>
lea    0xdc1(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1269 <main+0xe9>
xor    %edi,%edi
call   1080 <assert@plt>
mov    0x4(%rsp),%edi
call   10a0 <hwloc_topology_destroy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"foobar\00"
@.str.1 = [7 x i8] c"foobaz\00"
@.str.2 = [8 x i8] c"myvalue\00"
@.str.3 = [13 x i8] c"myothervalue\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @hwloc_topology_init(i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @hwloc_topology_load(i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @hwloc_get_root_obj(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i64 @hwloc_obj_get_info_by_name(i32 %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %0
%13 = load i32, i32* %3
%14 = call i64 @hwloc_obj_get_info_by_name(i32 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12, %0
store i32 0, i32* %1
br label %44
17: ; preds = %12
%18 = load i32, i32* %3
%19 = call i32 @hwloc_obj_add_info(i32 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* %3
%21 = call i64 @hwloc_obj_get_info_by_name(i32 %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i32, i32* %3
%27 = call i32 @hwloc_obj_add_info(i32 %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* %3
%29 = call i64 @hwloc_obj_get_info_by_name(i32 %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%30 = call i64 @strcmp(i64 %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %17
%33 = call i32 @assert(i32 0)
br label %34
34: ; preds = %32, %17
%35 = load i32, i32* %3
%36 = call i64 @hwloc_obj_get_info_by_name(i32 %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%37 = call i64 @strcmp(i64 %36, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @assert(i32 0)
br label %41
41: ; preds = %39, %34
%42 = load i32, i32* %2
%43 = call i32 @hwloc_topology_destroy(i32 %42)
store i32 0, i32* %1
br label %44
44: ; preds = %41, %16
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str = [7 x i8] c"foobar\00"
@.str.1 = [7 x i8] c"foobaz\00"
@.str.2 = [8 x i8] c"myvalue\00"
@.str.3 = [13 x i8] c"myothervalue\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @hwloc_topology_init(i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @hwloc_topology_load(i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @hwloc_get_root_obj(i32 %6)
%8 = call i64 @hwloc_obj_get_info_by_name(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %34
10: ; preds = %0
%11 = call i64 @hwloc_obj_get_info_by_name(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %34
13: ; preds = %10
%14 = call i32 @hwloc_obj_add_info(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%15 = call i64 @hwloc_obj_get_info_by_name(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32 @hwloc_obj_add_info(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%20 = call i64 @hwloc_obj_get_info_by_name(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%21 = call i64 @strcmp(i64 %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %13
%24 = call i32 @assert(i32 0)
br label %25
25: ; preds = %23, %13
%26 = call i64 @hwloc_obj_get_info_by_name(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%27 = call i64 @strcmp(i64 %26, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = call i32 @assert(i32 0)
br label %31
31: ; preds = %29, %25
%32 = load i32, i32* %1
%33 = call i32 @hwloc_topology_destroy(i32 %32)
br label %34
34: ; preds = %0, %10, %31
ret i32 0
}