#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 */
int FD_ISSET(int, int /*<<< orphan*/ const *);
int FD_SETSIZE;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
int checked_fd_isset(int fd, const fd_set *fds) {
  if (fd >= FD_SETSIZE) {
    fprintf(stderr,
            "Attempt to FD_ISSET fd %d, which is not less than "
            "FD_SETSIZE (%d). Try using a lower parallelism.",
            fd, FD_SETSIZE);
    abort();
  }
  return FD_ISSET(fd, fds);
}


x86 assembly (clang, -O0):
<checked_fd_isset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%eax
jl     1179 <checked_fd_isset+0x49>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    0x2e74(%rip),%rax
mov    (%rax),%ecx
lea    0xe93(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <FD_ISSET@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_fd_isset>:
push   %rax
mov    %edi,%edx
mov    0x2e9e(%rip),%rax
mov    (%rax),%ecx
cmp    %edi,%ecx
jle    1148 <checked_fd_isset+0x18>
mov    %edx,%edi
pop    %rax
jmp    1040 <FD_ISSET@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@FD_SETSIZE = global i32 0
@stderr = global i32 0
@.str = [98 x i8] c"Attempt to FD_ISSET fd %d, which is not less than FD_SETSIZE (%d). Try using a lower parallelism.\00"
define i32 @checked_fd_isset(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @FD_SETSIZE
%7 = icmp sge i32 %5, %6
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i32, i32* %3
%11 = load i32, i32* @FD_SETSIZE
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %2
%15 = load i32, i32* %3
%16 = load i32*, i32** %4
%17 = call i32 @FD_ISSET(i32 %15, i32* %16)
ret i32 %17
}

LLVM IR (-O2):
@FD_SETSIZE = global i32 0
@stderr = global i32 0
@.str = [98 x i8] c"Attempt to FD_ISSET fd %d, which is not less than FD_SETSIZE (%d). Try using a lower parallelism.\00"
define i32 @checked_fd_isset(i32 %0, i32* %1) {
%3 = load i32, i32* @FD_SETSIZE
%4 = icmp sgt i32 %3, %0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %3)
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
%10 = tail call i32 @FD_ISSET(i32 %0, i32* %1)
ret i32 %10
}