#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_ISSET(int, int /*<<< orphan*/ const *);
int /*<<< orphan*/ Tvba(char const *);
int /*<<< orphan*/ Tvbf(char *, int);
void Tvbfdset(int max, const fd_set *fds) {
  int i;
  const char *comma = "";
  Tvba("[");
  for (i = 0; i < max; i++) {
    if (!FD_ISSET(i, fds))
      continue;
    Tvba(comma);
    Tvbf("%d", i);
    comma = ",";
  }
  Tvba("]");
}


x86 assembly (clang, -O0):
<Tvbfdset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec0(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeaf(%rip),%rdi
call   1040 <Tvba@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b4 <Tvbfdset+0x84>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%eax
jne    1183 <Tvbfdset+0x53>
jmp    11a6 <Tvbfdset+0x76>
mov    -0x20(%rbp),%rdi
call   1040 <Tvba@plt>
mov    -0x14(%rbp),%esi
lea    0xe6c(%rip),%rdi
call   1050 <Tvbf@plt>
lea    0xe63(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <Tvbfdset+0x2d>
lea    0xe4c(%rip),%rdi
call   1040 <Tvba@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tvbfdset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r12d
lea    0xeb8(%rip),%rdi
call   1040 <Tvba@plt>
test   %r12d,%r12d
jle    119d <Tvbfdset+0x6d>
xor    %ebx,%ebx
lea    0xeab(%rip),%rbp
lea    0xea0(%rip),%r15
lea    0xe9c(%rip),%r13
jmp    1178 <Tvbfdset+0x48>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %ebx,%r12d
je     119d <Tvbfdset+0x6d>
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <FD_ISSET@plt>
test   %eax,%eax
je     1170 <Tvbfdset+0x40>
mov    %rbp,%rdi
call   1040 <Tvba@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1050 <Tvbf@plt>
mov    %r13,%rbp
jmp    1170 <Tvbfdset+0x40>
lea    0xe63(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <Tvba@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"[\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [2 x i8] c"]\00"
define void @Tvbfdset(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i32* %1, i32** %4
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = call i32 @Tvba(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i32, i32* %5
%14 = load i32*, i32** %4
%15 = call i32 @FD_ISSET(i32 %13, i32* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %12
br label %23
18: ; preds = %12
%19 = load i8*, i8** %6
%20 = call i32 @Tvba(i8* %19)
%21 = load i32, i32* %5
%22 = call i32 @Tvbf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %21)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %6
br label %23
23: ; preds = %18, %17
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %8
26: ; preds = %8
%27 = call i32 @Tvba(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"[\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [2 x i8] c"]\00"
define void @Tvbfdset(i32 %0, i32* %1) {
%3 = tail call i32 @Tvba(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %17
5: ; preds = %2, %13
%6 = phi i8* [ %14, %13 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%7 = phi i32 [ %15, %13 ], [ 0, %2 ]
%8 = tail call i32 @FD_ISSET(i32 %7, i32* %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = tail call i32 @Tvba(i8* %6)
%12 = tail call i32 @Tvbf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %13
13: ; preds = %5, %10
%14 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %10 ], [ %6, %5 ]
%15 = add nuw nsw i32 %7, 1
%16 = icmp eq i32 %15, %0
br i1 %16, label %17, label %5
17: ; preds = %13, %2
%18 = tail call i32 @Tvba(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}