#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 */
struct timespec {
  int tv_sec;
  int tv_nsec;
};
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int pselect(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
            int /*<<< orphan*/ *, struct timespec *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sigfillset(int /*<<< orphan*/ *);
int pselect_(int ReadCount, int *ReadSockets, int WriteCount, int *WriteSockets,
             int ExceptCount, int *ExceptSockets, int Milliseconds) {
  int Index, High, Result;
  fd_set ReadSet, WriteSet, ExceptSet;
  struct timespec Timeout;
  sigset_t SignalMask;
  High = -1;
  FD_ZERO(&ReadSet);
  for (Index = 0; Index < ReadCount; Index++) {
    FD_SET(ReadSockets[Index], &ReadSet);
    if (ReadSockets[Index] > High)
      High = ReadSockets[Index];
  }
  FD_ZERO(&WriteSet);
  for (Index = 0; Index < WriteCount; Index++) {
    FD_SET(WriteSockets[Index], &WriteSet);
    if (WriteSockets[Index] > High)
      High = WriteSockets[Index];
  }
  FD_ZERO(&ExceptSet);
  for (Index = 0; Index < ExceptCount; Index++) {
    FD_SET(ExceptSockets[Index], &ExceptSet);
    if (ExceptSockets[Index] > High)
      High = ExceptSockets[Index];
  }
  Timeout.tv_sec = Milliseconds / 1000;
  Timeout.tv_nsec = (Milliseconds % 1000) * 1000000;
  sigfillset(&SignalMask);
  Result =
      pselect(High + 1, &ReadSet, &WriteSet, &ExceptSet, &Timeout, &SignalMask);
  if (Result == -1)
    return Result;
  for (Index = 0; Index < ReadCount; Index++) {
    if (!FD_ISSET(ReadSockets[Index], &ReadSet))
      ReadSockets[Index] = 0;
  }
  for (Index = 0; Index < WriteCount; Index++) {
    if (!FD_ISSET(WriteSockets[Index], &WriteSet))
      WriteSockets[Index] = 0;
  }
  for (Index = 0; Index < ExceptCount; Index++) {
    if (!FD_ISSET(ExceptSockets[Index], &ExceptSet))
      ExceptSockets[Index] = 0;
  }
  return Result;
}


x86 assembly (clang, -O0):
<pselect_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0xffffffff,-0x38(%rbp)
lea    -0x40(%rbp),%rdi
call   1060 <FD_ZERO@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11dd <pselect_+0x8d>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x40(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x38(%rbp),%eax
jle    11ca <pselect_+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
jmp    11cf <pselect_+0x7f>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1188 <pselect_+0x38>
lea    -0x44(%rbp),%rdi
call   1060 <FD_ZERO@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1242 <pselect_+0xf2>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x44(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x38(%rbp),%eax
jle    122f <pselect_+0xdf>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
jmp    1234 <pselect_+0xe4>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ed <pselect_+0x9d>
lea    -0x48(%rbp),%rdi
call   1060 <FD_ZERO@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12a7 <pselect_+0x157>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x48(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x38(%rbp),%eax
jle    1294 <pselect_+0x144>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
jmp    1299 <pselect_+0x149>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1252 <pselect_+0x102>
mov    0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x50(%rbp)
mov    0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
imul   $0xf4240,%edx,%eax
mov    %eax,-0x4c(%rbp)
lea    -0x54(%rbp),%rdi
call   1050 <sigfillset@plt>
mov    -0x38(%rbp),%edi
add    $0x1,%edi
lea    -0x40(%rbp),%rsi
lea    -0x44(%rbp),%rdx
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
lea    -0x54(%rbp),%r9
call   1040 <pselect@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1309 <pselect_+0x1b9>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1405 <pselect_+0x2b5>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    135b <pselect_+0x20b>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x40(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%eax
jne    1348 <pselect_+0x1f8>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    134d <pselect_+0x1fd>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1310 <pselect_+0x1c0>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13ad <pselect_+0x25d>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x44(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%eax
jne    139a <pselect_+0x24a>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    139f <pselect_+0x24f>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1362 <pselect_+0x212>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    13ff <pselect_+0x2af>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x48(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%eax
jne    13ec <pselect_+0x29c>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    13f1 <pselect_+0x2a1>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13b4 <pselect_+0x264>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pselect_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x10(%rsp)
mov    %r8d,0x20(%rsp)
mov    %rcx,%r13
mov    %edx,0x1c(%rsp)
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xc(%rsp),%rdi
call   1060 <FD_ZERO@plt>
mov    %ebp,%r12d
mov    %ebp,0x24(%rsp)
mov    $0xffffffff,%r14d
test   %ebp,%ebp
jle    11be <pselect_+0x6e>
xor    %ebp,%ebp
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%edi
mov    %r15,%rsi
call   1070 <FD_SET@plt>
mov    (%rbx,%rbp,4),%eax
cmp    %r14d,%eax
cmovg  %eax,%r14d
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11a0 <pselect_+0x50>
mov    %r12,0x38(%rsp)
lea    0x8(%rsp),%rdi
call   1060 <FD_ZERO@plt>
mov    0x1c(%rsp),%eax
mov    %eax,%ecx
mov    %rcx,0x28(%rsp)
test   %eax,%eax
jle    1216 <pselect_+0xc6>
xor    %ebp,%ebp
mov    0x10(%rsp),%r12
mov    0x28(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,4),%edi
lea    0x8(%rsp),%rsi
call   1070 <FD_SET@plt>
mov    0x0(%r13,%rbp,4),%eax
cmp    %r14d,%eax
cmovg  %eax,%r14d
add    $0x1,%rbp
cmp    %rbp,%r15
jne    11f0 <pselect_+0xa0>
jmp    121b <pselect_+0xcb>
mov    0x10(%rsp),%r12
lea    0x4(%rsp),%rdi
call   1060 <FD_ZERO@plt>
mov    0x20(%rsp),%eax
mov    %eax,%ecx
mov    %rcx,0x10(%rsp)
test   %eax,%eax
jle    1262 <pselect_+0x112>
xor    %ebp,%ebp
mov    0x10(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,4),%edi
lea    0x4(%rsp),%rsi
call   1070 <FD_SET@plt>
mov    (%r12,%rbp,4),%eax
cmp    %r14d,%eax
cmovg  %eax,%r14d
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1240 <pselect_+0xf0>
movslq 0x80(%rsp),%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
mov    %ecx,0x30(%rsp)
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
imul   $0xf4240,%eax,%eax
mov    %eax,0x34(%rsp)
lea    0x44(%rsp),%r15
mov    %r15,%rdi
call   1050 <sigfillset@plt>
add    $0x1,%r14d
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
lea    0x30(%rsp),%r8
mov    %r14d,%edi
mov    %r15,%r9
call   1040 <pselect@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
je     1383 <pselect_+0x233>
cmpl   $0x0,0x24(%rsp)
jle    1303 <pselect_+0x1b3>
xor    %ebp,%ebp
lea    0xc(%rsp),%r15
jmp    12eb <pselect_+0x19b>
add    $0x1,%rbp
cmp    %rbp,0x38(%rsp)
je     1303 <pselect_+0x1b3>
mov    (%rbx,%rbp,4),%edi
mov    %r15,%rsi
call   1030 <FD_ISSET@plt>
test   %eax,%eax
jne    12e0 <pselect_+0x190>
movl   $0x0,(%rbx,%rbp,4)
jmp    12e0 <pselect_+0x190>
cmpl   $0x0,0x1c(%rsp)
mov    0x28(%rsp),%rbx
jle    1345 <pselect_+0x1f5>
xor    %ebp,%ebp
lea    0x8(%rsp),%r15
jmp    1329 <pselect_+0x1d9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1345 <pselect_+0x1f5>
mov    0x0(%r13,%rbp,4),%edi
mov    %r15,%rsi
call   1030 <FD_ISSET@plt>
test   %eax,%eax
jne    1320 <pselect_+0x1d0>
movl   $0x0,0x0(%r13,%rbp,4)
jmp    1320 <pselect_+0x1d0>
cmpl   $0x0,0x20(%rsp)
mov    0x10(%rsp),%rbx
jle    1383 <pselect_+0x233>
xor    %ebp,%ebp
lea    0x4(%rsp),%r15
jmp    1369 <pselect_+0x219>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1383 <pselect_+0x233>
mov    (%r12,%rbp,4),%edi
mov    %r15,%rsi
call   1030 <FD_ISSET@plt>
test   %eax,%eax
jne    1360 <pselect_+0x210>
movl   $0x0,(%r12,%rbp,4)
jmp    1360 <pselect_+0x210>
mov    %r14d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i32 @pselect_(i32 %0, i32* %1, i32 %2, i32* %3, i32 %4, i32* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca %struct.timespec
%23 = alloca i32
store i32 %0, i32* %9
store i32* %1, i32** %10
store i32 %2, i32* %11
store i32* %3, i32** %12
store i32 %4, i32* %13
store i32* %5, i32** %14
store i32 %6, i32* %15
store i32 -1, i32* %17
%24 = call i32 @FD_ZERO(i32* %19)
store i32 0, i32* %16
br label %25
25: ; preds = %50, %7
%26 = load i32, i32* %16
%27 = load i32, i32* %9
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %53
29: ; preds = %25
%30 = load i32*, i32** %10
%31 = load i32, i32* %16
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = load i32, i32* %33
%35 = call i32 @FD_SET(i32 %34, i32* %19)
%36 = load i32*, i32** %10
%37 = load i32, i32* %16
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
%40 = load i32, i32* %39
%41 = load i32, i32* %17
%42 = icmp sgt i32 %40, %41
br i1 %42, label %43, label %49
43: ; preds = %29
%44 = load i32*, i32** %10
%45 = load i32, i32* %16
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
store i32 %48, i32* %17
br label %49
49: ; preds = %43, %29
br label %50
50: ; preds = %49
%51 = load i32, i32* %16
%52 = add nsw i32 %51, 1
store i32 %52, i32* %16
br label %25
53: ; preds = %25
%54 = call i32 @FD_ZERO(i32* %20)
store i32 0, i32* %16
br label %55
55: ; preds = %80, %53
%56 = load i32, i32* %16
%57 = load i32, i32* %11
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %83
59: ; preds = %55
%60 = load i32*, i32** %12
%61 = load i32, i32* %16
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
%64 = load i32, i32* %63
%65 = call i32 @FD_SET(i32 %64, i32* %20)
%66 = load i32*, i32** %12
%67 = load i32, i32* %16
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i32, i32* %66, i64 %68
%70 = load i32, i32* %69
%71 = load i32, i32* %17
%72 = icmp sgt i32 %70, %71
br i1 %72, label %73, label %79
73: ; preds = %59
%74 = load i32*, i32** %12
%75 = load i32, i32* %16
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %74, i64 %76
%78 = load i32, i32* %77
store i32 %78, i32* %17
br label %79
79: ; preds = %73, %59
br label %80
80: ; preds = %79
%81 = load i32, i32* %16
%82 = add nsw i32 %81, 1
store i32 %82, i32* %16
br label %55
83: ; preds = %55
%84 = call i32 @FD_ZERO(i32* %21)
store i32 0, i32* %16
br label %85
85: ; preds = %110, %83
%86 = load i32, i32* %16
%87 = load i32, i32* %13
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %113
89: ; preds = %85
%90 = load i32*, i32** %14
%91 = load i32, i32* %16
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i32, i32* %90, i64 %92
%94 = load i32, i32* %93
%95 = call i32 @FD_SET(i32 %94, i32* %21)
%96 = load i32*, i32** %14
%97 = load i32, i32* %16
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i32, i32* %96, i64 %98
%100 = load i32, i32* %99
%101 = load i32, i32* %17
%102 = icmp sgt i32 %100, %101
br i1 %102, label %103, label %109
103: ; preds = %89
%104 = load i32*, i32** %14
%105 = load i32, i32* %16
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i32, i32* %104, i64 %106
%108 = load i32, i32* %107
store i32 %108, i32* %17
br label %109
109: ; preds = %103, %89
br label %110
110: ; preds = %109
%111 = load i32, i32* %16
%112 = add nsw i32 %111, 1
store i32 %112, i32* %16
br label %85
113: ; preds = %85
%114 = load i32, i32* %15
%115 = sdiv i32 %114, 1000
%116 = getelementptr inbounds %struct.timespec, %struct.timespec* %22, i32 0, i32 0
store i32 %115, i32* %116
%117 = load i32, i32* %15
%118 = srem i32 %117, 1000
%119 = mul nsw i32 %118, 1000000
%120 = getelementptr inbounds %struct.timespec, %struct.timespec* %22, i32 0, i32 1
store i32 %119, i32* %120
%121 = call i32 @sigfillset(i32* %23)
%122 = load i32, i32* %17
%123 = add nsw i32 %122, 1
%124 = call i32 @pselect(i32 %123, i32* %19, i32* %20, i32* %21, %struct.timespec* %22, i32* %23)
store i32 %124, i32* %18
%125 = load i32, i32* %18
%126 = icmp eq i32 %125, -1
br i1 %126, label %127, label %129
127: ; preds = %113
%128 = load i32, i32* %18
store i32 %128, i32* %8
br label %197
129: ; preds = %113
store i32 0, i32* %16
br label %130
130: ; preds = %148, %129
%131 = load i32, i32* %16
%132 = load i32, i32* %9
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %151
134: ; preds = %130
%135 = load i32*, i32** %10
%136 = load i32, i32* %16
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i32, i32* %135, i64 %137
%139 = load i32, i32* %138
%140 = call i32 @FD_ISSET(i32 %139, i32* %19)
%141 = icmp ne i32 %140, 0
br i1 %141, label %147, label %142
142: ; preds = %134
%143 = load i32*, i32** %10
%144 = load i32, i32* %16
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %143, i64 %145
store i32 0, i32* %146
br label %147
147: ; preds = %142, %134
br label %148
148: ; preds = %147
%149 = load i32, i32* %16
%150 = add nsw i32 %149, 1
store i32 %150, i32* %16
br label %130
151: ; preds = %130
store i32 0, i32* %16
br label %152
152: ; preds = %170, %151
%153 = load i32, i32* %16
%154 = load i32, i32* %11
%155 = icmp slt i32 %153, %154
br i1 %155, label %156, label %173
156: ; preds = %152
%157 = load i32*, i32** %12
%158 = load i32, i32* %16
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds i32, i32* %157, i64 %159
%161 = load i32, i32* %160
%162 = call i32 @FD_ISSET(i32 %161, i32* %20)
%163 = icmp ne i32 %162, 0
br i1 %163, label %169, label %164
164: ; preds = %156
%165 = load i32*, i32** %12
%166 = load i32, i32* %16
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i32, i32* %165, i64 %167
store i32 0, i32* %168
br label %169
169: ; preds = %164, %156
br label %170
170: ; preds = %169
%171 = load i32, i32* %16
%172 = add nsw i32 %171, 1
store i32 %172, i32* %16
br label %152
173: ; preds = %152
store i32 0, i32* %16
br label %174
174: ; preds = %192, %173
%175 = load i32, i32* %16
%176 = load i32, i32* %13
%177 = icmp slt i32 %175, %176
br i1 %177, label %178, label %195
178: ; preds = %174
%179 = load i32*, i32** %14
%180 = load i32, i32* %16
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds i32, i32* %179, i64 %181
%183 = load i32, i32* %182
%184 = call i32 @FD_ISSET(i32 %183, i32* %21)
%185 = icmp ne i32 %184, 0
br i1 %185, label %191, label %186
186: ; preds = %178
%187 = load i32*, i32** %14
%188 = load i32, i32* %16
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i32, i32* %187, i64 %189
store i32 0, i32* %190
br label %191
191: ; preds = %186, %178
br label %192
192: ; preds = %191
%193 = load i32, i32* %16
%194 = add nsw i32 %193, 1
store i32 %194, i32* %16
br label %174
195: ; preds = %174
%196 = load i32, i32* %18
store i32 %196, i32* %8
br label %197
197: ; preds = %195, %127
%198 = load i32, i32* %8
ret i32 %198
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define i32 @pselect_(i32 %0, i32* nocapture %1, i32 %2, i32* nocapture %3, i32 %4, i32* nocapture %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.timespec
%12 = alloca i32
%13 = bitcast i32* %8 to i8*
%14 = bitcast i32* %9 to i8*
%15 = bitcast i32* %10 to i8*
%16 = bitcast %struct.timespec* %11 to i8*
%17 = bitcast i32* %12 to i8*
%18 = call i32 @FD_ZERO(i32* %8)
%19 = icmp sgt i32 %0, 0
br i1 %19, label %20, label %33
20: ; preds = %7
%21 = zext i32 %0 to i64
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ 0, %20 ], [ %31, %22 ]
%24 = phi i32 [ -1, %20 ], [ %30, %22 ]
%25 = getelementptr inbounds i32, i32* %1, i64 %23
%26 = load i32, i32* %25
%27 = call i32 @FD_SET(i32 %26, i32* %8)
%28 = load i32, i32* %25
%29 = icmp sgt i32 %28, %24
%30 = select i1 %29, i32 %28, i32 %24
%31 = add nuw nsw i64 %23, 1
%32 = icmp eq i64 %31, %21
br i1 %32, label %33, label %22
33: ; preds = %22, %7
%34 = phi i32 [ -1, %7 ], [ %30, %22 ]
%35 = call i32 @FD_ZERO(i32* %9)
%36 = icmp sgt i32 %2, 0
br i1 %36, label %37, label %50
37: ; preds = %33
%38 = zext i32 %2 to i64
br label %39
39: ; preds = %37, %39
%40 = phi i64 [ 0, %37 ], [ %48, %39 ]
%41 = phi i32 [ %34, %37 ], [ %47, %39 ]
%42 = getelementptr inbounds i32, i32* %3, i64 %40
%43 = load i32, i32* %42
%44 = call i32 @FD_SET(i32 %43, i32* %9)
%45 = load i32, i32* %42
%46 = icmp sgt i32 %45, %41
%47 = select i1 %46, i32 %45, i32 %41
%48 = add nuw nsw i64 %40, 1
%49 = icmp eq i64 %48, %38
br i1 %49, label %50, label %39
50: ; preds = %39, %33
%51 = phi i32 [ %34, %33 ], [ %47, %39 ]
%52 = call i32 @FD_ZERO(i32* %10)
%53 = icmp sgt i32 %4, 0
br i1 %53, label %54, label %67
54: ; preds = %50
%55 = zext i32 %4 to i64
br label %56
56: ; preds = %54, %56
%57 = phi i64 [ 0, %54 ], [ %65, %56 ]
%58 = phi i32 [ %51, %54 ], [ %64, %56 ]
%59 = getelementptr inbounds i32, i32* %5, i64 %57
%60 = load i32, i32* %59
%61 = call i32 @FD_SET(i32 %60, i32* %10)
%62 = load i32, i32* %59
%63 = icmp sgt i32 %62, %58
%64 = select i1 %63, i32 %62, i32 %58
%65 = add nuw nsw i64 %57, 1
%66 = icmp eq i64 %65, %55
br i1 %66, label %67, label %56
67: ; preds = %56, %50
%68 = phi i32 [ %51, %50 ], [ %64, %56 ]
%69 = sdiv i32 %6, 1000
%70 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 0
store i32 %69, i32* %70
%71 = srem i32 %6, 1000
%72 = mul nsw i32 %71, 1000000
%73 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i64 0, i32 1
store i32 %72, i32* %73
%74 = call i32 @sigfillset(i32* %12)
%75 = add nsw i32 %68, 1
%76 = call i32 @pselect(i32 %75, i32* %8, i32* %9, i32* %10, %struct.timespec* %11, i32* %12)
%77 = icmp eq i32 %76, -1
br i1 %77, label %117, label %78
78: ; preds = %67
br i1 %19, label %79, label %81
79: ; preds = %78
%80 = zext i32 %0 to i64
br label %84
81: ; preds = %91, %78
br i1 %36, label %82, label %94
82: ; preds = %81
%83 = zext i32 %2 to i64
br label %97
84: ; preds = %79, %91
%85 = phi i64 [ 0, %79 ], [ %92, %91 ]
%86 = getelementptr inbounds i32, i32* %1, i64 %85
%87 = load i32, i32* %86
%88 = call i32 @FD_ISSET(i32 %87, i32* %8)
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %84
store i32 0, i32* %86
br label %91
91: ; preds = %84, %90
%92 = add nuw nsw i64 %85, 1
%93 = icmp eq i64 %92, %80
br i1 %93, label %81, label %84
94: ; preds = %104, %81
br i1 %53, label %95, label %117
95: ; preds = %94
%96 = zext i32 %4 to i64
br label %107
97: ; preds = %82, %104
%98 = phi i64 [ 0, %82 ], [ %105, %104 ]
%99 = getelementptr inbounds i32, i32* %3, i64 %98
%100 = load i32, i32* %99
%101 = call i32 @FD_ISSET(i32 %100, i32* %9)
%102 = icmp eq i32 %101, 0
br i1 %102, label %103, label %104
103: ; preds = %97
store i32 0, i32* %99
br label %104
104: ; preds = %97, %103
%105 = add nuw nsw i64 %98, 1
%106 = icmp eq i64 %105, %83
br i1 %106, label %94, label %97
107: ; preds = %95, %114
%108 = phi i64 [ 0, %95 ], [ %115, %114 ]
%109 = getelementptr inbounds i32, i32* %5, i64 %108
%110 = load i32, i32* %109
%111 = call i32 @FD_ISSET(i32 %110, i32* %10)
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %114
113: ; preds = %107
store i32 0, i32* %109
br label %114
114: ; preds = %107, %113
%115 = add nuw nsw i64 %108, 1
%116 = icmp eq i64 %115, %96
br i1 %116, label %117, label %107
117: ; preds = %114, %94, %67
ret i32 %76
}