#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 */
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int _fds_cmp(fd_set *a, fd_set *b, int nfds) {
  int fd;
  for (fd = 0; fd < nfds; fd++) {
    if (FD_ISSET(fd, a) != FD_ISSET(fd, b)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<_fds_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1181 <_fds_cmp+0x71>
mov    -0x20(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <FD_ISSET@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <FD_ISSET@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     116e <_fds_cmp+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    1188 <_fds_cmp+0x78>
jmp    1173 <_fds_cmp+0x63>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <_fds_cmp+0x1a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fds_cmp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
jle    1154 <_fds_cmp+0x44>
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r15,%rsi
call   1030 <FD_ISSET@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <FD_ISSET@plt>
cmp    %rax,%rbx
jne    1158 <_fds_cmp+0x48>
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    1130 <_fds_cmp+0x20>
xor    %eax,%eax
jmp    115d <_fds_cmp+0x4d>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @_fds_cmp(i32* %0, i32* %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %7, label %13
5: ; preds = %7
%6 = icmp eq i32 %12, %2
br i1 %6, label %13, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %12, %5 ], [ 0, %3 ]
%9 = tail call i64 @FD_ISSET(i32 %8, i32* %0)
%10 = tail call i64 @FD_ISSET(i32 %8, i32* %1)
%11 = icmp eq i64 %9, %10
%12 = add nuw nsw i32 %8, 1
br i1 %11, label %5, label %13
13: ; preds = %7, %5, %3
%14 = phi i32 [ 0, %3 ], [ 0, %5 ], [ 1, %7 ]
ret i32 %14
}