#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 */

/* Variables and functions */
int /*<<< orphan*/ is_power_of_two(int);
void hum_unpack(int *in_word, int in_word_size, const int *hum_word,
                int hum_word_size) {
  int i = 0;
  int j = 0;
  for (i = 0, j = 0; i < hum_word_size; ++i) {
    if (!is_power_of_two(i + 1) && j < in_word_size) {
      in_word[j] = hum_word[i];
      j++;
    }
  }
}


x86 assembly (clang, -O0):
<hum_unpack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11a0 <hum_unpack+0x90>
mov    -0x20(%rbp),%edi
add    $0x1,%edi
call   1030 <is_power_of_two@plt>
cmp    $0x0,%eax
jne    118d <hum_unpack+0x7d>
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118d <hum_unpack+0x7d>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1192 <hum_unpack+0x82>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1142 <hum_unpack+0x32>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hum_unpack>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
test   %ecx,%ecx
jle    1170 <hum_unpack+0x60>
mov    %esi,%r12d
mov    %rdi,%r15
mov    %ecx,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1145 <hum_unpack+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %rbx,%r13
je     1170 <hum_unpack+0x60>
mov    %rbx,%r14
add    $0x1,%rbx
mov    %ebx,%edi
call   1030 <is_power_of_two@plt>
test   %eax,%eax
jne    1140 <hum_unpack+0x30>
cmp    %r12d,%ebp
jge    1140 <hum_unpack+0x30>
mov    (%rsp),%rax
mov    (%rax,%r14,4),%eax
movslq %ebp,%rcx
mov    %eax,(%r15,%rcx,4)
add    $0x1,%ebp
jmp    1140 <hum_unpack+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @hum_unpack(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %9
store i32 0, i32* %10
br label %11
11: ; preds = %37, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %40
15: ; preds = %11
%16 = load i32, i32* %9
%17 = add nsw i32 %16, 1
%18 = call i32 @is_power_of_two(i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %36, label %20
20: ; preds = %15
%21 = load i32, i32* %10
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %36
24: ; preds = %20
%25 = load i32*, i32** %7
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = load i32*, i32** %5
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
%34 = load i32, i32* %10
%35 = add nsw i32 %34, 1
store i32 %35, i32* %10
br label %36
36: ; preds = %24, %20, %15
br label %37
37: ; preds = %36
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %11
40: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @hum_unpack(i32* nocapture writeonly %0, i32 %1, i32* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %26
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %8
8: ; preds = %6, %23
%9 = phi i64 [ 0, %6 ], [ %11, %23 ]
%10 = phi i32 [ 0, %6 ], [ %24, %23 ]
%11 = add nuw nsw i64 %9, 1
%12 = trunc i64 %11 to i32
%13 = tail call i32 @is_power_of_two(i32 %12)
%14 = icmp eq i32 %13, 0
%15 = icmp slt i32 %10, %1
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %17, label %23
17: ; preds = %8
%18 = getelementptr inbounds i32, i32* %2, i64 %9
%19 = load i32, i32* %18
%20 = sext i32 %10 to i64
%21 = getelementptr inbounds i32, i32* %0, i64 %20
store i32 %19, i32* %21
%22 = add nsw i32 %10, 1
br label %23
23: ; preds = %8, %17
%24 = phi i32 [ %10, %8 ], [ %22, %17 ]
%25 = icmp eq i64 %11, %7
br i1 %25, label %26, label %8
26: ; preds = %23, %4
ret void
}