#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 config {
  int dummy;
};
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ IceListenObj;

/* Variables and functions */
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ doProcessReadables(int, int *, int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *, int *,
                                      struct config *, int /*<<< orphan*/ **);
int /*<<< orphan*/ doProcessWritables(int, int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
void doProcessSelect(int *nfds, int *nready, fd_set *readable, fd_set *writable,
                     fd_set *rinit, fd_set *winit, int pm_listen_array[],
                     struct config *config_info,
                     IceListenObj **listen_objects) {
  int fd_counter;
  for (fd_counter = 0; fd_counter < *nfds && *nready; fd_counter++) {
    if (FD_ISSET(fd_counter, writable)) {
      *nready -= 1;
      doProcessWritables(fd_counter, rinit, winit);
    }
    if (FD_ISSET(fd_counter, readable)) {
      *nready -= 1;
      doProcessReadables(fd_counter, nfds, rinit, winit, pm_listen_array,
                         config_info, listen_objects);
    }
  }
}


x86 assembly (clang, -O0):
<doProcessSelect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
mov    -0x8(%rbp),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
mov    %al,-0x35(%rbp)
jge    1184 <doProcessSelect+0x54>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
test   $0x1,%al
jne    1194 <doProcessSelect+0x64>
jmp    121d <doProcessSelect+0xed>
mov    -0x34(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     11c5 <doProcessSelect+0x95>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x34(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <doProcessWritables@plt>
mov    -0x34(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     120a <doProcessSelect+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x34(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%r8
mov    0x18(%rbp),%r9
mov    0x20(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <doProcessReadables@plt>
jmp    120f <doProcessSelect+0xdf>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1163 <doProcessSelect+0x33>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doProcessSelect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
cmpl   $0x0,(%rdi)
jle    11cb <doProcessSelect+0x9b>
mov    %r9,%r14
mov    %r8,%r13
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%rbp
xor    %r15d,%r15d
jmp    116a <doProcessSelect+0x3a>
add    $0x1,%r15d
cmp    0x0(%rbp),%r15d
jge    11cb <doProcessSelect+0x9b>
cmpl   $0x0,(%rbx)
je     11cb <doProcessSelect+0x9b>
mov    %r15d,%edi
mov    0x10(%rsp),%rsi
call   1030 <FD_ISSET@plt>
test   %rax,%rax
je     1192 <doProcessSelect+0x62>
addl   $0xffffffff,(%rbx)
mov    %r15d,%edi
mov    %r13,%rsi
mov    %r14,%rdx
call   1050 <doProcessWritables@plt>
mov    %r15d,%edi
mov    %r12,%rsi
call   1030 <FD_ISSET@plt>
test   %rax,%rax
je     1160 <doProcessSelect+0x30>
addl   $0xffffffff,(%rbx)
mov    0x60(%rsp),%rax
mov    %rax,(%rsp)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
mov    0x50(%rsp),%r8
mov    0x58(%rsp),%r9
call   1040 <doProcessReadables@plt>
jmp    1160 <doProcessSelect+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.config = type { i32 }
define void @doProcessSelect(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, %struct.config* %7, i32** %8) {
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca %struct.config*
%18 = alloca i32**
%19 = alloca i32
store i32* %0, i32** %10
store i32* %1, i32** %11
store i32* %2, i32** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store %struct.config* %7, %struct.config** %17
store i32** %8, i32*** %18
store i32 0, i32* %19
br label %20
20: ; preds = %62, %9
%21 = load i32, i32* %19
%22 = load i32*, i32** %10
%23 = load i32, i32* %22
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = load i32*, i32** %11
%27 = load i32, i32* %26
%28 = icmp ne i32 %27, 0
br label %29
29: ; preds = %25, %20
%30 = phi i1 [ false, %20 ], [ %28, %25 ]
br i1 %30, label %31, label %65
31: ; preds = %29
%32 = load i32, i32* %19
%33 = load i32*, i32** %13
%34 = call i64 @FD_ISSET(i32 %32, i32* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %44
36: ; preds = %31
%37 = load i32*, i32** %11
%38 = load i32, i32* %37
%39 = sub nsw i32 %38, 1
store i32 %39, i32* %37
%40 = load i32, i32* %19
%41 = load i32*, i32** %14
%42 = load i32*, i32** %15
%43 = call i32 @doProcessWritables(i32 %40, i32* %41, i32* %42)
br label %44
44: ; preds = %36, %31
%45 = load i32, i32* %19
%46 = load i32*, i32** %12
%47 = call i64 @FD_ISSET(i32 %45, i32* %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %61
49: ; preds = %44
%50 = load i32*, i32** %11
%51 = load i32, i32* %50
%52 = sub nsw i32 %51, 1
store i32 %52, i32* %50
%53 = load i32, i32* %19
%54 = load i32*, i32** %10
%55 = load i32*, i32** %14
%56 = load i32*, i32** %15
%57 = load i32*, i32** %16
%58 = load %struct.config*, %struct.config** %17
%59 = load i32**, i32*** %18
%60 = call i32 @doProcessReadables(i32 %53, i32* %54, i32* %55, i32* %56, i32* %57, %struct.config* %58, i32** %59)
br label %61
61: ; preds = %49, %44
br label %62
62: ; preds = %61
%63 = load i32, i32* %19
%64 = add nsw i32 %63, 1
store i32 %64, i32* %19
br label %20
65: ; preds = %29
ret void
}

LLVM IR (-O2):
%struct.config = type { i32 }
define void @doProcessSelect(i32* %0, i32* nocapture %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, %struct.config* %7, i32** %8) {
%10 = load i32, i32* %0
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %9, %30
%13 = phi i32 [ %31, %30 ], [ 0, %9 ]
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 0
br i1 %15, label %34, label %16
16: ; preds = %12
%17 = tail call i64 @FD_ISSET(i32 %13, i32* %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = load i32, i32* %1
%21 = add nsw i32 %20, -1
store i32 %21, i32* %1
%22 = tail call i32 @doProcessWritables(i32 %13, i32* %4, i32* %5)
br label %23
23: ; preds = %19, %16
%24 = tail call i64 @FD_ISSET(i32 %13, i32* %2)
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = load i32, i32* %1
%28 = add nsw i32 %27, -1
store i32 %28, i32* %1
%29 = tail call i32 @doProcessReadables(i32 %13, i32* %0, i32* %4, i32* %5, i32* %6, %struct.config* %7, i32** %8)
br label %30
30: ; preds = %23, %26
%31 = add nuw nsw i32 %13, 1
%32 = load i32, i32* %0
%33 = icmp slt i32 %31, %32
br i1 %33, label %12, label %34
34: ; preds = %12, %30, %9
ret void
}