#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_in6 {
  int sin6_port;
  int /*<<< orphan*/ sin6_addr;
  int /*<<< orphan*/ sin6_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ str;
typedef int socklen_t;
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ cli_addr;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int /*<<< orphan*/ EXIT_FAILURE;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int htons(int /*<<< orphan*/);
int /*<<< orphan*/ in6addr_any;
int /*<<< orphan*/ *inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/ *, char *,
                              int);
int listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in6 *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  struct sockaddr_in6 serv_addr, cli_addr;
  int sockfd, clifd;
  socklen_t addr_len;
  int str_len;
  char buf[1024];
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <port>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  sockfd = socket(AF_INET6, SOCK_STREAM, 0);
  if (sockfd == -1) {
    perror("socket() failed");
    exit(EXIT_FAILURE);
  }
  memset(&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin6_family = AF_INET6;
  serv_addr.sin6_addr = in6addr_any;
  serv_addr.sin6_port = htons(atoi(argv[1]));
  if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) == -1) {
    perror("bind() failed");
    exit(EXIT_FAILURE);
  }
  if (listen(sockfd, 5) == -1) {
    perror("listen() failed");
    exit(EXIT_FAILURE);
  }
  addr_len = sizeof(cli_addr);
  while (1) {
    clifd = accept(sockfd, (struct sockaddr *)&cli_addr, &addr_len);
    if (clifd == -1) {
      perror("accept() failed");
      continue;
    }
    char str[INET6_ADDRSTRLEN];
    if (inet_ntop(AF_INET6, &cli_addr.sin6_addr, str, sizeof(str)) == NULL) {
      fprintf(stderr, "inet_ntop() failed\n");
    } else {
      printf("client connect, ip = %s, port = %d\n", str, cli_addr.sin6_port);
    }
    str_len = read(clifd, buf, sizeof(buf) - 1);
    buf[str_len] = '\0';
    write(clifd, buf, str_len);
    close(clifd);
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     123f <main+0x4f>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd6(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    127f <main+0x8f>
lea    0xda6(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12f2 <main+0x102>
lea    0xd43(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x34(%rbp),%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1322 <main+0x132>
lea    0xd21(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
movl   $0xc,-0x3c(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1357 <main+0x167>
lea    0xcf3(%rip),%rdi
call   10d0 <perror@plt>
jmp    1329 <main+0x139>
mov    0x2c82(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x448(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x458(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x450(%rbp)
mov    0x2c45(%rip),%rcx
mov    (%rcx),%edi
lea    -0x30(%rbp),%rsi
add    $0x4,%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
cmp    $0x0,%rax
jne    13ca <main+0x1da>
mov    0x2c13(%rip),%rax
mov    (%rax),%edi
lea    0xc92(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    13e0 <main+0x1f0>
mov    -0x458(%rbp),%rsi
mov    -0x30(%rbp),%edx
lea    0xc89(%rip),%rdi
call   1060 <printf@plt>
mov    -0x38(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x3ff,%edx
call   1090 <read@plt>
mov    %eax,-0x40(%rbp)
movslq -0x40(%rbp),%rax
movb   $0x0,-0x440(%rbp,%rax,1)
mov    -0x38(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    -0x40(%rbp),%edx
call   1040 <write@plt>
mov    -0x38(%rbp),%edi
call   1080 <close@plt>
mov    -0x448(%rbp),%rax
mov    %rax,%rsp
jmp    1329 <main+0x139>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    139a <main+0x1aa>
mov    0x2dc1(%rip),%r12
mov    (%r12),%edi
mov    0x2d9e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
cmp    $0xffffffff,%eax
je     13b6 <main+0x1c6>
mov    %eax,%r14d
lea    -0x40(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    (%r12),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x8(%rbx),%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x40(%rbp)
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0xffffffff,%eax
je     13bf <main+0x1cf>
mov    %r14d,%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
cmp    $0xffffffff,%eax
je     13c8 <main+0x1d8>
movl   $0xc,-0x2c(%rbp)
lea    -0x50(%rbp),%r15
lea    -0x2c(%rbp),%rbx
mov    %r14d,-0x30(%rbp)
jmp    12cc <main+0xdc>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xd79(%rip),%rdi
call   10d0 <perror@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   10e0 <accept@plt>
cmp    $0xffffffff,%eax
je     12c0 <main+0xd0>
mov    %eax,%r13d
mov    %r15,%r14
mov    %rsp,%r12
mov    0x2cf1(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%r15
mov    %rcx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
lea    -0x4c(%rbp),%rsi
mov    %r15,%rdx
call   1030 <inet_ntop@plt>
test   %rax,%rax
jne    1340 <main+0x150>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
lea    0xd21(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    1352 <main+0x162>
nopl   0x0(%rax,%rax,1)
mov    -0x50(%rbp),%edx
lea    0xd1a(%rip),%rdi
mov    %r15,%rsi
call   1060 <printf@plt>
mov    %r13d,%edi
lea    -0x450(%rbp),%rbx
mov    %rbx,%rsi
mov    $0x3ff,%edx
call   1090 <read@plt>
movslq %eax,%rdx
movb   $0x0,-0x450(%rbp,%rdx,1)
mov    %r13d,%edi
mov    %rbx,%rsi
call   1040 <write@plt>
mov    %r13d,%edi
call   1080 <close@plt>
mov    %r12,%rsp
mov    %r14,%r15
lea    -0x2c(%rbp),%rbx
mov    -0x30(%rbp),%r14d
jmp    12cc <main+0xdc>
mov    0x2c27(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc53(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    13d4 <main+0x1e4>
lea    0xc55(%rip),%rdi
jmp    13cf <main+0x1df>
lea    0xc5c(%rip),%rdi
jmp    13cf <main+0x1df>
lea    0xc61(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2bdd(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in6 = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <port>\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [16 x i8] c"socket() failed\00"
@in6addr_any = global i32 0
@.str.2 = [14 x i8] c"bind() failed\00"
@.str.3 = [16 x i8] c"listen() failed\00"
@.str.4 = [16 x i8] c"accept() failed\00"
@INET6_ADDRSTRLEN = global i32 0
@.str.5 = [20 x i8] c"inet_ntop() failed\0A\00"
@.str.6 = [36 x i8] c"client connect, ip = %s, port = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in6
%7 = alloca %struct.sockaddr_in6
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1024 x i8]
%13 = alloca i8*
%14 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %25
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %2
%26 = load i32, i32* @AF_INET6
%27 = load i32, i32* @SOCK_STREAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
store i32 %28, i32* %8
%29 = load i32, i32* %8
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %35
31: ; preds = %25
%32 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %25
%36 = call i32 @memset(%struct.sockaddr_in6* %6, i32 0, i32 12)
%37 = load i32, i32* @AF_INET6
%38 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %6, i32 0, i32 2
store i32 %37, i32* %38
%39 = load i32, i32* @in6addr_any
%40 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %6, i32 0, i32 1
store i32 %39, i32* %40
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
%45 = call i32 @htons(i32 %44)
%46 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %6, i32 0, i32 0
store i32 %45, i32* %46
%47 = load i32, i32* %8
%48 = bitcast %struct.sockaddr_in6* %6 to %struct.sockaddr*
%49 = call i32 @bind(i32 %47, %struct.sockaddr* %48, i32 12)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %55
51: ; preds = %35
%52 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; preds = %35
%56 = load i32, i32* %8
%57 = call i32 @listen(i32 %56, i32 5)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%61 = load i32, i32* @EXIT_FAILURE
%62 = call i32 @exit(i32 %61)
unreachable
63: ; preds = %55
store i32 12, i32* %10
br label %64
64: ; preds = %63, %70, %89
%65 = load i32, i32* %8
%66 = bitcast %struct.sockaddr_in6* %7 to %struct.sockaddr*
%67 = call i32 @accept(i32 %65, %struct.sockaddr* %66, i32* %10)
store i32 %67, i32* %9
%68 = load i32, i32* %9
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %72
70: ; preds = %64
%71 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %64
72: ; preds = %64
%73 = load i32, i32* @INET6_ADDRSTRLEN
%74 = zext i32 %73 to i64
%75 = call i8* @llvm.stacksave()
store i8* %75, i8** %13
%76 = alloca i8, i64 %74
store i64 %74, i64* %14
%77 = load i32, i32* @AF_INET6
%78 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %7, i32 0, i32 1
%79 = trunc i64 %74 to i32
%80 = call i32* @inet_ntop(i32 %77, i32* %78, i8* %76, i32 %79)
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %85
82: ; preds = %72
%83 = load i32, i32* @stderr
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %89
85: ; preds = %72
%86 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %7, i32 0, i32 0
%87 = load i32, i32* %86
%88 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8* %76, i32 %87)
br label %89
89: ; preds = %85, %82
%90 = load i32, i32* %9
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%92 = call i32 @read(i32 %90, i8* %91, i32 1023)
store i32 %92, i32* %11
%93 = load i32, i32* %11
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %94
store i8 0, i8* %95
%96 = load i32, i32* %9
%97 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%98 = load i32, i32* %11
%99 = call i32 @write(i32 %96, i8* %97, i32 %98)
%100 = load i32, i32* %9
%101 = call i32 @close(i32 %100)
%102 = load i8*, i8** %13
br label %64
}

LLVM IR (-O2):
%struct.sockaddr_in6 = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <port>\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [16 x i8] c"socket() failed\00"
@in6addr_any = global i32 0
@.str.2 = [14 x i8] c"bind() failed\00"
@.str.3 = [16 x i8] c"listen() failed\00"
@.str.4 = [16 x i8] c"accept() failed\00"
@INET6_ADDRSTRLEN = global i32 0
@.str.5 = [20 x i8] c"inet_ntop() failed\0A\00"
@.str.6 = [36 x i8] c"client connect, ip = %s, port = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in6
%4 = alloca %struct.sockaddr_in6
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = bitcast %struct.sockaddr_in6* %3 to i8*
%8 = bitcast %struct.sockaddr_in6* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = icmp eq i32 %0, 2
br i1 %11, label %18, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i32, i32* @AF_INET6
%20 = load i32, i32* @SOCK_STREAM
%21 = tail call i32 @socket(i32 %19, i32 %20, i32 0)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = tail call i32 @exit(i32 %25)
unreachable
27: ; preds = %18
%28 = call i32 @memset(%struct.sockaddr_in6* %3, i32 0, i32 12)
%29 = load i32, i32* @AF_INET6
%30 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %3, i64 0, i32 2
store i32 %29, i32* %30
%31 = load i32, i32* @in6addr_any
%32 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %3, i64 0, i32 1
store i32 %31, i32* %32
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
%36 = call i32 @htons(i32 %35)
%37 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %3, i64 0, i32 0
store i32 %36, i32* %37
%38 = bitcast %struct.sockaddr_in6* %3 to %struct.sockaddr*
%39 = call i32 @bind(i32 %21, %struct.sockaddr* %38, i32 12)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %45
41: ; preds = %27
%42 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %27
%46 = call i32 @listen(i32 %21, i32 5)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %45
store i32 12, i32* %5
%53 = bitcast %struct.sockaddr_in6* %4 to %struct.sockaddr*
%54 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i64 0, i32 1
%55 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i64 0, i32 0
br label %56
56: ; preds = %61, %52
%57 = call i32 @accept(i32 %21, %struct.sockaddr* %53, i32* %5)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %61
61: ; preds = %59, %76
br label %56
62: ; preds = %56
%63 = load i32, i32* @INET6_ADDRSTRLEN
%64 = zext i32 %63 to i64
%65 = call i8* @llvm.stacksave()
%66 = alloca i8, i64 %64
%67 = load i32, i32* @AF_INET6
%68 = call i32* @inet_ntop(i32 %67, i32* %54, i8* %66, i32 %63)
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %73
70: ; preds = %62
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %76
73: ; preds = %62
%74 = load i32, i32* %55
%75 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8* %66, i32 %74)
br label %76
76: ; preds = %73, %70
%77 = call i32 @read(i32 %57, i8* %10, i32 1023)
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %78
store i8 0, i8* %79
%80 = call i32 @write(i32 %57, i8* %10, i32 %77)
%81 = call i32 @close(i32 %57)
br label %61
}