#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 sockaddr_un {
  char *member_1;
  int /*<<< orphan*/ member_0;
};
struct sockaddr {
  int dummy;
};
struct pollfd {
  int fd;
  scalar_t__ revents;
  void *events;
};
typedef int /*<<< orphan*/ client_info;

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
void *POLLIN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SUN_LEN(struct sockaddr_un *);
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int poll(struct pollfd *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
int main() {
  unlink("/tmp/my_socket");
  int sock_fd = 0;
  sock_fd = socket(AF_UNIX, SOCK_STREAM, 0);
  struct sockaddr_un our_addr = {AF_UNIX, "/tmp/my_socket"};
  int ret = bind(sock_fd, (struct sockaddr *)&our_addr, SUN_LEN(&our_addr));
  if (ret < 0) {
    perror("bind");
  };
  ret = listen(sock_fd, 100500);
  struct sockaddr_un client_info;
  int client_info_len = sizeof(client_info);
  int client_fd =
      accept(sock_fd, (struct sockaddr *)&client_info, &client_info_len);
  if (client_fd < 0) {
    perror("accept");
    exit(1);
  }
  char message[10] = {0};
  int ready_descriptor, ready_count;
  struct pollfd poll_descriptors[2] = {0};
  poll_descriptors[0].fd = 0;
  poll_descriptors[0].events = POLLIN;
  poll_descriptors[1].fd = client_fd;
  poll_descriptors[1].events = POLLIN;
  while (1) {
    ready_count = poll(poll_descriptors, 2, 10000);
    if (ready_count < 0) {
      perror("poll");
      exit(1);
    }
    if (ready_count > 0) {
      if (poll_descriptors[0].revents > 0) {
        ret = read(poll_descriptors[0].fd, message, 10);
        if (ret < 0) {
          perror("read");
          exit(1);
        }
        printf("Read from stdin: %s\n", message);
      }
      if (poll_descriptors[1].revents > 0) {
        ret = read(poll_descriptors[1].fd, message, 10);
        if (ret < 0) {
          perror("read");
          exit(1);
        }
        printf("Read from socket: %s\n", message);
      }
    } else {
      printf("Timeout!\n");
      break;
    }
  }
  close(client_fd);
  close(sock_fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe17(%rip),%rdi
call   1030 <unlink@plt>
movl   $0x0,-0x8(%rbp)
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    0x2dcb(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    0x2dd0(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x18(%rbp)
lea    0xdda(%rip),%rax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8c(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x18(%rbp),%rdi
call   10e0 <SUN_LEN@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
call   10a0 <bind@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1273 <main+0xa3>
lea    0xda1(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x8(%rbp),%edi
mov    $0x18894,%esi
call   1080 <listen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x10,-0x34(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jge    12bd <main+0xed>
lea    0xd66(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x42(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
movl   $0x0,-0x80(%rbp)
mov    0x2cf5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    0x2ce1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x2,%esi
mov    $0x2710,%edx
call   1090 <poll@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jge    133c <main+0x16c>
lea    0xcee(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x0,-0x4c(%rbp)
jle    13ed <main+0x21d>
cmpq   $0x0,-0x78(%rbp)
jle    1397 <main+0x1c7>
mov    -0x80(%rbp),%edi
lea    -0x42(%rbp),%rsi
mov    $0xa,%edx
call   1070 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1385 <main+0x1b5>
lea    0xcaa(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x42(%rbp),%rsi
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x60(%rbp)
jle    13e8 <main+0x218>
mov    -0x68(%rbp),%edi
lea    -0x42(%rbp),%rsi
mov    $0xa,%edx
call   1070 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    13d6 <main+0x206>
lea    0xc59(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x42(%rbp),%rsi
lea    0xc59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1400 <main+0x230>
lea    0xc5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1405 <main+0x235>
jmp    1306 <main+0x136>
mov    -0x38(%rbp),%edi
call   1060 <close@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xe1b(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    0x2df4(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2dd2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,%r14d
movslq 0x0(%rbp),%rax
mov    %rax,0x58(%rsp)
mov    %ebx,0x60(%rsp)
lea    0x58(%rsp),%rbx
mov    %rbx,%rdi
call   10e0 <SUN_LEN@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   10a0 <bind@plt>
test   %eax,%eax
js     1381 <main+0x1b1>
mov    %r14d,%edi
mov    $0x18894,%esi
call   1080 <listen@plt>
movl   $0x10,0xc(%rsp)
lea    0x68(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r14d,%edi
call   10c0 <accept@plt>
test   %eax,%eax
js     13b1 <main+0x1e1>
mov    %eax,%r15d
movw   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x20(%rsp)
mov    0x2d4c(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
mov    %r15d,0x38(%rsp)
mov    %rax,0x48(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x2,%esi
mov    $0x2710,%edx
call   1090 <poll@plt>
test   %eax,%eax
js     139b <main+0x1cb>
lea    0x10(%rsp),%rbx
lea    0xd57(%rip),%r12
lea    0xd65(%rip),%r13
lea    0x20(%rsp),%rbp
jmp    12fa <main+0x12a>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    $0x2,%esi
mov    $0x2710,%edx
call   1090 <poll@plt>
test   %eax,%eax
js     139b <main+0x1cb>
test   %eax,%eax
je     1354 <main+0x184>
cmpq   $0x0,0x28(%rsp)
jle    1328 <main+0x158>
mov    0x20(%rsp),%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1070 <read@plt>
test   %eax,%eax
js     1392 <main+0x1c2>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmpq   $0x0,0x40(%rsp)
jle    12e0 <main+0x110>
mov    0x38(%rsp),%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1070 <read@plt>
test   %eax,%eax
js     1392 <main+0x1c2>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12e0 <main+0x110>
lea    0xcf5(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%edi
call   1060 <close@plt>
mov    %r14d,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc87(%rip),%rdi
call   10b0 <perror@plt>
jmp    1239 <main+0x69>
lea    0xc87(%rip),%rdi
jmp    13a2 <main+0x1d2>
lea    0xc79(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xc5c(%rip),%rdi
jmp    13a2 <main+0x1d2>

LLVM IR (-O0):
%struct.sockaddr_un = type { i8*, i32 }
%struct.pollfd = type { i32, i64, i8* }
%struct.sockaddr = type { i32 }
@.str = [15 x i8] c"/tmp/my_socket\00"
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"accept\00"
@POLLIN = global i8* null
@.str.3 = [5 x i8] c"poll\00"
@.str.4 = [5 x i8] c"read\00"
@.str.5 = [21 x i8] c"Read from stdin: %s\0A\00"
@.str.6 = [22 x i8] c"Read from socket: %s\0A\00"
@.str.7 = [10 x i8] c"Timeout!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_un
%4 = alloca i32
%5 = alloca %struct.sockaddr_un
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca [2 x %struct.pollfd]
store i32 0, i32* %1
%12 = call i32 @unlink(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
%13 = load i32, i32* @AF_UNIX
%14 = load i32, i32* @SOCK_STREAM
%15 = call i32 @socket(i32 %13, i32 %14, i32 0)
store i32 %15, i32* %2
%16 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i32 0, i32 0
%17 = load i32, i32* @AF_UNIX
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %16
%20 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i32 0, i32 1
store i32 ptrtoint ([15 x i8]* @.str to i32), i32* %20
%21 = load i32, i32* %2
%22 = bitcast %struct.sockaddr_un* %3 to %struct.sockaddr*
%23 = call i32 @SUN_LEN(%struct.sockaddr_un* %3)
%24 = call i32 @bind(i32 %21, %struct.sockaddr* %22, i32 %23)
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %0
%30 = load i32, i32* %2
%31 = call i32 @listen(i32 %30, i32 100500)
store i32 %31, i32* %4
store i32 16, i32* %6
%32 = load i32, i32* %2
%33 = bitcast %struct.sockaddr_un* %5 to %struct.sockaddr*
%34 = call i32 @accept(i32 %32, %struct.sockaddr* %33, i32* %6)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %29
%38 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %29
%41 = bitcast [10 x i8]* %8 to i8*
%42 = bitcast [2 x %struct.pollfd]* %11 to i8*
%43 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 0
%44 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %43, i32 0, i32 0
store i32 0, i32* %44
%45 = load i8*, i8** @POLLIN
%46 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 0
%47 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %46, i32 0, i32 2
store i8* %45, i8** %47
%48 = load i32, i32* %7
%49 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 1
%50 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %49, i32 0, i32 0
store i32 %48, i32* %50
%51 = load i8*, i8** @POLLIN
%52 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 1
%53 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %52, i32 0, i32 2
store i8* %51, i8** %53
br label %54
54: ; preds = %40, %106
%55 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 0
%56 = call i32 @poll(%struct.pollfd* %55, i32 2, i32 10000)
store i32 %56, i32* %10
%57 = load i32, i32* %10
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %54
%63 = load i32, i32* %10
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %104
65: ; preds = %62
%66 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 0
%67 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %66, i32 0, i32 1
%68 = load i64, i64* %67
%69 = icmp sgt i64 %68, 0
br i1 %69, label %70, label %84
70: ; preds = %65
%71 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 0
%72 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %71, i32 0, i32 0
%73 = load i32, i32* %72
%74 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%75 = call i32 @read(i32 %73, i8* %74, i32 10)
store i32 %75, i32* %4
%76 = load i32, i32* %4
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %70
%79 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %70
%82 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %82)
br label %84
84: ; preds = %81, %65
%85 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 1
%86 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %85, i32 0, i32 1
%87 = load i64, i64* %86
%88 = icmp sgt i64 %87, 0
br i1 %88, label %89, label %103
89: ; preds = %84
%90 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %11, i64 0, i64 1
%91 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %90, i32 0, i32 0
%92 = load i32, i32* %91
%93 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%94 = call i32 @read(i32 %92, i8* %93, i32 10)
store i32 %94, i32* %4
%95 = load i32, i32* %4
%96 = icmp slt i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %89
%98 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %89
%101 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %101)
br label %103
103: ; preds = %100, %84
br label %106
104: ; preds = %62
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %107
106: ; preds = %103
br label %54
107: ; preds = %104
%108 = load i32, i32* %7
%109 = call i32 @close(i32 %108)
%110 = load i32, i32* %2
%111 = call i32 @close(i32 %110)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i8*, i32 }
%struct.pollfd = type { i32, i64, i8* }
%struct.sockaddr = type { i32 }
@.str = [15 x i8] c"/tmp/my_socket\00"
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"accept\00"
@POLLIN = global i8* null
@.str.3 = [5 x i8] c"poll\00"
@.str.4 = [5 x i8] c"read\00"
@.str.5 = [21 x i8] c"Read from stdin: %s\0A\00"
@.str.6 = [22 x i8] c"Read from socket: %s\0A\00"
@str = [9 x i8] c"Timeout!\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_un
%2 = alloca %struct.sockaddr_un
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca [2 x %struct.pollfd]
%6 = tail call i32 @unlink(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @AF_UNIX
%8 = load i32, i32* @SOCK_STREAM
%9 = tail call i32 @socket(i32 %7, i32 %8, i32 0)
%10 = bitcast %struct.sockaddr_un* %1 to i8*
%11 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %1, i64 0, i32 0
%12 = load i32, i32* @AF_UNIX
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %11
%15 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %1, i64 0, i32 1
store i32 ptrtoint ([15 x i8]* @.str to i32), i32* %15
%16 = bitcast %struct.sockaddr_un* %1 to %struct.sockaddr*
%17 = call i32 @SUN_LEN(%struct.sockaddr_un* %1)
%18 = call i32 @bind(i32 %9, %struct.sockaddr* %16, i32 %17)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %0
%23 = call i32 @listen(i32 %9, i32 100500)
%24 = bitcast %struct.sockaddr_un* %2 to i8*
%25 = bitcast i32* %3 to i8*
store i32 16, i32* %3
%26 = bitcast %struct.sockaddr_un* %2 to %struct.sockaddr*
%27 = call i32 @accept(i32 %9, %struct.sockaddr* %26, i32* %3)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %22
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%34 = bitcast [2 x %struct.pollfd]* %5 to i8*
%35 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0
%36 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0, i32 0
%37 = bitcast [2 x %struct.pollfd]* %5 to i8*
%38 = load i8*, i8** @POLLIN
%39 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0, i32 2
store i8* %38, i8** %39
%40 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 1, i32 0
store i32 %27, i32* %40
%41 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 1, i32 2
store i8* %38, i8** %41
%42 = call i32 @poll(%struct.pollfd* %35, i32 2, i32 10000)
%43 = icmp slt i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %32
%45 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0, i32 1
%46 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 1, i32 1
br label %50
47: ; preds = %81, %32
%48 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %44, %81
%51 = phi i32 [ %42, %44 ], [ %82, %81 ]
%52 = icmp eq i32 %51, 0
br i1 %52, label %77, label %53
53: ; preds = %50
%54 = load i64, i64* %45
%55 = icmp sgt i64 %54, 0
br i1 %55, label %56, label %65
56: ; preds = %53
%57 = load i32, i32* %36
%58 = call i32 @read(i32 %57, i8* %33, i32 10)
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %56
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %33)
br label %65
65: ; preds = %63, %53
%66 = load i64, i64* %46
%67 = icmp sgt i64 %66, 0
br i1 %67, label %68, label %81
68: ; preds = %65
%69 = load i32, i32* %40
%70 = call i32 @read(i32 %69, i8* %33, i32 10)
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %68
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %33)
br label %81
77: ; preds = %50
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%79 = call i32 @close(i32 %27)
%80 = call i32 @close(i32 %9)
ret i32 0
81: ; preds = %65, %75
%82 = call i32 @poll(%struct.pollfd* %35, i32 2, i32 10000)
%83 = icmp slt i32 %82, 0
br i1 %83, label %47, label %50
}