#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 /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int O_CREAT;
int O_RDONLY;
int O_RDWR;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dump_fdset(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int open(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ unlink(char *);
void main(void) {
  int fd1, fd2, fd3, fd4, fd5, fd6;
  fd_set fds_read, fds_write;
  int retval;
  fd1 = open("dummy1.txt", O_CREAT | O_RDONLY);
  if (fd1 < 0) {
    perror("Error opening file");
    exit(-1);
  }
  fd2 = open("dummy2.txt", O_CREAT | O_RDONLY);
  if (fd2 < 0) {
    perror("Error opening file");
    exit(-1);
  }
  fd3 = open("dummy3.txt", O_CREAT | O_WRONLY);
  if (fd3 < 0) {
    perror("Error opening file");
    exit(-1);
  }
  fd4 = open("dummy4.txt", O_CREAT | O_WRONLY);
  if (fd4 < 0) {
    perror("Error opening file");
    exit(-1);
  }
  fd5 = open("dummy5.txt", O_CREAT | O_RDWR);
  if (fd5 < 0) {
    perror("Error opening file");
    exit(-1);
  }
  fd6 = open("dummy6.txt", O_CREAT | O_RDWR);
  if (fd6 < 0) {
    perror("Error opening file");
    exit(-1);
  }
  FD_ZERO(&fds_read);
  FD_ZERO(&fds_write);
  FD_SET(fd1, &fds_read);
  FD_SET(fd2, &fds_read);
  FD_SET(fd3, &fds_write);
  FD_SET(fd4, &fds_write);
  FD_SET(fd5, &fds_read);
  FD_SET(fd5, &fds_write);
  FD_SET(fd6, &fds_read);
  FD_SET(fd6, &fds_write);
  printf("* Dump INPUT fds_read:\n");
  dump_fdset(&fds_read);
  printf("* Dump INPUT fds_write:\n");
  dump_fdset(&fds_write);
  retval = select(9, &fds_read, &fds_write, NULL, NULL);
  printf("\n***********************\n");
  printf("After select: \n");
  printf("Return value: %d\n", retval);
  printf("* Dump RESULTING fds_read:\n");
  dump_fdset(&fds_read);
  printf("* Dump RESULTING fds_write:\n");
  dump_fdset(&fds_write);
  close(fd1);
  close(fd2);
  close(fd3);
  close(fd4);
  close(fd5);
  close(fd6);
  unlink("dummy1.txt");
  unlink("dummy2.txt");
  unlink("dummy3.txt");
  unlink("dummy4.txt");
  unlink("dummy5.txt");
  unlink("dummy6.txt");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
mov    0x2e20(%rip),%rax
or     (%rax),%esi
lea    0xe3f(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    11e9 <main+0x49>
lea    0xe31(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
mov    0x2ddf(%rip),%rax
or     (%rax),%esi
lea    0xe1c(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    122a <main+0x8a>
lea    0xdf0(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
mov    0x2d86(%rip),%rax
or     (%rax),%esi
lea    0xde6(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    126b <main+0xcb>
lea    0xdaf(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%esi
mov    0x2d45(%rip),%rax
or     (%rax),%esi
lea    0xdb0(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    12ac <main+0x10c>
lea    0xd6e(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2d45(%rip),%rax
mov    (%rax),%esi
mov    0x2d24(%rip),%rax
or     (%rax),%esi
lea    0xd7a(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12ed <main+0x14d>
lea    0xd2d(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2d04(%rip),%rax
mov    (%rax),%esi
mov    0x2ce3(%rip),%rax
or     (%rax),%esi
lea    0xd44(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    132e <main+0x18e>
lea    0xcec(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    -0x1c(%rbp),%rdi
call   1060 <FD_ZERO@plt>
lea    -0x20(%rbp),%rdi
call   1060 <FD_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x8(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0xc(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x10(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x14(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x18(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x18(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10c0 <FD_SET@plt>
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1c(%rbp),%rdi
call   1090 <dump_fdset@plt>
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1090 <dump_fdset@plt>
mov    $0x9,%edi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1070 <select@plt>
mov    %eax,-0x24(%rbp)
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xca0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xca3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1c(%rbp),%rdi
call   1090 <dump_fdset@plt>
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1090 <dump_fdset@plt>
mov    -0x4(%rbp),%edi
call   1050 <close@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
mov    -0xc(%rbp),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%edi
call   1050 <close@plt>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    -0x18(%rbp),%edi
call   1050 <close@plt>
lea    0xb83(%rip),%rdi
call   1030 <unlink@plt>
lea    0xb95(%rip),%rdi
call   1030 <unlink@plt>
lea    0xb94(%rip),%rdi
call   1030 <unlink@plt>
lea    0xb93(%rip),%rdi
call   1030 <unlink@plt>
lea    0xb92(%rip),%rdi
call   1030 <unlink@plt>
lea    0xb91(%rip),%rdi
call   1030 <unlink@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2e33(%rip),%r14
mov    0x2e0c(%rip),%rbx
mov    (%rbx),%esi
or     (%r14),%esi
lea    0xe28(%rip),%rdi
call   1090 <open@plt>
mov    %eax,0x1c(%rsp)
test   %eax,%eax
js     1421 <main+0x271>
mov    (%rbx),%esi
or     (%r14),%esi
lea    0xe29(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1421 <main+0x271>
mov    %eax,%ebp
mov    0x2db5(%rip),%r15
mov    (%r15),%esi
or     (%r14),%esi
lea    0xe11(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1421 <main+0x271>
mov    %eax,%r12d
mov    (%r15),%esi
or     (%r14),%esi
lea    0xdff(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1421 <main+0x271>
mov    %eax,0xc(%rsp)
mov    0x2d93(%rip),%r15
mov    (%r15),%esi
or     (%r14),%esi
lea    0xde5(%rip),%rdi
call   1090 <open@plt>
mov    %eax,0x18(%rsp)
test   %eax,%eax
js     1421 <main+0x271>
mov    (%r15),%esi
or     (%r14),%esi
lea    0xdd2(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1421 <main+0x271>
mov    %eax,%r13d
lea    0x24(%rsp),%r15
mov    %r15,%rdi
call   1070 <FD_ZERO@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1070 <FD_ZERO@plt>
mov    0x1c(%rsp),%ebx
mov    %ebx,%edi
mov    %r15,%rsi
call   10d0 <FD_SET@plt>
mov    %ebp,0x14(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
call   10d0 <FD_SET@plt>
mov    %r12d,0x10(%rsp)
mov    %r12d,%edi
mov    %r14,%rsi
call   10d0 <FD_SET@plt>
mov    0xc(%rsp),%edi
mov    %r14,%rsi
call   10d0 <FD_SET@plt>
mov    0x18(%rsp),%ebp
mov    %ebp,%edi
mov    %r15,%rsi
call   10d0 <FD_SET@plt>
mov    %ebp,%edi
mov    %r14,%rsi
call   10d0 <FD_SET@plt>
mov    %r13d,%edi
mov    %r15,%rsi
call   10d0 <FD_SET@plt>
mov    %r13d,%edi
mov    %r14,%rsi
call   10d0 <FD_SET@plt>
lea    0xd58(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10a0 <dump_fdset@plt>
lea    0xd5b(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   10a0 <dump_fdset@plt>
mov    $0x9,%edi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1080 <select@plt>
mov    %eax,%r12d
lea    0xd47(%rip),%rdi
call   1040 <puts@plt>
lea    0xd54(%rip),%rdi
call   1040 <puts@plt>
lea    0xcee(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd46(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10a0 <dump_fdset@plt>
lea    0xd4d(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   10a0 <dump_fdset@plt>
mov    %ebx,%edi
call   1060 <close@plt>
mov    0x14(%rsp),%edi
call   1060 <close@plt>
mov    0x10(%rsp),%edi
call   1060 <close@plt>
mov    0xc(%rsp),%edi
call   1060 <close@plt>
mov    %ebp,%edi
call   1060 <close@plt>
mov    %r13d,%edi
call   1060 <close@plt>
lea    0xc2f(%rip),%rdi
call   1030 <unlink@plt>
lea    0xc41(%rip),%rdi
call   1030 <unlink@plt>
lea    0xc40(%rip),%rdi
call   1030 <unlink@plt>
lea    0xc3f(%rip),%rdi
call   1030 <unlink@plt>
lea    0xc3e(%rip),%rdi
call   1030 <unlink@plt>
lea    0xc3d(%rip),%rdi
call   1030 <unlink@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbe3(%rip),%rdi
call   10b0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"dummy1.txt\00"
@O_CREAT = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [19 x i8] c"Error opening file\00"
@.str.2 = [11 x i8] c"dummy2.txt\00"
@.str.3 = [11 x i8] c"dummy3.txt\00"
@O_WRONLY = global i32 0
@.str.4 = [11 x i8] c"dummy4.txt\00"
@.str.5 = [11 x i8] c"dummy5.txt\00"
@O_RDWR = global i32 0
@.str.6 = [11 x i8] c"dummy6.txt\00"
@.str.7 = [24 x i8] c"* Dump INPUT fds_read:\0A\00"
@.str.8 = [25 x i8] c"* Dump INPUT fds_write:\0A\00"
@.str.9 = [26 x i8] c"\0A***********************\0A\00"
@.str.10 = [16 x i8] c"After select: \0A\00"
@.str.11 = [18 x i8] c"Return value: %d\0A\00"
@.str.12 = [28 x i8] c"* Dump RESULTING fds_read:\0A\00"
@.str.13 = [29 x i8] c"* Dump RESULTING fds_write:\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = load i32, i32* @O_CREAT
%11 = load i32, i32* @O_RDONLY
%12 = or i32 %10, %11
%13 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %0
%20 = load i32, i32* @O_CREAT
%21 = load i32, i32* @O_RDONLY
%22 = or i32 %20, %21
%23 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %22)
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @exit(i32 -1)
unreachable
29: ; preds = %19
%30 = load i32, i32* @O_CREAT
%31 = load i32, i32* @O_WRONLY
%32 = or i32 %30, %31
%33 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %32)
store i32 %33, i32* %3
%34 = load i32, i32* %3
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %29
%37 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @exit(i32 -1)
unreachable
39: ; preds = %29
%40 = load i32, i32* @O_CREAT
%41 = load i32, i32* @O_WRONLY
%42 = or i32 %40, %41
%43 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %42)
store i32 %43, i32* %4
%44 = load i32, i32* %4
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %39
%47 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%48 = call i32 @exit(i32 -1)
unreachable
49: ; preds = %39
%50 = load i32, i32* @O_CREAT
%51 = load i32, i32* @O_RDWR
%52 = or i32 %50, %51
%53 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %52)
store i32 %53, i32* %5
%54 = load i32, i32* %5
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %49
%57 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%58 = call i32 @exit(i32 -1)
unreachable
59: ; preds = %49
%60 = load i32, i32* @O_CREAT
%61 = load i32, i32* @O_RDWR
%62 = or i32 %60, %61
%63 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %62)
store i32 %63, i32* %6
%64 = load i32, i32* %6
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %59
%67 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%68 = call i32 @exit(i32 -1)
unreachable
69: ; preds = %59
%70 = call i32 @FD_ZERO(i32* %7)
%71 = call i32 @FD_ZERO(i32* %8)
%72 = load i32, i32* %1
%73 = call i32 @FD_SET(i32 %72, i32* %7)
%74 = load i32, i32* %2
%75 = call i32 @FD_SET(i32 %74, i32* %7)
%76 = load i32, i32* %3
%77 = call i32 @FD_SET(i32 %76, i32* %8)
%78 = load i32, i32* %4
%79 = call i32 @FD_SET(i32 %78, i32* %8)
%80 = load i32, i32* %5
%81 = call i32 @FD_SET(i32 %80, i32* %7)
%82 = load i32, i32* %5
%83 = call i32 @FD_SET(i32 %82, i32* %8)
%84 = load i32, i32* %6
%85 = call i32 @FD_SET(i32 %84, i32* %7)
%86 = load i32, i32* %6
%87 = call i32 @FD_SET(i32 %86, i32* %8)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%89 = call i32 @dump_fdset(i32* %7)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%91 = call i32 @dump_fdset(i32* %8)
%92 = call i32 @select(i32 9, i32* %7, i32* %8, i32* null, i32* null)
store i32 %92, i32* %9
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%95 = load i32, i32* %9
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %95)
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0))
%98 = call i32 @dump_fdset(i32* %7)
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0))
%100 = call i32 @dump_fdset(i32* %8)
%101 = load i32, i32* %1
%102 = call i32 @close(i32 %101)
%103 = load i32, i32* %2
%104 = call i32 @close(i32 %103)
%105 = load i32, i32* %3
%106 = call i32 @close(i32 %105)
%107 = load i32, i32* %4
%108 = call i32 @close(i32 %107)
%109 = load i32, i32* %5
%110 = call i32 @close(i32 %109)
%111 = load i32, i32* %6
%112 = call i32 @close(i32 %111)
%113 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%114 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%115 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%116 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%117 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%118 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"dummy1.txt\00"
@O_CREAT = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [19 x i8] c"Error opening file\00"
@.str.2 = [11 x i8] c"dummy2.txt\00"
@.str.3 = [11 x i8] c"dummy3.txt\00"
@O_WRONLY = global i32 0
@.str.4 = [11 x i8] c"dummy4.txt\00"
@.str.5 = [11 x i8] c"dummy5.txt\00"
@O_RDWR = global i32 0
@.str.6 = [11 x i8] c"dummy6.txt\00"
@.str.11 = [18 x i8] c"Return value: %d\0A\00"
@str = [23 x i8] c"* Dump INPUT fds_read:\00"
@str.14 = [24 x i8] c"* Dump INPUT fds_write:\00"
@str.15 = [25 x i8] c"\0A***********************\00"
@str.16 = [15 x i8] c"After select: \00"
@str.17 = [27 x i8] c"* Dump RESULTING fds_read:\00"
@str.18 = [28 x i8] c"* Dump RESULTING fds_write:\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @O_CREAT
%6 = load i32, i32* @O_RDONLY
%7 = or i32 %6, %5
%8 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @exit(i32 -1)
unreachable
13: ; preds = %0
%14 = load i32, i32* @O_CREAT
%15 = load i32, i32* @O_RDONLY
%16 = or i32 %15, %14
%17 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i32 @exit(i32 -1)
unreachable
22: ; preds = %13
%23 = load i32, i32* @O_CREAT
%24 = load i32, i32* @O_WRONLY
%25 = or i32 %24, %23
%26 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%30 = tail call i32 @exit(i32 -1)
unreachable
31: ; preds = %22
%32 = load i32, i32* @O_CREAT
%33 = load i32, i32* @O_WRONLY
%34 = or i32 %33, %32
%35 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %31
%38 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%39 = tail call i32 @exit(i32 -1)
unreachable
40: ; preds = %31
%41 = load i32, i32* @O_CREAT
%42 = load i32, i32* @O_RDWR
%43 = or i32 %42, %41
%44 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %43)
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %40
%47 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%48 = tail call i32 @exit(i32 -1)
unreachable
49: ; preds = %40
%50 = load i32, i32* @O_CREAT
%51 = load i32, i32* @O_RDWR
%52 = or i32 %51, %50
%53 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %52)
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%57 = tail call i32 @exit(i32 -1)
unreachable
58: ; preds = %49
%59 = call i32 @FD_ZERO(i32* %1)
%60 = call i32 @FD_ZERO(i32* %2)
%61 = call i32 @FD_SET(i32 %8, i32* %1)
%62 = call i32 @FD_SET(i32 %17, i32* %1)
%63 = call i32 @FD_SET(i32 %26, i32* %2)
%64 = call i32 @FD_SET(i32 %35, i32* %2)
%65 = call i32 @FD_SET(i32 %44, i32* %1)
%66 = call i32 @FD_SET(i32 %44, i32* %2)
%67 = call i32 @FD_SET(i32 %53, i32* %1)
%68 = call i32 @FD_SET(i32 %53, i32* %2)
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%70 = call i32 @dump_fdset(i32* %1)
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
%72 = call i32 @dump_fdset(i32* %2)
%73 = call i32 @select(i32 9, i32* %1, i32* %2, i32* null, i32* null)
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.15, i64 0, i64 0))
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.16, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %73)
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.17, i64 0, i64 0))
%78 = call i32 @dump_fdset(i32* %1)
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.18, i64 0, i64 0))
%80 = call i32 @dump_fdset(i32* %2)
%81 = call i32 @close(i32 %8)
%82 = call i32 @close(i32 %17)
%83 = call i32 @close(i32 %26)
%84 = call i32 @close(i32 %35)
%85 = call i32 @close(i32 %44)
%86 = call i32 @close(i32 %53)
%87 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%88 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%89 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%90 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%91 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%92 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
ret void
}