#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 */
struct bitmask {
  int dummy;
};

/* Variables and functions */
scalar_t__ numa_bitmask_isbitset(struct bitmask *, int);
int numa_max_node();
int /*<<< orphan*/ printf(char *, int);
void print_nodemask(struct bitmask *mask) {
  int n = numa_max_node() + 1;
  for (int i = 0; i != n; ++i) {
    if (numa_bitmask_isbitset(mask, i)) {
      printf("%d ", i);
    }
  }
}


x86 assembly (clang, -O0):
<print_nodemask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <numa_max_node@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1194 <print_nodemask+0x64>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <numa_bitmask_isbitset@plt>
cmp    $0x0,%rax
je     1181 <print_nodemask+0x51>
mov    -0x10(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
jmp    1186 <print_nodemask+0x56>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1150 <print_nodemask+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_nodemask>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <numa_max_node@plt>
cmp    $0xffffffff,%eax
je     1182 <print_nodemask+0x52>
mov    %eax,%ebx
add    $0x1,%ebx
lea    0xeac(%rip),%r15
jmp    1167 <print_nodemask+0x37>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1182 <print_nodemask+0x52>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <numa_bitmask_isbitset@plt>
test   %rax,%rax
je     1160 <print_nodemask+0x30>
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
jmp    1160 <print_nodemask+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.bitmask = type { i32 }
@.str = [4 x i8] c"%d \00"
define void @print_nodemask(%struct.bitmask* %0) {
%2 = alloca %struct.bitmask*
%3 = alloca i32
%4 = alloca i32
store %struct.bitmask* %0, %struct.bitmask** %2
%5 = call i32 (...) @numa_max_node()
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %20, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load %struct.bitmask*, %struct.bitmask** %2
%13 = load i32, i32* %4
%14 = call i64 @numa_bitmask_isbitset(%struct.bitmask* %12, i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %7
23: ; preds = %7
ret void
}

LLVM IR (-O2):
%struct.bitmask = type { i32 }
@.str = [4 x i8] c"%d \00"
define void @print_nodemask(%struct.bitmask* %0) {
%2 = tail call i32 (...) @numa_max_node()
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %5
4: ; preds = %11, %1
ret void
5: ; preds = %1, %11
%6 = phi i32 [ %12, %11 ], [ 0, %1 ]
%7 = tail call i64 @numa_bitmask_isbitset(%struct.bitmask* %0, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %11
11: ; preds = %5, %9
%12 = add nuw nsw i32 %6, 1
%13 = icmp eq i32 %6, %2
br i1 %13, label %4, label %5
}