#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 timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int sys_select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
               int /*<<< orphan*/ *, struct timeval *);
int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds,
                    fd_set *errorfds, struct timeval *tval) {
  int ret;
  fd_set *readfds2, readfds_buf, *writefds2, writefds_buf, *errorfds2,
      errorfds_buf;
  struct timeval tval2, *ptval, end_time, now_time;
  readfds2 = (readfds ? &readfds_buf : NULL);
  writefds2 = (writefds ? &writefds_buf : NULL);
  errorfds2 = (errorfds ? &errorfds_buf : NULL);
  if (tval) {
    gettimeofday(&end_time, NULL);
    end_time.tv_sec += tval->tv_sec;
    end_time.tv_usec += tval->tv_usec;
    end_time.tv_sec += end_time.tv_usec / 1000000;
    end_time.tv_usec %= 1000000;
    ptval = &tval2;
  } else {
    ptval = NULL;
  }
  do {
    if (readfds)
      readfds_buf = *readfds;
    if (writefds)
      writefds_buf = *writefds;
    if (errorfds)
      errorfds_buf = *errorfds;
    if (tval) {
      gettimeofday(&now_time, NULL);
      tval2.tv_sec = end_time.tv_sec - now_time.tv_sec;
      tval2.tv_usec = end_time.tv_usec - now_time.tv_usec;
      if ((signed long)tval2.tv_usec < 0) {
        tval2.tv_usec += 1000000;
        tval2.tv_sec--;
      }
      if ((signed long)tval2.tv_sec < 0) {
        ret = 0;
        break;
      }
    }
    ret = sys_select(maxfd, readfds2, writefds2, errorfds2, ptval);
  } while (ret == -1 && errno == EINTR);
  if (readfds)
    *readfds = readfds_buf;
  if (writefds)
    *writefds = writefds_buf;
  if (errorfds)
    *errorfds = errorfds_buf;
  return ret;
}


x86 assembly (clang, -O0):
<sys_select_intr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1159 <sys_select_intr+0x39>
lea    -0x3c(%rbp),%rax
mov    %rax,-0xa0(%rbp)
jmp    1167 <sys_select_intr+0x47>
xor    %eax,%eax
mov    %rax,-0xa0(%rbp)
jmp    1167 <sys_select_intr+0x47>
mov    -0xa0(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118d <sys_select_intr+0x6d>
lea    -0x4c(%rbp),%rax
mov    %rax,-0xa8(%rbp)
jmp    119b <sys_select_intr+0x7b>
xor    %eax,%eax
mov    %rax,-0xa8(%rbp)
jmp    119b <sys_select_intr+0x7b>
mov    -0xa8(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11c1 <sys_select_intr+0xa1>
lea    -0x5c(%rbp),%rax
mov    %rax,-0xb0(%rbp)
jmp    11cf <sys_select_intr+0xaf>
xor    %eax,%eax
mov    %rax,-0xb0(%rbp)
jmp    11cf <sys_select_intr+0xaf>
mov    -0xb0(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1250 <sys_select_intr+0x130>
lea    -0x88(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
add    -0x80(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
add    -0x88(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cltq
add    -0x80(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x88(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,-0x88(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
jmp    1258 <sys_select_intr+0x138>
movq   $0x0,-0x78(%rbp)
jmp    125d <sys_select_intr+0x13d>
cmpq   $0x0,-0x10(%rbp)
je     1271 <sys_select_intr+0x151>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1285 <sys_select_intr+0x165>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1299 <sys_select_intr+0x179>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1313 <sys_select_intr+0x1f3>
lea    -0x98(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x80(%rbp),%rax
sub    -0x90(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x88(%rbp),%eax
sub    -0x98(%rbp),%eax
mov    %eax,-0x70(%rbp)
movslq -0x70(%rbp),%rax
cmp    $0x0,%rax
jge    12f7 <sys_select_intr+0x1d7>
mov    -0x70(%rbp),%eax
add    $0xf4240,%eax
mov    %eax,-0x70(%rbp)
mov    -0x68(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jge    130e <sys_select_intr+0x1ee>
movl   $0x0,-0x2c(%rbp)
jmp    136b <sys_select_intr+0x24b>
jmp    1313 <sys_select_intr+0x1f3>
mov    -0x4(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x78(%rbp),%r8
call   1040 <sys_select@plt>
mov    %eax,-0x2c(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x2c(%rbp)
mov    %al,-0xb1(%rbp)
jne    135d <sys_select_intr+0x23d>
mov    0x2c99(%rip),%rax
mov    (%rax),%rax
mov    0x2c87(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0xb1(%rbp)
mov    -0xb1(%rbp),%al
test   $0x1,%al
jne    125d <sys_select_intr+0x13d>
cmpq   $0x0,-0x10(%rbp)
je     137f <sys_select_intr+0x25f>
mov    -0x3c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1393 <sys_select_intr+0x273>
mov    -0x4c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     13a7 <sys_select_intr+0x287>
mov    -0x5c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_select_intr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r8,%rbp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,0x14(%rsp)
test   %rsi,%rsi
lea    0x10(%rsp),%rax
cmove  %rsi,%rax
mov    %rax,0x50(%rsp)
test   %rdx,%rdx
lea    0xc(%rsp),%rax
cmove  %rdx,%rax
mov    %rax,0x48(%rsp)
test   %rcx,%rcx
lea    0x8(%rsp),%r12
cmove  %rcx,%r12
test   %r8,%r8
je     11ce <sys_select_intr+0xae>
lea    0x20(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x28(%rsp),%rdx
add    0x8(%rbp),%rdx
mov    0x20(%rsp),%eax
mov    %rbp,%r13
add    0x0(%rbp),%eax
movslq %eax,%rsi
imul   $0x431bde83,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
cltq
add    %rax,%rdx
mov    %rdx,0x40(%rsp)
mov    %rdx,0x28(%rsp)
imul   $0xf4240,%eax,%eax
sub    %eax,%esi
mov    %rsi,0x18(%rsp)
mov    %esi,0x20(%rsp)
lea    0x30(%rsp),%rbp
jmp    11e0 <sys_select_intr+0xc0>
mov    %rbp,%r13
xor    %ebp,%ebp
mov    %rax,0x18(%rsp)
nopl   0x0(%rax,%rax,1)
test   %rbx,%rbx
je     11eb <sys_select_intr+0xcb>
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
test   %r15,%r15
je     11f7 <sys_select_intr+0xd7>
mov    (%r15),%eax
mov    %eax,0xc(%rsp)
test   %r14,%r14
je     1203 <sys_select_intr+0xe3>
mov    (%r14),%eax
mov    %eax,0x8(%rsp)
test   %r13,%r13
je     124a <sys_select_intr+0x12a>
lea    0x58(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x40(%rsp),%rax
sub    0x60(%rsp),%rax
mov    %rax,0x38(%rsp)
mov    0x18(%rsp),%rcx
sub    0x58(%rsp),%ecx
mov    %ecx,0x30(%rsp)
jns    1245 <sys_select_intr+0x125>
add    $0xf4240,%ecx
mov    %ecx,0x30(%rsp)
add    $0xffffffffffffffff,%rax
mov    %rax,0x38(%rsp)
test   %rax,%rax
js     12b4 <sys_select_intr+0x194>
mov    0x14(%rsp),%edi
mov    0x50(%rsp),%rsi
mov    0x48(%rsp),%rdx
mov    %r12,%rcx
mov    %rbp,%r8
call   1040 <sys_select@plt>
cmp    $0xffffffff,%eax
jne    1282 <sys_select_intr+0x162>
mov    0x2d69(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2d67(%rip),%rdx
cmp    %rcx,(%rdx)
je     11e0 <sys_select_intr+0xc0>
test   %rbx,%rbx
je     128d <sys_select_intr+0x16d>
mov    0x10(%rsp),%ecx
mov    %ecx,(%rbx)
test   %r15,%r15
je     1299 <sys_select_intr+0x179>
mov    0xc(%rsp),%ecx
mov    %ecx,(%r15)
test   %r14,%r14
je     12a5 <sys_select_intr+0x185>
mov    0x8(%rsp),%ecx
mov    %ecx,(%r14)
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
test   %rbx,%rbx
jne    1287 <sys_select_intr+0x167>
jmp    128d <sys_select_intr+0x16d>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@errno = global i64 0
@EINTR = global i64 0
define i32 @sys_select_intr(i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca %struct.timeval*
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32
%18 = alloca %struct.timeval
%19 = alloca %struct.timeval*
%20 = alloca %struct.timeval
%21 = alloca %struct.timeval
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store %struct.timeval* %4, %struct.timeval** %10
%22 = load i32*, i32** %7
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %25
24: ; preds = %5
br label %26
25: ; preds = %5
br label %26
26: ; preds = %25, %24
%27 = phi i32* [ %13, %24 ], [ null, %25 ]
store i32* %27, i32** %12
%28 = load i32*, i32** %8
%29 = icmp ne i32* %28, null
br i1 %29, label %30, label %31
30: ; preds = %26
br label %32
31: ; preds = %26
br label %32
32: ; preds = %31, %30
%33 = phi i32* [ %15, %30 ], [ null, %31 ]
store i32* %33, i32** %14
%34 = load i32*, i32** %9
%35 = icmp ne i32* %34, null
br i1 %35, label %36, label %37
36: ; preds = %32
br label %38
37: ; preds = %32
br label %38
38: ; preds = %37, %36
%39 = phi i32* [ %17, %36 ], [ null, %37 ]
store i32* %39, i32** %16
%40 = load %struct.timeval*, %struct.timeval** %10
%41 = icmp ne %struct.timeval* %40, null
br i1 %41, label %42, label %66
42: ; preds = %38
%43 = call i32 @gettimeofday(%struct.timeval* %20, i32* null)
%44 = load %struct.timeval*, %struct.timeval** %10
%45 = getelementptr inbounds %struct.timeval, %struct.timeval* %44, i32 0, i32 1
%46 = load i64, i64* %45
%47 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 1
%48 = load i64, i64* %47
%49 = add nsw i64 %48, %46
store i64 %49, i64* %47
%50 = load %struct.timeval*, %struct.timeval** %10
%51 = getelementptr inbounds %struct.timeval, %struct.timeval* %50, i32 0, i32 0
%52 = load i32, i32* %51
%53 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 0
%54 = load i32, i32* %53
%55 = add nsw i32 %54, %52
store i32 %55, i32* %53
%56 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 0
%57 = load i32, i32* %56
%58 = sdiv i32 %57, 1000000
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 1
%61 = load i64, i64* %60
%62 = add nsw i64 %61, %59
store i64 %62, i64* %60
%63 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 0
%64 = load i32, i32* %63
%65 = srem i32 %64, 1000000
store i32 %65, i32* %63
store %struct.timeval* %18, %struct.timeval** %19
br label %67
66: ; preds = %38
store %struct.timeval* null, %struct.timeval** %19
br label %67
67: ; preds = %66, %42
br label %68
68: ; preds = %134, %67
%69 = load i32*, i32** %7
%70 = icmp ne i32* %69, null
br i1 %70, label %71, label %74
71: ; preds = %68
%72 = load i32*, i32** %7
%73 = load i32, i32* %72
store i32 %73, i32* %13
br label %74
74: ; preds = %71, %68
%75 = load i32*, i32** %8
%76 = icmp ne i32* %75, null
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = load i32*, i32** %8
%79 = load i32, i32* %78
store i32 %79, i32* %15
br label %80
80: ; preds = %77, %74
%81 = load i32*, i32** %9
%82 = icmp ne i32* %81, null
br i1 %82, label %83, label %86
83: ; preds = %80
%84 = load i32*, i32** %9
%85 = load i32, i32* %84
store i32 %85, i32* %17
br label %86
86: ; preds = %83, %80
%87 = load %struct.timeval*, %struct.timeval** %10
%88 = icmp ne %struct.timeval* %87, null
br i1 %88, label %89, label %120
89: ; preds = %86
%90 = call i32 @gettimeofday(%struct.timeval* %21, i32* null)
%91 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 1
%92 = load i64, i64* %91
%93 = getelementptr inbounds %struct.timeval, %struct.timeval* %21, i32 0, i32 1
%94 = load i64, i64* %93
%95 = sub nsw i64 %92, %94
%96 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 1
store i64 %95, i64* %96
%97 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 0
%98 = load i32, i32* %97
%99 = getelementptr inbounds %struct.timeval, %struct.timeval* %21, i32 0, i32 0
%100 = load i32, i32* %99
%101 = sub nsw i32 %98, %100
%102 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 0
store i32 %101, i32* %102
%103 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 0
%104 = load i32, i32* %103
%105 = sext i32 %104 to i64
%106 = icmp slt i64 %105, 0
br i1 %106, label %107, label %114
107: ; preds = %89
%108 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 0
%109 = load i32, i32* %108
%110 = add nsw i32 %109, 1000000
store i32 %110, i32* %108
%111 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 1
%112 = load i64, i64* %111
%113 = add nsw i64 %112, -1
store i64 %113, i64* %111
br label %114
114: ; preds = %107, %89
%115 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 1
%116 = load i64, i64* %115
%117 = icmp slt i64 %116, 0
br i1 %117, label %118, label %119
118: ; preds = %114
store i32 0, i32* %11
br label %136
119: ; preds = %114
br label %120
120: ; preds = %119, %86
%121 = load i32, i32* %6
%122 = load i32*, i32** %12
%123 = load i32*, i32** %14
%124 = load i32*, i32** %16
%125 = load %struct.timeval*, %struct.timeval** %19
%126 = call i32 @sys_select(i32 %121, i32* %122, i32* %123, i32* %124, %struct.timeval* %125)
store i32 %126, i32* %11
br label %127
127: ; preds = %120
%128 = load i32, i32* %11
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %134
130: ; preds = %127
%131 = load i64, i64* @errno
%132 = load i64, i64* @EINTR
%133 = icmp eq i64 %131, %132
br label %134
134: ; preds = %130, %127
%135 = phi i1 [ false, %127 ], [ %133, %130 ]
br i1 %135, label %68, label %136
136: ; preds = %134, %118
%137 = load i32*, i32** %7
%138 = icmp ne i32* %137, null
br i1 %138, label %139, label %142
139: ; preds = %136
%140 = load i32, i32* %13
%141 = load i32*, i32** %7
store i32 %140, i32* %141
br label %142
142: ; preds = %139, %136
%143 = load i32*, i32** %8
%144 = icmp ne i32* %143, null
br i1 %144, label %145, label %148
145: ; preds = %142
%146 = load i32, i32* %15
%147 = load i32*, i32** %8
store i32 %146, i32* %147
br label %148
148: ; preds = %145, %142
%149 = load i32*, i32** %9
%150 = icmp ne i32* %149, null
br i1 %150, label %151, label %154
151: ; preds = %148
%152 = load i32, i32* %17
%153 = load i32*, i32** %9
store i32 %152, i32* %153
br label %154
154: ; preds = %151, %148
%155 = load i32, i32* %11
ret i32 %155
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@errno = global i64 0
@EINTR = global i64 0
define i32 @sys_select_intr(i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.timeval
%10 = alloca %struct.timeval
%11 = alloca %struct.timeval
%12 = bitcast i32* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = bitcast %struct.timeval* %9 to i8*
%16 = bitcast %struct.timeval* %10 to i8*
%17 = bitcast %struct.timeval* %11 to i8*
%18 = icmp eq i32* %1, null
%19 = select i1 %18, i32* null, i32* %6
%20 = icmp eq i32* %2, null
%21 = select i1 %20, i32* null, i32* %7
%22 = icmp eq i32* %3, null
%23 = select i1 %22, i32* null, i32* %8
%24 = icmp eq %struct.timeval* %4, null
br i1 %24, label %41, label %25
25: ; preds = %5
%26 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%28 = load i64, i64* %27
%29 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 1
%30 = load i64, i64* %29
%31 = add nsw i64 %30, %28
%32 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 0
%35 = load i32, i32* %34
%36 = add nsw i32 %35, %33
%37 = sdiv i32 %36, 1000000
%38 = sext i32 %37 to i64
%39 = add nsw i64 %31, %38
store i64 %39, i64* %29
%40 = srem i32 %36, 1000000
store i32 %40, i32* %34
br label %41
41: ; preds = %5, %25
%42 = phi i32 [ %40, %25 ], [ undef, %5 ]
%43 = phi i64 [ %39, %25 ], [ undef, %5 ]
%44 = phi %struct.timeval* [ %9, %25 ], [ null, %5 ]
%45 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i64 0, i32 1
%46 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 1
%47 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i64 0, i32 0
%48 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 0
br label %49
49: ; preds = %72, %41
br i1 %18, label %52, label %50
50: ; preds = %49
%51 = load i32, i32* %1
store i32 %51, i32* %6
br label %52
52: ; preds = %50, %49
br i1 %20, label %55, label %53
53: ; preds = %52
%54 = load i32, i32* %2
store i32 %54, i32* %7
br label %55
55: ; preds = %53, %52
br i1 %22, label %58, label %56
56: ; preds = %55
%57 = load i32, i32* %3
store i32 %57, i32* %8
br label %58
58: ; preds = %56, %55
br i1 %24, label %72, label %59
59: ; preds = %58
%60 = call i32 @gettimeofday(%struct.timeval* %11, i32* null)
%61 = load i64, i64* %45
%62 = sub nsw i64 %43, %61
store i64 %62, i64* %46
%63 = load i32, i32* %47
%64 = sub nsw i32 %42, %63
store i32 %64, i32* %48
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %59
%67 = add nsw i32 %64, 1000000
store i32 %67, i32* %48
%68 = add nsw i64 %62, -1
store i64 %68, i64* %46
br label %69
69: ; preds = %59, %66
%70 = phi i64 [ %68, %66 ], [ %62, %59 ]
%71 = icmp slt i64 %70, 0
br i1 %71, label %79, label %72
72: ; preds = %69, %58
%73 = call i32 @sys_select(i32 %0, i32* %19, i32* %21, i32* %23, %struct.timeval* %44)
%74 = icmp eq i32 %73, -1
%75 = load i64, i64* @errno
%76 = load i64, i64* @EINTR
%77 = icmp eq i64 %75, %76
%78 = select i1 %74, i1 %77, i1 false
br i1 %78, label %49, label %79
79: ; preds = %69, %72
%80 = phi i32 [ %73, %72 ], [ 0, %69 ]
br i1 %18, label %83, label %81
81: ; preds = %79
%82 = load i32, i32* %6
store i32 %82, i32* %1
br label %83
83: ; preds = %81, %79
br i1 %20, label %86, label %84
84: ; preds = %83
%85 = load i32, i32* %7
store i32 %85, i32* %2
br label %86
86: ; preds = %84, %83
br i1 %22, label %89, label %87
87: ; preds = %86
%88 = load i32, i32* %8
store i32 %88, i32* %3
br label %89
89: ; preds = %87, %86
ret i32 %80
}