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

/* Variables and functions */
int /*<<< orphan*/ check(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_topology_destroy(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_topology_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ hwloc_topology_load(int /*<<< orphan*/);
int /*<<< orphan*/ hwloc_topology_set_synthetic(int /*<<< orphan*/, char *);
int main(void) {
  hwloc_topology_t topology;
  hwloc_topology_init(&topology);
  hwloc_topology_load(topology);
  check(topology);
  hwloc_topology_destroy(topology);
  hwloc_topology_init(&topology);
  hwloc_topology_set_synthetic(topology, "6 5 4 3 2");
  hwloc_topology_load(topology);
  check(topology);
  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   1040 <hwloc_topology_load@plt>
mov    -0x8(%rbp),%edi
call   1060 <check@plt>
mov    -0x8(%rbp),%edi
call   1070 <hwloc_topology_destroy@plt>
lea    -0x8(%rbp),%rdi
call   1030 <hwloc_topology_init@plt>
mov    -0x8(%rbp),%edi
lea    0xe6d(%rip),%rsi
call   1050 <hwloc_topology_set_synthetic@plt>
mov    -0x8(%rbp),%edi
call   1040 <hwloc_topology_load@plt>
mov    -0x8(%rbp),%edi
call   1060 <check@plt>
mov    -0x8(%rbp),%edi
call   1070 <hwloc_topology_destroy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <hwloc_topology_init@plt>
mov    0xc(%rsp),%edi
call   1040 <hwloc_topology_load@plt>
mov    0xc(%rsp),%edi
call   1060 <check@plt>
mov    0xc(%rsp),%edi
call   1070 <hwloc_topology_destroy@plt>
mov    %rbx,%rdi
call   1030 <hwloc_topology_init@plt>
mov    0xc(%rsp),%edi
lea    0xe70(%rip),%rsi
call   1050 <hwloc_topology_set_synthetic@plt>
mov    0xc(%rsp),%edi
call   1040 <hwloc_topology_load@plt>
mov    0xc(%rsp),%edi
call   1060 <check@plt>
mov    0xc(%rsp),%edi
call   1070 <hwloc_topology_destroy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"6 5 4 3 2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @hwloc_topology_init(i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @hwloc_topology_load(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @check(i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @hwloc_topology_destroy(i32 %8)
%10 = call i32 @hwloc_topology_init(i32* %2)
%11 = load i32, i32* %2
%12 = call i32 @hwloc_topology_set_synthetic(i32 %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = call i32 @hwloc_topology_load(i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @check(i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @hwloc_topology_destroy(i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"6 5 4 3 2\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 @check(i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @hwloc_topology_destroy(i32 %8)
%10 = call i32 @hwloc_topology_init(i32* %1)
%11 = load i32, i32* %1
%12 = call i32 @hwloc_topology_set_synthetic(i32 %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = call i32 @hwloc_topology_load(i32 %13)
%15 = load i32, i32* %1
%16 = call i32 @check(i32 %15)
%17 = load i32, i32* %1
%18 = call i32 @hwloc_topology_destroy(i32 %17)
ret i32 0
}