#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 */
scalar_t__ cos_assoc_set(unsigned int const, int /*<<< orphan*/);
int hw_alloc_release(const unsigned *core_array, const unsigned core_num) {
  unsigned i;
  int ret = 0;
  ;
  for (i = 0; i < core_num; i++)
    if (cos_assoc_set(core_array[i], 0) != 0)
      ret = 1;
  return ret;
}


x86 assembly (clang, -O0):
<hw_alloc_release>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    116e <hw_alloc_release+0x5e>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%edi
xor    %esi,%esi
call   1030 <cos_assoc_set@plt>
cmp    $0x0,%rax
je     115b <hw_alloc_release+0x4b>
movl   $0x1,-0x14(%rbp)
jmp    1160 <hw_alloc_release+0x50>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <hw_alloc_release+0x1d>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hw_alloc_release>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
je     114d <hw_alloc_release+0x3d>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
mov    $0x1,%r12d
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%edi
xor    %esi,%esi
call   1030 <cos_assoc_set@plt>
test   %rax,%rax
cmovne %r12d,%ebp
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <hw_alloc_release+0x20>
jmp    114f <hw_alloc_release+0x3f>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hw_alloc_release(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp ult i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i64 @cos_assoc_set(i32 %16, i32 0)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 1, i32* %6
br label %20
20: ; preds = %19, %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add i32 %22, 1
store i32 %23, i32* %5
br label %7
24: ; preds = %7
%25 = load i32, i32* %6
ret i32 %25
}

LLVM IR (-O2):
define i32 @hw_alloc_release(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %16, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %14, %6 ]
%8 = phi i32 [ 0, %4 ], [ %13, %6 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = load i32, i32* %9
%11 = tail call i64 @cos_assoc_set(i32 %10, i32 0)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i32 %8, i32 1
%14 = add nuw nsw i64 %7, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %16, label %6
16: ; preds = %6, %2
%17 = phi i32 [ 0, %2 ], [ %13, %6 ]
ret i32 %17
}