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


x86 assembly (clang, -O0):
<checked_fd_set>:
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_set+0x49>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    0x2e74(%rip),%rax
mov    (%rax),%ecx
lea    0xe93(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <FD_SET@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@FD_SETSIZE = global i32 0
@stderr = global i32 0
@.str = [96 x i8] c"Attempt to FD_SET fd %d, which is not less than FD_SETSIZE (%d). Try using a lower parallelism.\00"
define void @checked_fd_set(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 ([96 x i8], [96 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_SET(i32 %15, i32* %16)
ret void
}

LLVM IR (-O2):
@FD_SETSIZE = global i32 0
@stderr = global i32 0
@.str = [96 x i8] c"Attempt to FD_SET fd %d, which is not less than FD_SETSIZE (%d). Try using a lower parallelism.\00"
define void @checked_fd_set(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 ([96 x i8], [96 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_SET(i32 %0, i32* %1)
ret void
}