#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 */
typedef int /*<<< orphan*/ time_t;
typedef int /*<<< orphan*/ time_buf;
struct sockaddr_storage {
  int dummy;
};
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int sa_family;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ ip;
typedef int /*<<< orphan*/ cliaddr;

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
scalar_t__ EINTR;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ close(int);
char *ctime(int /*<<< orphan*/ *);
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *inet_ntop(int const, int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ strlen(char *);
int tcp_listen(char *, char *, int *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int listenfd, connfd, n;
  socklen_t len, addrlen;
  char ip[256] = {'\0'};
  char time_buf[256] = {'\0'};
  time_t ticks;
  struct sockaddr_storage cliaddr;
  struct sockaddr *sa;
  struct sockaddr_in *sin4;
  struct sockaddr_in6 *sin6;
  if (2 == argc) {
    listenfd = tcp_listen(NULL, argv[1], &addrlen);
  } else if (3 == argc) {
    listenfd = tcp_listen(argv[1], argv[2], &addrlen);
  } else {
    printf("USAGE: %s [host] <service/port>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  while (1) {
    len = sizeof(cliaddr);
    connfd = accept(listenfd, (struct sockaddr *)&cliaddr, &len);
    if (connfd < 0) {
      if (EINTR == errno) {
        continue;
      }
      perror("accept");
      exit(EXIT_FAILURE);
    }
    sa = (struct sockaddr *)&cliaddr;
    switch (sa->sa_family) {
    case AF_INET:
      sin4 = (struct sockaddr_in *)&cliaddr;
      printf("connection from %s\n",
             inet_ntop(AF_INET, &(sin4->sin_addr), ip, sizeof(ip)));
      break;
    case AF_INET6:
      sin6 = (struct sockaddr_in6 *)&cliaddr;
      printf("connection from %s\n",
             inet_ntop(AF_INET6, &(sin6->sin6_addr), ip, sizeof(ip)));
      break;
    default:
      printf("unknown type.\n");
      continue;
    }
    ticks = time(NULL);
    snprintf(time_buf, sizeof(time_buf), "%.24s\r\n", ctime(&ticks));
    n = write(connfd, time_buf, strlen(time_buf));
    if (n < 0) {
      if (EINTR == errno) {
        continue;
      }
      perror("write");
      exit(EXIT_FAILURE);
    }
    close(connfd);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
lea    -0x230(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jne    123a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x24(%rbp),%rdx
call   10c0 <tcp_listen@plt>
mov    %eax,-0x14(%rbp)
jmp    1291 <main+0xc1>
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jne    1269 <main+0x99>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x24(%rbp),%rdx
call   10c0 <tcp_listen@plt>
mov    %eax,-0x14(%rbp)
jmp    128c <main+0xbc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
jmp    1291 <main+0xc1>
jmp    1296 <main+0xc6>
movl   $0x4,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x238(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12f6 <main+0x126>
mov    0x2d0c(%rip),%rax
mov    (%rax),%rax
mov    0x2d12(%rip),%rcx
cmp    (%rcx),%rax
jne    12dc <main+0x10c>
jmp    1296 <main+0xc6>
lea    0xd3e(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    -0x238(%rbp),%rax
mov    %rax,-0x240(%rbp)
mov    -0x240(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x254(%rbp)
sub    $0x80,%eax
je     137a <main+0x1aa>
jmp    1323 <main+0x153>
mov    -0x254(%rbp),%eax
sub    $0x81,%eax
jne    13bb <main+0x1eb>
jmp    1339 <main+0x169>
lea    -0x238(%rbp),%rax
mov    %rax,-0x248(%rbp)
mov    -0x248(%rbp),%rsi
lea    -0x130(%rbp),%rdx
mov    $0x81,%edi
mov    $0x100,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,%rsi
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    13ce <main+0x1fe>
lea    -0x238(%rbp),%rax
mov    %rax,-0x250(%rbp)
mov    -0x250(%rbp),%rsi
lea    -0x130(%rbp),%rdx
mov    $0x80,%edi
mov    $0x100,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,%rsi
lea    0xc79(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    13ce <main+0x1fe>
lea    0xc7a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1296 <main+0xc6>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x234(%rbp)
lea    -0x230(%rbp),%rax
mov    %rax,-0x270(%rbp)
lea    -0x234(%rbp),%rdi
call   1050 <ctime@plt>
mov    -0x270(%rbp),%rdi
mov    %rax,%rcx
mov    $0x100,%esi
lea    0xc3e(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x264(%rbp)
lea    -0x230(%rbp),%rax
mov    %rax,-0x260(%rbp)
lea    -0x230(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x264(%rbp),%edi
mov    -0x260(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    148f <main+0x2bf>
mov    0x2b73(%rip),%rax
mov    (%rax),%rax
mov    0x2b79(%rip),%rcx
cmp    (%rcx),%rax
jne    1475 <main+0x2a5>
jmp    1296 <main+0xc6>
lea    0xbd7(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b50(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x18(%rbp),%edi
call   10a0 <close@plt>
jmp    1296 <main+0xc6>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x200(%rsp)
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
cmp    $0x2,%edi
je     12e8 <main+0x118>
cmp    $0x3,%edi
jne    142c <main+0x25c>
mov    0x8(%rsi),%rdi
mov    $0x2,%eax
jmp    12ef <main+0x11f>
mov    $0x1,%eax
xor    %edi,%edi
mov    (%rsi,%rax,8),%rsi
lea    0xc(%rsp),%rdx
call   10c0 <tcp_listen@plt>
mov    %eax,%ebx
mov    %rsp,%r14
lea    0x8(%rsp),%r15
mov    0x2cd2(%rip),%r12
lea    0x10(%rsp),%r13
jmp    1334 <main+0x164>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x2ca9(%rip),%rax
mov    (%rax),%rax
cmp    (%r12),%rax
jne    141e <main+0x24e>
movl   $0x4,0x8(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   10e0 <accept@plt>
test   %eax,%eax
js     1320 <main+0x150>
mov    %eax,%ebp
mov    (%rsp),%edi
cmp    $0x81,%edi
je     136b <main+0x19b>
cmp    $0x80,%edi
jne    13f0 <main+0x220>
mov    $0x80,%edi
mov    %r14,%rsi
lea    0x110(%rsp),%rdx
mov    $0x100,%ecx
call   1030 <inet_ntop@plt>
lea    0xca1(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1060 <ctime@plt>
mov    %r13,%rdi
mov    $0x100,%esi
lea    0xc87(%rip),%rdx
mov    %rax,%rcx
call   1090 <snprintf@plt>
mov    %r13,%rdi
call   1070 <strlen@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %eax,%edx
call   1050 <write@plt>
test   %eax,%eax
js     1401 <main+0x231>
mov    %ebp,%edi
call   10a0 <close@plt>
jmp    1334 <main+0x164>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xc53(%rip),%rdi
call   1040 <puts@plt>
jmp    1334 <main+0x164>
mov    0x2bc8(%rip),%rax
mov    (%rax),%rax
cmp    (%r12),%rax
je     1334 <main+0x164>
lea    0xc28(%rip),%rdi
jmp    1425 <main+0x255>
lea    0xbfc(%rip),%rdi
call   10d0 <perror@plt>
jmp    143d <main+0x26d>
mov    (%rsi),%rsi
lea    0xbca(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2b94(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr_in6 = type { i32 }
@.str = [33 x i8] c"USAGE: %s [host] <service/port>\0A\00"
@EXIT_FAILURE = global i32 0
@EINTR = global i64 0
@errno = global i64 0
@.str.1 = [7 x i8] c"accept\00"
@.str.2 = [20 x i8] c"connection from %s\0A\00"
@.str.3 = [15 x i8] c"unknown type.\0A\00"
@.str.4 = [8 x i8] c"%.24s\0D\0A\00"
@.str.5 = [6 x i8] c"write\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [256 x i8]
%12 = alloca [256 x i8]
%13 = alloca i32
%14 = alloca %struct.sockaddr_storage
%15 = alloca %struct.sockaddr*
%16 = alloca %struct.sockaddr_in*
%17 = alloca %struct.sockaddr_in6*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = bitcast [256 x i8]* %11 to i8*
%19 = bitcast [256 x i8]* %12 to i8*
%20 = load i32, i32* %4
%21 = icmp eq i32 2, %20
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @tcp_listen(i8* null, i8* %25, i32* %10)
store i32 %26, i32* %6
br label %46
27: ; preds = %2
%28 = load i32, i32* %4
%29 = icmp eq i32 3, %28
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @tcp_listen(i8* %33, i8* %36, i32* %10)
store i32 %37, i32* %6
br label %45
38: ; preds = %27
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %41)
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %30
br label %46
46: ; preds = %45, %22
br label %47
47: ; preds = %46, %57, %81, %99, %104
store i32 4, i32* %9
%48 = load i32, i32* %6
%49 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr*
%50 = call i32 @accept(i32 %48, %struct.sockaddr* %49, i32* %9)
store i32 %50, i32* %7
%51 = load i32, i32* %7
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %62
53: ; preds = %47
%54 = load i64, i64* @EINTR
%55 = load i64, i64* @errno
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %58
57: ; preds = %53
br label %47
58: ; preds = %53
%59 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%60 = load i32, i32* @EXIT_FAILURE
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %47
%63 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr*
store %struct.sockaddr* %63, %struct.sockaddr** %15
%64 = load %struct.sockaddr*, %struct.sockaddr** %15
%65 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %64, i32 0, i32 0
%66 = load i32, i32* %65
switch i32 %66, label %81 [
i32 129, label %67
i32 128, label %74
]
67: ; preds = %62
%68 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr_in*
store %struct.sockaddr_in* %68, %struct.sockaddr_in** %16
%69 = load %struct.sockaddr_in*, %struct.sockaddr_in** %16
%70 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %69, i32 0, i32 0
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%72 = call i8* @inet_ntop(i32 129, i32* %70, i8* %71, i32 256)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %72)
br label %83
74: ; preds = %62
%75 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %75, %struct.sockaddr_in6** %17
%76 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %17
%77 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %76, i32 0, i32 0
%78 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%79 = call i8* @inet_ntop(i32 128, i32* %77, i8* %78, i32 256)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %79)
br label %83
81: ; preds = %62
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %47
83: ; preds = %74, %67
%84 = call i32 @time(i32* null)
store i32 %84, i32* %13
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%86 = call i8* @ctime(i32* %13)
%87 = call i32 @snprintf(i8* %85, i32 256, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %86)
%88 = load i32, i32* %7
%89 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%91 = call i32 @strlen(i8* %90)
%92 = call i32 @write(i32 %88, i8* %89, i32 %91)
store i32 %92, i32* %8
%93 = load i32, i32* %8
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %104
95: ; preds = %83
%96 = load i64, i64* @EINTR
%97 = load i64, i64* @errno
%98 = icmp eq i64 %96, %97
br i1 %98, label %99, label %100
99: ; preds = %95
br label %47
100: ; preds = %95
%101 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%102 = load i32, i32* @EXIT_FAILURE
%103 = call i32 @exit(i32 %102)
unreachable
104: ; preds = %83
%105 = load i32, i32* %7
%106 = call i32 @close(i32 %105)
br label %47
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [33 x i8] c"USAGE: %s [host] <service/port>\0A\00"
@EXIT_FAILURE = global i32 0
@EINTR = global i64 0
@errno = global i64 0
@.str.1 = [7 x i8] c"accept\00"
@.str.2 = [20 x i8] c"connection from %s\0A\00"
@.str.4 = [8 x i8] c"%.24s\0D\0A\00"
@.str.5 = [6 x i8] c"write\00"
@EXIT_SUCCESS = global i32 0
@str = [14 x i8] c"unknown type.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca %struct.sockaddr_storage
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = bitcast i32* %7 to i8*
%14 = bitcast %struct.sockaddr_storage* %8 to i8*
switch i32 %0, label %18 [
i32 2, label %23
i32 3, label %15
]
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
br label %23
18: ; preds = %2
%19 = load i8*, i8** %1
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %2, %15
%24 = phi i64 [ 2, %15 ], [ 1, %2 ]
%25 = phi i8* [ %17, %15 ], [ null, %2 ]
%26 = getelementptr inbounds i8*, i8** %1, i64 %24
%27 = load i8*, i8** %26
%28 = call i32 @tcp_listen(i8* %25, i8* %27, i32* %4)
%29 = bitcast %struct.sockaddr_storage* %8 to %struct.sockaddr*
%30 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %8, i64 0, i32 0
br label %31
31: ; preds = %47, %23
store i32 4, i32* %3
%32 = call i32 @accept(i32 %28, %struct.sockaddr* %29, i32* %3)
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %31
%35 = load i64, i64* @EINTR
%36 = load i64, i64* @errno
%37 = icmp eq i64 %35, %36
br i1 %37, label %47, label %38
38: ; preds = %34
%39 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
%41 = call i32 @exit(i32 %40)
unreachable
42: ; preds = %31
%43 = load i32, i32* %30
switch i32 %43, label %45 [
i32 129, label %48
i32 128, label %44
]
44: ; preds = %42
br label %48
45: ; preds = %42
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %47
47: ; preds = %45, %66, %34, %58
br label %31
48: ; preds = %42, %44
%49 = phi i32 [ 128, %44 ], [ %43, %42 ]
%50 = call i8* @inet_ntop(i32 %49, i32* %30, i8* %11, i32 256)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %50)
%52 = call i32 @time(i32* null)
store i32 %52, i32* %7
%53 = call i8* @ctime(i32* %7)
%54 = call i32 @snprintf(i8* %12, i32 256, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %53)
%55 = call i32 @strlen(i8* %12)
%56 = call i32 @write(i32 %32, i8* %12, i32 %55)
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %66
58: ; preds = %48
%59 = load i64, i64* @EINTR
%60 = load i64, i64* @errno
%61 = icmp eq i64 %59, %60
br i1 %61, label %47, label %62
62: ; preds = %58
%63 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %48
%67 = call i32 @close(i32 %32)
br label %47
}