#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 dummy;
};
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ rfds;
typedef int /*<<< orphan*/ fsin;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ FD_CLR(int, int /*<<< orphan*/ *);
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int accept(int, struct sockaddr *, unsigned int *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errexit(char *, ...);
int /*<<< orphan*/ errno;
int getdtablesize();
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int passiveTCP(char *, int);
int passiveUDP(char *);
int recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *,
                    unsigned int *);
int select(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  char *service = "echo";
  char buf[128];
  struct sockaddr_in fsin;
  unsigned int alen;
  int tsock;
  int auxsock, n;
  int usock;
  int nfds, nrec;
  fd_set rfds;
  fd_set afds;
  int ssock;
  switch (argc) {
  case 1:
    break;
  case 2:
    service = argv[1];
    break;
  default:
    errexit("usage: daytimed [port]\n");
  }
  tsock = passiveTCP(service, 32);
  usock = passiveUDP(service);
  nfds = getdtablesize();
  FD_ZERO(&afds);
  FD_SET(tsock, &afds);
  FD_SET(usock, &afds);
  while (1) {
    memcpy(&rfds, &afds, sizeof(rfds));
    if (select(FD_SETSIZE, &rfds, (fd_set *)0, (fd_set *)0,
               (struct timeval *)0) == -1)
      errexit("select error: %s\n", strerror(errno));
    if (FD_ISSET(tsock, &rfds)) {
      alen = sizeof(fsin);
      ssock = accept(tsock, (struct sockaddr *)&fsin, &alen);
      if (ssock != -1)
        FD_SET(ssock, &afds);
    }
    if (FD_ISSET(usock, &rfds)) {
      alen = sizeof(fsin);
      if (nrec = recvfrom(usock, buf, sizeof(buf), 0, (struct sockaddr *)&fsin,
                          &alen) < 0)
        errexit("recvfrom: %s\n", strerror(errno));
      (void)sendto(usock, buf, nrec, 0, (struct sockaddr *)&fsin, sizeof(fsin));
    }
    for (auxsock = 0; auxsock < nfds; ++auxsock) {
      if ((auxsock != tsock) && (FD_ISSET(auxsock, &rfds)) &&
          (auxsock != usock)) {
        n = recv(auxsock, buf, sizeof(buf), 0);
        if (n > 0)
          send(auxsock, buf, n, 0);
        if (n == 0) {
          close(auxsock);
          FD_CLR(auxsock, &afds);
        }
      }
    }
  }
  (void)close(tsock);
  (void)close(usock);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xdd0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xd4(%rbp)
sub    $0x1,%eax
je     125f <main+0x4f>
jmp    124b <main+0x3b>
mov    -0xd4(%rbp),%eax
sub    $0x2,%eax
je     1264 <main+0x54>
jmp    1275 <main+0x65>
jmp    1283 <main+0x73>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1283 <main+0x73>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1080 <errexit@plt>
mov    -0x18(%rbp),%rdi
mov    $0x20,%esi
call   1100 <passiveTCP@plt>
mov    %eax,-0xb0(%rbp)
mov    -0x18(%rbp),%rdi
call   10d0 <passiveUDP@plt>
mov    %eax,-0xbc(%rbp)
mov    $0x0,%al
call   1130 <getdtablesize@plt>
mov    %eax,-0xc0(%rbp)
lea    -0xcc(%rbp),%rdi
call   10a0 <FD_ZERO@plt>
mov    -0xb0(%rbp),%edi
lea    -0xcc(%rbp),%rsi
call   1120 <FD_SET@plt>
mov    -0xbc(%rbp),%edi
lea    -0xcc(%rbp),%rsi
call   1120 <FD_SET@plt>
lea    -0xc8(%rbp),%rdi
lea    -0xcc(%rbp),%rsi
mov    $0x4,%edx
call   1090 <memcpy@plt>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
lea    -0xc8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   10b0 <select@plt>
cmp    $0xffffffff,%eax
jne    1342 <main+0x132>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %eax,%esi
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1080 <errexit@plt>
mov    -0xb0(%rbp),%edi
lea    -0xc8(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     13ab <main+0x19b>
movl   $0x4,-0xac(%rbp)
mov    -0xb0(%rbp),%edi
lea    -0xa8(%rbp),%rsi
lea    -0xac(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0xd0(%rbp)
cmpl   $0xffffffff,-0xd0(%rbp)
je     13a6 <main+0x196>
mov    -0xd0(%rbp),%edi
lea    -0xcc(%rbp),%rsi
call   1120 <FD_SET@plt>
jmp    13ab <main+0x19b>
mov    -0xbc(%rbp),%edi
lea    -0xc8(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     145f <main+0x24f>
movl   $0x4,-0xac(%rbp)
mov    -0xbc(%rbp),%edi
lea    -0xa0(%rbp),%rsi
lea    -0xa8(%rbp),%r8
mov    $0x80,%edx
xor    %ecx,%ecx
lea    -0xac(%rbp),%r9
call   10c0 <recvfrom@plt>
cmp    $0x0,%rax
setl   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0xc4(%rbp)
test   $0x1,%al
jne    141a <main+0x20a>
jmp    1438 <main+0x228>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %eax,%esi
lea    0xbfe(%rip),%rdi
mov    $0x0,%al
call   1080 <errexit@plt>
mov    -0xbc(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0xc4(%rbp),%edx
lea    -0xa8(%rbp),%r8
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1060 <sendto@plt>
movl   $0x0,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0xc0(%rbp),%eax
jge    1549 <main+0x339>
mov    -0xb4(%rbp),%eax
cmp    -0xb0(%rbp),%eax
je     1530 <main+0x320>
mov    -0xb4(%rbp),%edi
lea    -0xc8(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1530 <main+0x320>
mov    -0xb4(%rbp),%eax
cmp    -0xbc(%rbp),%eax
je     1530 <main+0x320>
mov    -0xb4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x0,-0xb8(%rbp)
jle    1501 <main+0x2f1>
mov    -0xb4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0xb8(%rbp),%edx
xor    %ecx,%ecx
call   1050 <send@plt>
cmpl   $0x0,-0xb8(%rbp)
jne    152b <main+0x31b>
mov    -0xb4(%rbp),%edi
call   1070 <close@plt>
mov    -0xb4(%rbp),%edi
lea    -0xcc(%rbp),%rsi
call   10f0 <FD_CLR@plt>
jmp    1530 <main+0x320>
jmp    1535 <main+0x325>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1469 <main+0x259>
jmp    12e3 <main+0xd3>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xdd8(%rip),%rbp
cmp    $0x1,%edi
je     1246 <main+0x36>
cmp    $0x2,%edi
jne    1238 <main+0x28>
mov    0x8(%rsi),%rbp
jmp    1246 <main+0x36>
lea    0xdc6(%rip),%rdi
xor    %eax,%eax
call   1080 <errexit@plt>
mov    %rbp,%rdi
mov    $0x20,%esi
call   1100 <passiveTCP@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   10d0 <passiveUDP@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1130 <getdtablesize@plt>
mov    %eax,%ebp
mov    %rsp,%r15
mov    %r15,%rdi
call   10a0 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1120 <FD_SET@plt>
mov    %r14d,%edi
mov    %r15,%rsi
call   1120 <FD_SET@plt>
lea    0xc(%rsp),%r12
lea    0x10(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1090 <memcpy@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
mov    %r12,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10b0 <select@plt>
cmp    $0xffffffff,%eax
jne    12eb <main+0xdb>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xd3b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <errexit@plt>
mov    %ebx,%edi
mov    %r12,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
lea    0x8(%rsp),%r15
je     1325 <main+0x115>
movl   $0x4,0x4(%rsp)
mov    %ebx,%edi
mov    %r15,%rsi
lea    0x4(%rsp),%rdx
call   10e0 <accept@plt>
cmp    $0xffffffff,%eax
je     1325 <main+0x115>
mov    %eax,%edi
mov    %rsp,%rsi
call   1120 <FD_SET@plt>
mov    %r14d,%edi
mov    %r12,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     139f <main+0x18f>
movl   $0x4,0x4(%rsp)
mov    %r14d,%edi
mov    %r13,%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
mov    %r15,%r8
lea    0x4(%rsp),%r9
call   10c0 <recvfrom@plt>
mov    %r15,%r8
mov    %rax,%r15
shr    $0x3f,%r15
test   %rax,%rax
jns    1389 <main+0x179>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xcb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <errexit@plt>
lea    0x8(%rsp),%r8
mov    %r14d,%edi
mov    %r13,%rsi
mov    %r15d,%edx
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1060 <sendto@plt>
test   %ebp,%ebp
jle    12a0 <main+0x90>
xor    %r15d,%r15d
jmp    13cd <main+0x1bd>
mov    %r15d,%edi
mov    %r13,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    %r15d,%ebp
je     12a0 <main+0x90>
cmp    %r15d,%ebx
je     13c0 <main+0x1b0>
mov    %r15d,%edi
mov    %r12,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     13c0 <main+0x1b0>
cmp    %r15d,%r14d
je     13c0 <main+0x1b0>
mov    %r15d,%edi
mov    %r13,%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jg     13ac <main+0x19c>
jne    13c0 <main+0x1b0>
mov    %r15d,%edi
call   1070 <close@plt>
mov    %r15d,%edi
mov    %rsp,%rsi
call   10f0 <FD_CLR@plt>
jmp    13c0 <main+0x1b0>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.timeval = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [5 x i8] c"echo\00"
@.str.1 = [24 x i8] c"usage: daytimed [port]\0A\00"
@FD_SETSIZE = global i32 0
@.str.2 = [18 x i8] c"select error: %s\0A\00"
@errno = global i32 0
@.str.3 = [14 x i8] c"recvfrom: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [128 x i8]
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
%19 = load i32, i32* %4
switch i32 %19, label %25 [
i32 1, label %20
i32 2, label %21
]
20: ; preds = %2
br label %27
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %6
br label %27
25: ; preds = %2
%26 = call i32 (i8*, ...) @errexit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %21, %20
%28 = load i8*, i8** %6
%29 = call i32 @passiveTCP(i8* %28, i32 32)
store i32 %29, i32* %10
%30 = load i8*, i8** %6
%31 = call i32 @passiveUDP(i8* %30)
store i32 %31, i32* %13
%32 = call i32 (...) @getdtablesize()
store i32 %32, i32* %14
%33 = call i32 @FD_ZERO(i32* %17)
%34 = load i32, i32* %10
%35 = call i32 @FD_SET(i32 %34, i32* %17)
%36 = load i32, i32* %13
%37 = call i32 @FD_SET(i32 %36, i32* %17)
br label %38
38: ; preds = %27, %123
%39 = call i32 @memcpy(i32* %16, i32* %17, i32 4)
%40 = load i32, i32* @FD_SETSIZE
%41 = call i32 @select(i32 %40, i32* %16, i32* null, i32* null, %struct.timeval* null)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %47
43: ; preds = %38
%44 = load i32, i32* @errno
%45 = call i32 @strerror(i32 %44)
%46 = call i32 (i8*, ...) @errexit(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %43, %38
%48 = load i32, i32* %10
%49 = call i64 @FD_ISSET(i32 %48, i32* %16)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %61
51: ; preds = %47
store i32 4, i32* %9
%52 = load i32, i32* %10
%53 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%54 = call i32 @accept(i32 %52, %struct.sockaddr* %53, i32* %9)
store i32 %54, i32* %18
%55 = load i32, i32* %18
%56 = icmp ne i32 %55, -1
br i1 %56, label %57, label %60
57: ; preds = %51
%58 = load i32, i32* %18
%59 = call i32 @FD_SET(i32 %58, i32* %17)
br label %60
60: ; preds = %57, %51
br label %61
61: ; preds = %60, %47
%62 = load i32, i32* %13
%63 = call i64 @FD_ISSET(i32 %62, i32* %16)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %82
65: ; preds = %61
store i32 4, i32* %9
%66 = load i32, i32* %13
%67 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%68 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%69 = call i64 @recvfrom(i32 %66, i8* %67, i32 128, i32 0, %struct.sockaddr* %68, i32* %9)
%70 = icmp slt i64 %69, 0
%71 = zext i1 %70 to i32
store i32 %71, i32* %15
br i1 %70, label %72, label %76
72: ; preds = %65
%73 = load i32, i32* @errno
%74 = call i32 @strerror(i32 %73)
%75 = call i32 (i8*, ...) @errexit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %72, %65
%77 = load i32, i32* %13
%78 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%79 = load i32, i32* %15
%80 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%81 = call i32 @sendto(i32 %77, i8* %78, i32 %79, i32 0, %struct.sockaddr* %80, i32 4)
br label %82
82: ; preds = %76, %61
store i32 0, i32* %11
br label %83
83: ; preds = %120, %82
%84 = load i32, i32* %11
%85 = load i32, i32* %14
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %123
87: ; preds = %83
%88 = load i32, i32* %11
%89 = load i32, i32* %10
%90 = icmp ne i32 %88, %89
br i1 %90, label %91, label %119
91: ; preds = %87
%92 = load i32, i32* %11
%93 = call i64 @FD_ISSET(i32 %92, i32* %16)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %119
95: ; preds = %91
%96 = load i32, i32* %11
%97 = load i32, i32* %13
%98 = icmp ne i32 %96, %97
br i1 %98, label %99, label %119
99: ; preds = %95
%100 = load i32, i32* %11
%101 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%102 = call i32 @recv(i32 %100, i8* %101, i32 128, i32 0)
store i32 %102, i32* %12
%103 = load i32, i32* %12
%104 = icmp sgt i32 %103, 0
br i1 %104, label %105, label %110
105: ; preds = %99
%106 = load i32, i32* %11
%107 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%108 = load i32, i32* %12
%109 = call i32 @send(i32 %106, i8* %107, i32 %108, i32 0)
br label %110
110: ; preds = %105, %99
%111 = load i32, i32* %12
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %118
113: ; preds = %110
%114 = load i32, i32* %11
%115 = call i32 @close(i32 %114)
%116 = load i32, i32* %11
%117 = call i32 @FD_CLR(i32 %116, i32* %17)
br label %118
118: ; preds = %113, %110
br label %119
119: ; preds = %118, %95, %91, %87
br label %120
120: ; preds = %119
%121 = load i32, i32* %11
%122 = add nsw i32 %121, 1
store i32 %122, i32* %11
br label %83
123: ; preds = %83
br label %38
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
%struct.timeval = type { i32 }
@.str = [5 x i8] c"echo\00"
@.str.1 = [24 x i8] c"usage: daytimed [port]\0A\00"
@FD_SETSIZE = global i32 0
@.str.2 = [18 x i8] c"select error: %s\0A\00"
@errno = global i32 0
@.str.3 = [14 x i8] c"recvfrom: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%9 = bitcast %struct.sockaddr_in* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
switch i32 %0, label %16 [
i32 1, label %18
i32 2, label %13
]
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
br label %18
16: ; preds = %2
%17 = tail call i32 (i8*, ...) @errexit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %13, %2
%19 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %16 ], [ %15, %13 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %2 ]
%20 = tail call i32 @passiveTCP(i8* %19, i32 32)
%21 = tail call i32 @passiveUDP(i8* %19)
%22 = tail call i32 (...) @getdtablesize()
%23 = call i32 @FD_ZERO(i32* %7)
%24 = call i32 @FD_SET(i32 %20, i32* %7)
%25 = call i32 @FD_SET(i32 %21, i32* %7)
%26 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%27 = icmp sgt i32 %22, 0
br label %28
28: ; preds = %60, %18
%29 = call i32 @memcpy(i32* %6, i32* %7, i32 4)
%30 = load i32, i32* @FD_SETSIZE
%31 = call i32 @select(i32 %30, i32* %6, i32* null, i32* null, %struct.timeval* null)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i32, i32* @errno
%35 = call i32 @strerror(i32 %34)
%36 = call i32 (i8*, ...) @errexit(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %33, %28
%38 = call i64 @FD_ISSET(i32 %20, i32* %6)
%39 = icmp eq i64 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %37
store i32 4, i32* %5
%41 = call i32 @accept(i32 %20, %struct.sockaddr* %26, i32* %5)
%42 = icmp eq i32 %41, -1
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 @FD_SET(i32 %41, i32* %7)
br label %45
45: ; preds = %40, %43, %37
%46 = call i64 @FD_ISSET(i32 %21, i32* %6)
%47 = icmp eq i64 %46, 0
br i1 %47, label %59, label %48
48: ; preds = %45
store i32 4, i32* %5
%49 = call i64 @recvfrom(i32 %21, i8* %8, i32 128, i32 0, %struct.sockaddr* %26, i32* %5)
%50 = icmp slt i64 %49, 0
%51 = lshr i64 %49, 63
%52 = trunc i64 %51 to i32
br i1 %50, label %53, label %57
53: ; preds = %48
%54 = load i32, i32* @errno
%55 = call i32 @strerror(i32 %54)
%56 = call i32 (i8*, ...) @errexit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %53, %48
%58 = call i32 @sendto(i32 %21, i8* %8, i32 %52, i32 0, %struct.sockaddr* %26, i32 4)
br label %59
59: ; preds = %57, %45
br i1 %27, label %61, label %60
60: ; preds = %79, %59
br label %28
61: ; preds = %59, %79
%62 = phi i32 [ %80, %79 ], [ 0, %59 ]
%63 = icmp eq i32 %62, %20
br i1 %63, label %79, label %64
64: ; preds = %61
%65 = call i64 @FD_ISSET(i32 %62, i32* %6)
%66 = icmp eq i64 %65, 0
%67 = icmp eq i32 %62, %21
%68 = select i1 %66, i1 true, i1 %67
br i1 %68, label %79, label %69
69: ; preds = %64
%70 = call i32 @recv(i32 %62, i8* %8, i32 128, i32 0)
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = call i32 @send(i32 %62, i8* %8, i32 %70, i32 0)
br label %79
74: ; preds = %69
%75 = icmp eq i32 %70, 0
br i1 %75, label %76, label %79
76: ; preds = %74
%77 = call i32 @close(i32 %62)
%78 = call i32 @FD_CLR(i32 %62, i32* %7)
br label %79
79: ; preds = %72, %61, %64, %76, %74
%80 = add nuw nsw i32 %62, 1
%81 = icmp eq i32 %80, %22
br i1 %81, label %60, label %61
}