#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ __bits;
};
typedef TYPE_1__ cpu_set_t;
typedef int __cpu_mask;

/* Variables and functions */
size_t __CPUELT(size_t);
int __CPUMASK(size_t);
int cpuset_ary_isset(size_t cpu, cpu_set_t **ary, size_t nmemb, size_t setsize,
                     size_t *idx) {
  size_t i;
  for (i = 0; i < nmemb; i++) {
    if (({
          size_t __cpu = (cpu);
          __cpu < 8 * (setsize)
              ? ((((__cpu_mask *)((ary[i])->__bits))[__CPUELT(__cpu)] &
                  __CPUMASK(__cpu))) != 0
              : 0;
        })) {
      *idx = i;
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<cpuset_ary_isset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1202 <cpuset_ary_isset+0xe2>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
shl    $0x3,%rcx
cmp    %rcx,%rax
jae    11bb <cpuset_ary_isset+0x9b>
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <__CPUELT@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <__CPUMASK@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x48(%rbp)
jmp    11c5 <cpuset_ary_isset+0xa5>
xor    %eax,%eax
mov    %eax,-0x48(%rbp)
jmp    11c5 <cpuset_ary_isset+0xa5>
mov    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     11ec <cpuset_ary_isset+0xcc>
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1209 <cpuset_ary_isset+0xe9>
jmp    11f1 <cpuset_ary_isset+0xd1>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1144 <cpuset_ary_isset+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuset_ary_isset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x10(%rsp)
mov    $0x1,%eax
test   %rdx,%rdx
je     11a3 <cpuset_ary_isset+0x83>
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rdi,%rbp
mov    %r8,0x8(%rsp)
shl    $0x3,%r12
xor    %r14d,%r14d
jmp    1169 <cpuset_ary_isset+0x49>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14
cmp    %r14,%r13
je     119e <cpuset_ary_isset+0x7e>
cmp    %rbp,%r12
jbe    1160 <cpuset_ary_isset+0x40>
mov    0x10(%rsp),%rax
mov    (%rax,%r14,8),%rax
mov    (%rax),%r15
mov    %rbp,%rdi
call   1040 <__CPUELT@plt>
mov    (%r15,%rax,4),%ebx
mov    %rbp,%rdi
call   1030 <__CPUMASK@plt>
test   %ebx,%eax
je     1160 <cpuset_ary_isset+0x40>
mov    0x8(%rsp),%rax
mov    %r14,(%rax)
xor    %eax,%eax
jmp    11a3 <cpuset_ary_isset+0x83>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
define i32 @cpuset_ary_isset(i64 %0, %struct.TYPE_3__** %1, i64 %2, i64 %3, i64* %4) {
%6 = alloca i32
%7 = alloca i64
%8 = alloca %struct.TYPE_3__**
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i32
store i64 %0, i64* %7
store %struct.TYPE_3__** %1, %struct.TYPE_3__*** %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64* %4, i64** %11
store i64 0, i64* %12
br label %15
15: ; preds = %51, %5
%16 = load i64, i64* %12
%17 = load i64, i64* %9
%18 = icmp ult i64 %16, %17
br i1 %18, label %19, label %54
19: ; preds = %15
%20 = load i64, i64* %7
store i64 %20, i64* %13
%21 = load i64, i64* %13
%22 = load i64, i64* %10
%23 = mul i64 8, %22
%24 = icmp ult i64 %21, %23
br i1 %24, label %25, label %42
25: ; preds = %19
%26 = load %struct.TYPE_3__**, %struct.TYPE_3__*** %8
%27 = load i64, i64* %12
%28 = getelementptr inbounds %struct.TYPE_3__*, %struct.TYPE_3__** %26, i64 %27
%29 = load %struct.TYPE_3__*, %struct.TYPE_3__** %28
%30 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %29, i32 0, i32 0
%31 = load i64, i64* %30
%32 = inttoptr i64 %31 to i32*
%33 = load i64, i64* %13
%34 = call i64 @__CPUELT(i64 %33)
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = load i64, i64* %13
%38 = call i32 @__CPUMASK(i64 %37)
%39 = and i32 %36, %38
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i32
br label %43
42: ; preds = %19
br label %43
43: ; preds = %42, %25
%44 = phi i32 [ %41, %25 ], [ 0, %42 ]
store i32 %44, i32* %14
%45 = load i32, i32* %14
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i64, i64* %12
%49 = load i64*, i64** %11
store i64 %48, i64* %49
store i32 0, i32* %6
br label %55
50: ; preds = %43
br label %51
51: ; preds = %50
%52 = load i64, i64* %12
%53 = add i64 %52, 1
store i64 %53, i64* %12
br label %15
54: ; preds = %15
store i32 1, i32* %6
br label %55
55: ; preds = %54, %47
%56 = load i32, i32* %6
ret i32 %56
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
define i32 @cpuset_ary_isset(i64 %0, %struct.TYPE_3__** nocapture %1, i64 %2, i64 %3, i64* nocapture writeonly %4) {
%6 = icmp eq i64 %2, 0
br i1 %6, label %28, label %7
7: ; preds = %5
%8 = shl i64 %3, 3
%9 = icmp ugt i64 %8, %0
br label %10
10: ; preds = %7, %25
%11 = phi i64 [ 0, %7 ], [ %26, %25 ]
br i1 %9, label %12, label %25
12: ; preds = %10
%13 = getelementptr inbounds %struct.TYPE_3__*, %struct.TYPE_3__** %1, i64 %11
%14 = load %struct.TYPE_3__*, %struct.TYPE_3__** %13
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i64 0, i32 0
%16 = load i64, i64* %15
%17 = inttoptr i64 %16 to i32*
%18 = tail call i64 @__CPUELT(i64 %0)
%19 = getelementptr inbounds i32, i32* %17, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 @__CPUMASK(i64 %0)
%22 = and i32 %21, %20
%23 = icmp eq i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %12
store i64 %11, i64* %4
br label %28
25: ; preds = %10, %12
%26 = add nuw i64 %11, 1
%27 = icmp eq i64 %26, %2
br i1 %27, label %28, label %10
28: ; preds = %25, %5, %24
%29 = phi i32 [ 0, %24 ], [ 1, %5 ], [ 1, %25 ]
ret i32 %29
}