#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_sec;
  scalar_t__ tv_usec;
};
struct sockaddr_storage {
  int dummy;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  scalar_t__ ai_addr;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_flags;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ cli;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ FD_CLR(int /*<<< orphan*/, int /*<<< orphan*/ *);
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int NI_MAXHOST;
int NI_MAXSERV;
int /*<<< orphan*/ NI_NUMERICHOST;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ getaddrinfo(char *, char *, struct addrinfo *,
                               struct addrinfo **);
int /*<<< orphan*/ getnameinfo(struct sockaddr *, int, char *, int, char *, int,
                               int /*<<< orphan*/);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
void main(int args, char *argv[]) {
  struct addrinfo hints, *res;
  struct sockaddr_storage cli;
  char host[NI_MAXHOST], serv[NI_MAXSERV], buf[81];
  hints.ai_flags = AI_PASSIVE;
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = 0;
  struct timeval tv;
  tv.tv_sec = 10;
  tv.tv_usec = 0;
  fd_set rfds;
  getaddrinfo(argv[1], argv[2], &hints, &res);
  int sd = socket(res->ai_family, res->ai_socktype, 0);
  bind(sd, (struct sockaddr *)res->ai_addr, res->ai_addrlen);
  freeaddrinfo(res);
  listen(sd, 5);
  socklen_t clen = sizeof(cli);
  int cli_sd = accept(sd, (struct sockaddr *)&cli, &clen);
  FD_ZERO(&rfds);
  FD_SET(0, &rfds);
  FD_SET(cli_sd, &rfds);
  getnameinfo((struct sockaddr *)&cli, clen, host, NI_MAXHOST, serv, NI_MAXSERV,
              NI_NUMERICHOST);
  printf("%s %s\n", host, serv);
  int retval;
  while (1) {
    retval = select(cli_sd + 1, &rfds, NULL, NULL, &tv);
    if (FD_ISSET(0, &rfds)) {
      printf("standard\n");
      fflush(0);
      FD_CLR(0, &rfds);
    } else if (FD_ISSET(cli_sd, &rfds)) {
      int c = recv(cli_sd, buf, 80, 0);
      buf[c] = '\0';
      printf("client:\t%s\n", buf);
    } else if (&rfds == NULL) {
      printf("timeout expired\n");
    }
    FD_ZERO(&rfds);
    FD_SET(0, &rfds);
    FD_SET(cli_sd, &rfds);
    retval = 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2daf(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    0x2da0(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
mov    0x2d88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0xa,-0xd0(%rbp)
movq   $0x0,-0xc8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10e0 <getaddrinfo@plt>
mov    -0x40(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%edi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
call   10b0 <bind@plt>
mov    -0x40(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
mov    -0xd8(%rbp),%edi
mov    $0x5,%esi
call   10a0 <listen@plt>
movl   $0x4,-0xdc(%rbp)
mov    -0xd8(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0xdc(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0xe0(%rbp)
lea    -0xd4(%rbp),%rdi
call   1070 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0xd4(%rbp),%rsi
call   10f0 <FD_SET@plt>
mov    -0xe0(%rbp),%edi
lea    -0xd4(%rbp),%rsi
call   10f0 <FD_SET@plt>
mov    -0xf8(%rbp),%rdx
mov    -0xf0(%rbp),%r8
lea    -0x48(%rbp),%rdi
mov    -0xdc(%rbp),%esi
mov    0x2c43(%rip),%rax
mov    (%rax),%ecx
mov    0x2c5a(%rip),%rax
mov    (%rax),%r9d
mov    0x2c38(%rip),%rax
mov    (%rax),%eax
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1060 <getnameinfo@plt>
mov    -0xf8(%rbp),%rsi
mov    -0xf0(%rbp),%rdx
add    $0x10,%rsp
lea    0xc51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13bb <main+0x1cb>
mov    -0xe0(%rbp),%edi
add    $0x1,%edi
lea    -0xd4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0xd0(%rbp),%r8
mov    %rcx,%rdx
call   1080 <select@plt>
mov    %eax,-0xe4(%rbp)
xor    %edi,%edi
lea    -0xd4(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1424 <main+0x234>
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
xor    %edi,%edi
lea    -0xd4(%rbp),%rsi
call   10d0 <FD_CLR@plt>
jmp    1492 <main+0x2a2>
mov    -0xe0(%rbp),%edi
lea    -0xd4(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1488 <main+0x298>
mov    -0xe0(%rbp),%edi
lea    -0xc0(%rbp),%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0xe8(%rbp)
movslq -0xe8(%rbp),%rax
movb   $0x0,-0xc0(%rbp,%rax,1)
lea    -0xc0(%rbp),%rsi
lea    0xb95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    148d <main+0x29d>
jmp    148d <main+0x29d>
jmp    1492 <main+0x2a2>
lea    -0xd4(%rbp),%rdi
call   1070 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0xd4(%rbp),%rsi
call   10f0 <FD_SET@plt>
mov    -0xe0(%rbp),%edi
lea    -0xd4(%rbp),%rsi
call   10f0 <FD_SET@plt>
movl   $0x0,-0xe4(%rbp)
jmp    13b6 <main+0x1c6>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x2da3(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    0x2d99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2d85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
movq   $0x0,-0x68(%rbp)
movl   $0xa,-0x58(%rbp)
movq   $0x0,-0x50(%rbp)
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
lea    -0x80(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   10f0 <getaddrinfo@plt>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%esi
mov    0x14(%rax),%edi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,%ebx
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rsi
mov    (%rax),%edx
mov    %ebx,%edi
call   10c0 <bind@plt>
mov    -0x38(%rbp),%rdi
call   1110 <freeaddrinfo@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
movl   $0x4,-0x2c(%rbp)
lea    -0x40(%rbp),%r13
lea    -0x2c(%rbp),%rdx
mov    %ebx,%edi
mov    %r13,%rsi
call   10d0 <accept@plt>
mov    %eax,%r14d
lea    -0x44(%rbp),%rbx
mov    %rbx,%rdi
call   1080 <FD_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <FD_SET@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1100 <FD_SET@plt>
mov    -0x2c(%rbp),%esi
mov    0x2ca0(%rip),%rax
mov    (%rax),%ecx
mov    0x2cb7(%rip),%rax
mov    (%rax),%r9d
mov    0x2c95(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r15,%rdx
mov    %r12,%r8
push   %rax
call   1070 <getnameinfo@plt>
add    $0x10,%rsp
lea    0xcb5(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14d,%r15d
add    $0x1,%r15d
lea    -0x58(%rbp),%r12
lea    0xca9(%rip),%r13
mov    %r14d,-0x3c(%rbp)
jmp    13a6 <main+0x1a6>
mov    %r13,%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10e0 <FD_CLR@plt>
mov    %rbx,%rdi
call   1080 <FD_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <FD_SET@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1100 <FD_SET@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r12,%r8
call   1090 <select@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
jne    1370 <main+0x170>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1389 <main+0x189>
mov    %r14d,%edi
mov    %r15d,%r14d
mov    %r12,%r15
mov    %r13,%r12
lea    -0xe0(%rbp),%r13
mov    %r13,%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,-0xe0(%rbp,%rax,1)
lea    0xbfd(%rip),%rdi
mov    %r13,%rsi
mov    %r12,%r13
mov    %r15,%r12
mov    %r14d,%r15d
mov    -0x3c(%rbp),%r14d
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1389 <main+0x189>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i64, i32, i32, i64, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@NI_NUMERICHOST = global i32 0
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [10 x i8] c"standard\0A\00"
@.str.2 = [12 x i8] c"client:\09%s\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.addrinfo
%6 = alloca %struct.addrinfo*
%7 = alloca %struct.sockaddr_storage
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca [81 x i8]
%12 = alloca %struct.timeval
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%19 = load i32, i32* @NI_MAXHOST
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %8
%22 = alloca i8, i64 %20
store i64 %20, i64* %9
%23 = load i32, i32* @NI_MAXSERV
%24 = zext i32 %23 to i64
%25 = alloca i8, i64 %24
store i64 %24, i64* %10
%26 = load i32, i32* @AI_PASSIVE
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 5
store i32 %26, i32* %27
%28 = load i32, i32* @AF_UNSPEC
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 3
store i32 %28, i32* %29
%30 = load i32, i32* @SOCK_STREAM
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 2
store i32 %30, i32* %31
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 4
store i64 0, i64* %32
%33 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
store i32 10, i32* %33
%34 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
store i64 0, i64* %34
%35 = load i8**, i8*** %4
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = load i8**, i8*** %4
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32 @getaddrinfo(i8* %37, i8* %40, %struct.addrinfo* %5, %struct.addrinfo** %6)
%42 = load %struct.addrinfo*, %struct.addrinfo** %6
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i32 0, i32 3
%44 = load i32, i32* %43
%45 = load %struct.addrinfo*, %struct.addrinfo** %6
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i32 0, i32 2
%47 = load i32, i32* %46
%48 = call i32 @socket(i32 %44, i32 %47, i32 0)
store i32 %48, i32* %14
%49 = load i32, i32* %14
%50 = load %struct.addrinfo*, %struct.addrinfo** %6
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %50, i32 0, i32 1
%52 = load i64, i64* %51
%53 = inttoptr i64 %52 to %struct.sockaddr*
%54 = load %struct.addrinfo*, %struct.addrinfo** %6
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 0
%56 = load i32, i32* %55
%57 = call i32 @bind(i32 %49, %struct.sockaddr* %53, i32 %56)
%58 = load %struct.addrinfo*, %struct.addrinfo** %6
%59 = call i32 @freeaddrinfo(%struct.addrinfo* %58)
%60 = load i32, i32* %14
%61 = call i32 @listen(i32 %60, i32 5)
store i32 4, i32* %15
%62 = load i32, i32* %14
%63 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr*
%64 = call i32 @accept(i32 %62, %struct.sockaddr* %63, i32* %15)
store i32 %64, i32* %16
%65 = call i32 @FD_ZERO(i32* %13)
%66 = call i32 @FD_SET(i32 0, i32* %13)
%67 = load i32, i32* %16
%68 = call i32 @FD_SET(i32 %67, i32* %13)
%69 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr*
%70 = load i32, i32* %15
%71 = load i32, i32* @NI_MAXHOST
%72 = load i32, i32* @NI_MAXSERV
%73 = load i32, i32* @NI_NUMERICHOST
%74 = call i32 @getnameinfo(%struct.sockaddr* %69, i32 %70, i8* %22, i32 %71, i8* %25, i32 %72, i32 %73)
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %25)
br label %76
76: ; preds = %102, %2
br label %77
77: ; preds = %76
%78 = load i32, i32* %16
%79 = add nsw i32 %78, 1
%80 = call i32 @select(i32 %79, i32* %13, i32* null, i32* null, %struct.timeval* %12)
store i32 %80, i32* %17
%81 = call i64 @FD_ISSET(i32 0, i32* %13)
%82 = icmp ne i64 %81, 0
br i1 %82, label %83, label %87
83: ; preds = %77
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%85 = call i32 @fflush(i32 0)
%86 = call i32 @FD_CLR(i32 0, i32* %13)
br label %102
87: ; preds = %77
%88 = load i32, i32* %16
%89 = call i64 @FD_ISSET(i32 %88, i32* %13)
%90 = icmp ne i64 %89, 0
br i1 %90, label %91, label %100
91: ; preds = %87
%92 = load i32, i32* %16
%93 = getelementptr inbounds [81 x i8], [81 x i8]* %11, i64 0, i64 0
%94 = call i32 @recv(i32 %92, i8* %93, i32 80, i32 0)
store i32 %94, i32* %18
%95 = load i32, i32* %18
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [81 x i8], [81 x i8]* %11, i64 0, i64 %96
store i8 0, i8* %97
%98 = getelementptr inbounds [81 x i8], [81 x i8]* %11, i64 0, i64 0
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %98)
br label %101
100: ; preds = %87
br label %101
101: ; preds = %100, %91
br label %102
102: ; preds = %101, %83
%103 = call i32 @FD_ZERO(i32* %13)
%104 = call i32 @FD_SET(i32 0, i32* %13)
%105 = load i32, i32* %16
%106 = call i32 @FD_SET(i32 %105, i32* %13)
store i32 0, i32* %17
br label %76
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i64, i32, i32, i64, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@NI_NUMERICHOST = global i32 0
@.str = [7 x i8] c"%s %s\0A\00"
@.str.2 = [12 x i8] c"client:\09%s\0A\00"
@str = [9 x i8] c"standard\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.sockaddr_storage
%6 = alloca [81 x i8]
%7 = alloca %struct.timeval
%8 = alloca i32
%9 = alloca i32
%10 = bitcast %struct.addrinfo* %3 to i8*
%11 = bitcast %struct.addrinfo** %4 to i8*
%12 = bitcast %struct.sockaddr_storage* %5 to i8*
%13 = load i32, i32* @NI_MAXHOST
%14 = zext i32 %13 to i64
%15 = alloca i8, i64 %14
%16 = load i32, i32* @NI_MAXSERV
%17 = zext i32 %16 to i64
%18 = alloca i8, i64 %17
%19 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%20 = load i32, i32* @AI_PASSIVE
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %20, i32* %21
%22 = load i32, i32* @AF_UNSPEC
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %22, i32* %23
%24 = load i32, i32* @SOCK_STREAM
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i64 0, i64* %26
%27 = bitcast %struct.timeval* %7 to i8*
%28 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 0
store i32 10, i32* %28
%29 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 1
store i64 0, i64* %29
%30 = bitcast i32* %8 to i8*
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @getaddrinfo(i8* %32, i8* %34, %struct.addrinfo* %3, %struct.addrinfo** %4)
%36 = load %struct.addrinfo*, %struct.addrinfo** %4
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 3
%38 = load i32, i32* %37
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 2
%40 = load i32, i32* %39
%41 = call i32 @socket(i32 %38, i32 %40, i32 0)
%42 = load %struct.addrinfo*, %struct.addrinfo** %4
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 1
%44 = load i64, i64* %43
%45 = inttoptr i64 %44 to %struct.sockaddr*
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 0
%47 = load i32, i32* %46
%48 = call i32 @bind(i32 %41, %struct.sockaddr* %45, i32 %47)
%49 = load %struct.addrinfo*, %struct.addrinfo** %4
%50 = call i32 @freeaddrinfo(%struct.addrinfo* %49)
%51 = call i32 @listen(i32 %41, i32 5)
%52 = bitcast i32* %9 to i8*
store i32 4, i32* %9
%53 = bitcast %struct.sockaddr_storage* %5 to %struct.sockaddr*
%54 = call i32 @accept(i32 %41, %struct.sockaddr* %53, i32* %9)
%55 = call i32 @FD_ZERO(i32* %8)
%56 = call i32 @FD_SET(i32 0, i32* %8)
%57 = call i32 @FD_SET(i32 %54, i32* %8)
%58 = load i32, i32* %9
%59 = load i32, i32* @NI_MAXHOST
%60 = load i32, i32* @NI_MAXSERV
%61 = load i32, i32* @NI_NUMERICHOST
%62 = call i32 @getnameinfo(%struct.sockaddr* %53, i32 %58, i8* %15, i32 %59, i8* %18, i32 %60, i32 %61)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %18)
%64 = add nsw i32 %54, 1
br label %65
65: ; preds = %81, %2
%66 = call i32 @select(i32 %64, i32* %8, i32* null, i32* null, %struct.timeval* %7)
%67 = call i64 @FD_ISSET(i32 0, i32* %8)
%68 = icmp eq i64 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %65
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%71 = call i32 @fflush(i32 0)
%72 = call i32 @FD_CLR(i32 0, i32* %8)
br label %81
73: ; preds = %65
%74 = call i64 @FD_ISSET(i32 %54, i32* %8)
%75 = icmp eq i64 %74, 0
br i1 %75, label %81, label %76
76: ; preds = %73
%77 = call i32 @recv(i32 %54, i8* %19, i32 80, i32 0)
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 %78
store i8 0, i8* %79
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %81
81: ; preds = %76, %73, %69
%82 = call i32 @FD_ZERO(i32* %8)
%83 = call i32 @FD_SET(i32 0, i32* %8)
%84 = call i32 @FD_SET(i32 %54, i32* %8)
br label %65
}