#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 pollfd {
  int fd;
  int events;
  int revents;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int POLLIN;
int /*<<< orphan*/ dup2(void *, int);
void *fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int poll(struct pollfd *, int, int);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int main() {
  FILE *f;
  struct pollfd pfds[5];
  int i, flag;
  char str[1024];
  f = popen("./p1_2", "r");
  pfds[0].fd = fileno(f);
  f = popen("./p1_3", "r");
  pfds[1].fd = fileno(f);
  f = popen("./p1_4", "r");
  pfds[2].fd = fileno(f);
  f = popen("./p1_5", "r");
  pfds[3].fd = fileno(f);
  f = popen("./p1_6", "w");
  for (i = 0; i < 4; ++i) {
    pfds[i].events = POLLIN;
  }
  printf("Opened all process\n");
  while (1) {
    int res = poll(pfds, 5, 100);
    if (res < 0) {
      sleep(1);
      continue;
    }
    flag = 1;
    for (i = 0; i < 4; ++i) {
      if (pfds[i].revents & POLLIN) {
        flag = 0;
        memset(str, 0, 1024);
        read(pfds[i].fd, str, 1024);
        dup2(fileno(f), 1);
        printf("%s\n", str);
        sleep(1);
        pfds[i].fd = -1;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rdi
lea    0xe67(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <fileno@plt>
mov    %eax,-0x50(%rbp)
lea    0xe4d(%rip),%rdi
lea    0xe44(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <fileno@plt>
mov    %eax,-0x44(%rbp)
lea    0xe31(%rip),%rdi
lea    0xe21(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <fileno@plt>
mov    %eax,-0x38(%rbp)
lea    0xe15(%rip),%rdi
lea    0xdfe(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <fileno@plt>
mov    %eax,-0x2c(%rbp)
lea    0xdf9(%rip),%rdi
lea    0xdf9(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x4,-0x54(%rbp)
jge    126f <main+0xef>
mov    0x2d9b(%rip),%rax
mov    (%rax),%ecx
movslq -0x54(%rbp),%rdx
lea    -0x50(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    123c <main+0xbc>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x5,%esi
mov    $0x64,%edx
call   1080 <poll@plt>
mov    %eax,-0x464(%rbp)
cmpl   $0x0,-0x464(%rbp)
jge    12b2 <main+0x132>
mov    $0x1,%edi
call   10a0 <sleep@plt>
jmp    127d <main+0xfd>
movl   $0x1,-0x58(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x4,-0x54(%rbp)
jge    1387 <main+0x207>
movslq -0x54(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    0x2d05(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1374 <main+0x1f4>
movl   $0x0,-0x58(%rbp)
lea    -0x460(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
movslq -0x54(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%edi
lea    -0x460(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    -0x10(%rbp),%rdi
call   1070 <fileno@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1030 <dup2@plt>
lea    -0x460(%rbp),%rsi
lea    0xced(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
movslq -0x54(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movl   $0xffffffff,(%rax)
jmp    1379 <main+0x1f9>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12c0 <main+0x140>
jmp    127d <main+0xfd>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x448,%rsp
lea    0xe6b(%rip),%rdi
lea    0xe6b(%rip),%rbx
mov    %rbx,%rsi
call   1090 <popen@plt>
mov    %rax,%rdi
call   1070 <fileno@plt>
mov    %eax,(%rsp)
lea    0xe53(%rip),%rdi
mov    %rbx,%rsi
call   1090 <popen@plt>
mov    %rax,%rdi
call   1070 <fileno@plt>
mov    %eax,0xc(%rsp)
lea    0xe3f(%rip),%rdi
mov    %rbx,%rsi
call   1090 <popen@plt>
mov    %rax,%rdi
call   1070 <fileno@plt>
mov    %eax,0x18(%rsp)
lea    0xe2b(%rip),%rdi
mov    %rbx,%rsi
call   1090 <popen@plt>
mov    %rax,%rdi
call   1070 <fileno@plt>
mov    %eax,0x24(%rsp)
lea    0xe17(%rip),%rdi
lea    0xe17(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,%r15
mov    0x2dcb(%rip),%r12
mov    (%r12),%eax
mov    %eax,0x4(%rsp)
mov    %eax,0x10(%rsp)
mov    %eax,0x1c(%rsp)
mov    %eax,0x28(%rsp)
lea    0xdef(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r14
lea    0x40(%rsp),%rbx
jmp    125a <main+0xda>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x64,%edx
call   1080 <poll@plt>
test   %eax,%eax
js     1250 <main+0xd0>
mov    (%r12),%eax
test   %eax,0x8(%rsp)
je     12cb <main+0x14b>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    (%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %r15,%rdi
call   1070 <fileno@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <dup2@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
movl   $0xffffffff,(%rsp)
mov    (%r12),%eax
test   %eax,0x14(%rsp)
je     1324 <main+0x1a4>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %r15,%rdi
call   1070 <fileno@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <dup2@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
movl   $0xffffffff,0xc(%rsp)
ff
mov    (%r12),%eax
test   %eax,0x20(%rsp)
je     137d <main+0x1fd>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    0x18(%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %r15,%rdi
call   1070 <fileno@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <dup2@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
movl   $0xffffffff,0x18(%rsp)
ff
mov    (%r12),%eax
test   %eax,0x2c(%rsp)
je     125a <main+0xda>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    0x24(%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %r15,%rdi
call   1070 <fileno@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <dup2@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
movl   $0xffffffff,0x24(%rsp)
ff
jmp    125a <main+0xda>

LLVM IR (-O0):
%struct.pollfd = type { i32, i32, i32 }
@.str = [7 x i8] c"./p1_2\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"./p1_3\00"
@.str.3 = [7 x i8] c"./p1_4\00"
@.str.4 = [7 x i8] c"./p1_5\00"
@.str.5 = [7 x i8] c"./p1_6\00"
@.str.6 = [2 x i8] c"w\00"
@POLLIN = global i32 0
@.str.7 = [20 x i8] c"Opened all process\0A\00"
@.str.8 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [5 x %struct.pollfd]
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %2
%9 = load i32*, i32** %2
%10 = call i8* @fileno(i32* %9)
%11 = ptrtoint i8* %10 to i32
%12 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 0
%13 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %12, i32 0, i32 0
store i32 %11, i32* %13
%14 = call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %2
%15 = load i32*, i32** %2
%16 = call i8* @fileno(i32* %15)
%17 = ptrtoint i8* %16 to i32
%18 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 1
%19 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %18, i32 0, i32 0
store i32 %17, i32* %19
%20 = call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %2
%21 = load i32*, i32** %2
%22 = call i8* @fileno(i32* %21)
%23 = ptrtoint i8* %22 to i32
%24 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 2
%25 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %24, i32 0, i32 0
store i32 %23, i32* %25
%26 = call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %2
%27 = load i32*, i32** %2
%28 = call i8* @fileno(i32* %27)
%29 = ptrtoint i8* %28 to i32
%30 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 3
%31 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %30, i32 0, i32 0
store i32 %29, i32* %31
%32 = call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %32, i32** %2
store i32 0, i32* %4
br label %33
33: ; preds = %42, %0
%34 = load i32, i32* %4
%35 = icmp slt i32 %34, 4
br i1 %35, label %36, label %45
36: ; preds = %33
%37 = load i32, i32* @POLLIN
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 %39
%41 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %40, i32 0, i32 1
store i32 %37, i32* %41
br label %42
42: ; preds = %36
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %33
45: ; preds = %33
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %47
47: ; preds = %45, %52, %91
%48 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 0
%49 = call i32 @poll(%struct.pollfd* %48, i32 5, i32 100)
store i32 %49, i32* %7
%50 = load i32, i32* %7
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %47
%53 = call i32 @sleep(i32 1)
br label %47
54: ; preds = %47
store i32 1, i32* %5
store i32 0, i32* %4
br label %55
55: ; preds = %88, %54
%56 = load i32, i32* %4
%57 = icmp slt i32 %56, 4
br i1 %57, label %58, label %91
58: ; preds = %55
%59 = load i32, i32* %4
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 %60
%62 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %61, i32 0, i32 2
%63 = load i32, i32* %62
%64 = load i32, i32* @POLLIN
%65 = and i32 %63, %64
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %87
67: ; preds = %58
store i32 0, i32* %5
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%69 = call i32 @memset(i8* %68, i32 0, i32 1024)
%70 = load i32, i32* %4
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 %71
%73 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %72, i32 0, i32 0
%74 = load i32, i32* %73
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%76 = call i32 @read(i32 %74, i8* %75, i32 1024)
%77 = load i32*, i32** %2
%78 = call i8* @fileno(i32* %77)
%79 = call i32 @dup2(i8* %78, i32 1)
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %80)
%82 = call i32 @sleep(i32 1)
%83 = load i32, i32* %4
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %3, i64 0, i64 %84
%86 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %85, i32 0, i32 0
store i32 -1, i32* %86
br label %87
87: ; preds = %67, %58
br label %88
88: ; preds = %87
%89 = load i32, i32* %4
%90 = add nsw i32 %89, 1
store i32 %90, i32* %4
br label %55
91: ; preds = %55
br label %47
}

LLVM IR (-O2):
%struct.pollfd = type { i32, i32, i32 }
@.str = [7 x i8] c"./p1_2\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"./p1_3\00"
@.str.3 = [7 x i8] c"./p1_4\00"
@.str.4 = [7 x i8] c"./p1_5\00"
@.str.5 = [7 x i8] c"./p1_6\00"
@.str.6 = [2 x i8] c"w\00"
@POLLIN = global i32 0
@str = [19 x i8] c"Opened all process\00"
define i32 @main() {
%1 = alloca [5 x %struct.pollfd]
%2 = alloca [1024 x i8]
%3 = bitcast [5 x %struct.pollfd]* %1 to i8*
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i8* @fileno(i32* %5)
%7 = ptrtoint i8* %6 to i64
%8 = trunc i64 %7 to i32
%9 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 0, i32 0
store i32 %8, i32* %9
%10 = tail call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i8* @fileno(i32* %10)
%12 = ptrtoint i8* %11 to i64
%13 = trunc i64 %12 to i32
%14 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 1, i32 0
store i32 %13, i32* %14
%15 = tail call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i8* @fileno(i32* %15)
%17 = ptrtoint i8* %16 to i64
%18 = trunc i64 %17 to i32
%19 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 2, i32 0
store i32 %18, i32* %19
%20 = tail call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i8* @fileno(i32* %20)
%22 = ptrtoint i8* %21 to i64
%23 = trunc i64 %22 to i32
%24 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 3, i32 0
store i32 %23, i32* %24
%25 = tail call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%26 = load i32, i32* @POLLIN
%27 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 0, i32 1
store i32 %26, i32* %27
%28 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 1, i32 1
store i32 %26, i32* %28
%29 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 2, i32 1
store i32 %26, i32* %29
%30 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 3, i32 1
store i32 %26, i32* %30
%31 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 0
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%33 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 0, i32 2
%34 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 1, i32 2
%35 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 2, i32 2
%36 = getelementptr inbounds [5 x %struct.pollfd], [5 x %struct.pollfd]* %1, i64 0, i64 3, i32 2
br label %37
37: ; preds = %89, %0
%38 = call i32 @poll(%struct.pollfd* %31, i32 5, i32 100)
%39 = icmp slt i32 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %37
%41 = load i32, i32* %33
%42 = load i32, i32* @POLLIN
%43 = and i32 %42, %41
%44 = icmp eq i32 %43, 0
br i1 %44, label %56, label %47
45: ; preds = %37
%46 = call i32 @sleep(i32 1)
br label %89
47: ; preds = %40
%48 = call i32 @memset(i8* %4, i32 0, i32 1024)
%49 = load i32, i32* %9
%50 = call i32 @read(i32 %49, i8* %4, i32 1024)
%51 = call i8* @fileno(i32* %25)
%52 = call i32 @dup2(i8* %51, i32 1)
%53 = call i32 @puts(i8* %4)
%54 = call i32 @sleep(i32 1)
store i32 -1, i32* %9
%55 = load i32, i32* @POLLIN
br label %56
56: ; preds = %40, %47
%57 = phi i32 [ %42, %40 ], [ %55, %47 ]
%58 = load i32, i32* %34
%59 = and i32 %57, %58
%60 = icmp eq i32 %59, 0
br i1 %60, label %70, label %61
61: ; preds = %56
%62 = call i32 @memset(i8* %4, i32 0, i32 1024)
%63 = load i32, i32* %14
%64 = call i32 @read(i32 %63, i8* %4, i32 1024)
%65 = call i8* @fileno(i32* %25)
%66 = call i32 @dup2(i8* %65, i32 1)
%67 = call i32 @puts(i8* %4)
%68 = call i32 @sleep(i32 1)
store i32 -1, i32* %14
%69 = load i32, i32* @POLLIN
br label %70
70: ; preds = %61, %56
%71 = phi i32 [ %69, %61 ], [ %57, %56 ]
%72 = load i32, i32* %35
%73 = and i32 %71, %72
%74 = icmp eq i32 %73, 0
br i1 %74, label %84, label %75
75: ; preds = %70
%76 = call i32 @memset(i8* %4, i32 0, i32 1024)
%77 = load i32, i32* %19
%78 = call i32 @read(i32 %77, i8* %4, i32 1024)
%79 = call i8* @fileno(i32* %25)
%80 = call i32 @dup2(i8* %79, i32 1)
%81 = call i32 @puts(i8* %4)
%82 = call i32 @sleep(i32 1)
store i32 -1, i32* %19
%83 = load i32, i32* @POLLIN
br label %84
84: ; preds = %75, %70
%85 = phi i32 [ %83, %75 ], [ %71, %70 ]
%86 = load i32, i32* %36
%87 = and i32 %85, %86
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %84, %90, %45
br label %37
90: ; preds = %84
%91 = call i32 @memset(i8* %4, i32 0, i32 1024)
%92 = load i32, i32* %24
%93 = call i32 @read(i32 %92, i8* %4, i32 1024)
%94 = call i8* @fileno(i32* %25)
%95 = call i32 @dup2(i8* %94, i32 1)
%96 = call i32 @puts(i8* %4)
%97 = call i32 @sleep(i32 1)
store i32 -1, i32* %24
br label %89
}