#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*/ fdset;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_CLR(int, int /*<<< orphan*/ *);
int FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  fd_set fdset;
  FD_ZERO(&fdset);
  FD_SET(1, &fdset);
  FD_SET(2, &fdset);
  FD_SET(3, &fdset);
  FD_SET(7, &fdset);
  int isset = FD_ISSET(3, &fdset);
  printf("isset = %d\n", isset);
  printf("fdset sizeof is %ld\n", sizeof(fdset));
  FD_CLR(3, &fdset);
  printf("fdset sizeof is %ld\n", sizeof(fdset));
  isset = FD_ISSET(3, &fdset);
  printf("isset = %d\n", isset);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <FD_ZERO@plt>
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    $0x2,%edi
lea    -0x8(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    $0x3,%edi
lea    -0x8(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    $0x7,%edi
lea    -0x8(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    $0x3,%edi
lea    -0x8(%rbp),%rsi
call   1030 <FD_ISSET@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
lea    0xe45(%rip),%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
lea    -0x8(%rbp),%rsi
call   1060 <FD_CLR@plt>
lea    0xe26(%rip),%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
lea    -0x8(%rbp),%rsi
call   1030 <FD_ISSET@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdf5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <FD_ZERO@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1070 <FD_SET@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1070 <FD_SET@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1070 <FD_SET@plt>
mov    $0x7,%edi
mov    %rbx,%rsi
call   1070 <FD_SET@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1030 <FD_ISSET@plt>
lea    0xe52(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xe4d(%rip),%r15
mov    %r15,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1060 <FD_CLR@plt>
mov    %r15,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1030 <FD_ISSET@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"isset = %d\0A\00"
@.str.1 = [21 x i8] c"fdset sizeof is %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @FD_ZERO(i32* %2)
%5 = call i32 @FD_SET(i32 1, i32* %2)
%6 = call i32 @FD_SET(i32 2, i32* %2)
%7 = call i32 @FD_SET(i32 3, i32* %2)
%8 = call i32 @FD_SET(i32 7, i32* %2)
%9 = call i32 @FD_ISSET(i32 3, i32* %2)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4)
%13 = call i32 @FD_CLR(i32 3, i32* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4)
%15 = call i32 @FD_ISSET(i32 3, i32* %2)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"isset = %d\0A\00"
@.str.1 = [21 x i8] c"fdset sizeof is %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @FD_ZERO(i32* %1)
%4 = call i32 @FD_SET(i32 1, i32* %1)
%5 = call i32 @FD_SET(i32 2, i32* %1)
%6 = call i32 @FD_SET(i32 3, i32* %1)
%7 = call i32 @FD_SET(i32 7, i32* %1)
%8 = call i32 @FD_ISSET(i32 3, i32* %1)
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4)
%11 = call i32 @FD_CLR(i32 3, i32* %1)
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4)
%13 = call i32 @FD_ISSET(i32 3, i32* %1)
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}