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

/* Variables and functions */
size_t FD_SETSIZE;
scalar_t__ *__FDS_BITS(int /*<<< orphan*/ const *);
size_t __NFDBITS;
bool fd_is_empty(fd_set const *set) {
  for (size_t i = 0; i < FD_SETSIZE / __NFDBITS; i++) {
    if (__FDS_BITS(set)[i] != 0) {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<fd_is_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%rax
mov    0x2e93(%rip),%rcx
xor    %edx,%edx
divq   (%rcx)
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jae    118c <fd_is_empty+0x7c>
mov    -0x10(%rbp),%rdi
call   1030 <__FDS_BITS@plt>
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1176 <fd_is_empty+0x66>
movl   $0x0,-0x4(%rbp)
jmp    1193 <fd_is_empty+0x83>
jmp    117b <fd_is_empty+0x6b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <fd_is_empty+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_is_empty>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2ec1(%rip),%r15
mov    0x2eaa(%rip),%r12
mov    (%r12),%rax
mov    $0x1,%r14d
cmp    (%r15),%rax
ja     1182 <fd_is_empty+0x72>
mov    %rdi,%rbx
xor    %ebp,%ebp
jmp    1170 <fd_is_empty+0x60>
nopl   0x0(%rax)
xor    %edx,%edx
div    %rcx
cmp    %rax,%rbp
jb     1170 <fd_is_empty+0x60>
jmp    1182 <fd_is_empty+0x72>
nopl   0x0(%rax)
add    $0x1,%rbp
mov    (%r15),%rax
mov    (%r12),%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1140 <fd_is_empty+0x30>
xor    %edx,%edx
div    %ecx
cmp    %rax,%rbp
jae    1182 <fd_is_empty+0x72>
mov    %rbx,%rdi
call   1030 <__FDS_BITS@plt>
cmpq   $0x0,(%rax,%rbp,8)
je     1150 <fd_is_empty+0x40>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@FD_SETSIZE = global i64 0
@__NFDBITS = global i64 0
define i32 @fd_is_empty(i32* %0) {
%2 = load i64, i64* @FD_SETSIZE
%3 = load i64, i64* @__NFDBITS
%4 = icmp ugt i64 %3, %2
br i1 %4, label %17, label %10
5: ; preds = %10
%6 = load i64, i64* @FD_SETSIZE
%7 = load i64, i64* @__NFDBITS
%8 = udiv i64 %6, %7
%9 = icmp ult i64 %16, %8
br i1 %9, label %10, label %17
10: ; preds = %1, %5
%11 = phi i64 [ %16, %5 ], [ 0, %1 ]
%12 = tail call i64* @__FDS_BITS(i32* %0)
%13 = getelementptr inbounds i64, i64* %12, i64 %11
%14 = load i64, i64* %13
%15 = icmp eq i64 %14, 0
%16 = add nuw i64 %11, 1
br i1 %15, label %5, label %17
17: ; preds = %5, %10, %1
%18 = phi i32 [ 1, %1 ], [ 0, %10 ], [ 1, %5 ]
ret i32 %18
}