#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_un {
  int sun_family;
  char *sun_path;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ server;
typedef int /*<<< orphan*/ peer;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int AF_UNIX;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, int /*<<< orphan*/, int /*<<< orphan*/);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int getpeername(int, struct sockaddr *, int *);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_un *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ unlink(char *);
int main(int argc, char *argv[]) {
  int sock, msgsock, rval, ret;
  struct sockaddr_un server, peer;
  char buf[1024];
  socklen_t len = sizeof(struct sockaddr_un);
  bool toclose = false;
  sock = socket(AF_UNIX, SOCK_STREAM, 0);
  if (sock < 0) {
    perror("socket");
    exit(1);
  }
  memset(&server, 0, sizeof(server));
  server.sun_family = AF_UNIX;
  strcpy(server.sun_path, "srvsock");
  ret = bind(sock, (struct sockaddr *)&server, sizeof(struct sockaddr_un));
  if (ret) {
    perror("bind");
    close(sock);
    exit(1);
  }
  printf("Socket has name %s\n", server.sun_path);
  listen(sock, 5);
  do {
    msgsock = accept(sock, 0, 0);
    if (-1 == msgsock) {
      perror("accept");
    } else
      do {
        bzero(buf, sizeof(buf));
        rval = read(msgsock, buf, 1024);
        if (rval > 0) {
          memset(&peer, 0, sizeof(peer));
          ret = getpeername(msgsock, (struct sockaddr *)&peer, &len);
          if (ret) {
            perror("getpeername");
          } else {
            printf("peer af   = %d\n", peer.sun_family);
            printf("peer plen = %ld\n", sizeof(peer.sun_path));
            printf("peer path = %s\n", peer.sun_path);
          }
          printf("Received: %s\n", buf);
        }
        if (rval < 0) {
          perror("read");
        } else if (!(strncmp("close", buf, 5))) {
          toclose = true;
        } else if (rval == 0) {
          printf("Ending connection\n");
        }
      } while (rval > 0);
    close(msgsock);
  } while (toclose == false);
  printf("Goodbye\n");
  close(sock);
  unlink("srvsock");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x10,-0x444(%rbp)
movl   $0x0,-0x448(%rbp)
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
mov    0x2dab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1259 <main+0x69>
lea    0xdb6(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <memset@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   10c0 <bind@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     12c1 <main+0xd1>
lea    0xd65(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x28(%rbp),%rsi
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
mov    -0x14(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   10f0 <accept@plt>
mov    %eax,-0x18(%rbp)
mov    $0xffffffff,%eax
cmp    -0x18(%rbp),%eax
jne    130e <main+0x11e>
lea    0xd24(%rip),%rdi
call   10d0 <perror@plt>
jmp    1452 <main+0x262>
jmp    1313 <main+0x123>
lea    -0x440(%rbp),%rdi
mov    $0x400,%esi
call   10e0 <bzero@plt>
mov    -0x18(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x400,%edx
call   10a0 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    13d1 <main+0x1e1>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <memset@plt>
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x444(%rbp),%rdx
call   1060 <getpeername@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1386 <main+0x196>
lea    0xcb3(%rip),%rdi
call   10d0 <perror@plt>
jmp    13bc <main+0x1cc>
mov    -0x40(%rbp),%esi
lea    0xcab(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xcad(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x440(%rbp),%rsi
lea    0xca2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jge    13ec <main+0x1fc>
lea    0xc98(%rip),%rdi
call   10d0 <perror@plt>
jmp    143e <main+0x24e>
lea    -0x440(%rbp),%rsi
lea    0xc85(%rip),%rdi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    141c <main+0x22c>
movl   $0x1,-0x448(%rbp)
jmp    1439 <main+0x249>
cmpl   $0x0,-0x1c(%rbp)
jne    1434 <main+0x244>
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1439 <main+0x249>
jmp    143e <main+0x24e>
jmp    1443 <main+0x253>
cmpl   $0x0,-0x1c(%rbp)
jg     1313 <main+0x123>
jmp    1452 <main+0x262>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
cmpl   $0x0,-0x448(%rbp)
je     12e0 <main+0xf0>
lea    0xc2a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
lea    0xb83(%rip),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
movl   $0x10,0xc(%rsp)
mov    0x2dc8(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
js     145c <main+0x25c>
mov    %eax,%r15d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1090 <memset@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    0x18(%rsp),%rdi
lea    0xda2(%rip),%rsi
call   1050 <strcpy@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   10d0 <bind@plt>
test   %eax,%eax
jne    1472 <main+0x272>
mov    0x18(%rsp),%rsi
lea    0xd86(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15d,%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
lea    0x30(%rsp),%rbx
lea    0x20(%rsp),%rbp
lea    0xdcc(%rip),%r14
mov    $0x1,%r12d
mov    %r15d,0x8(%rsp)
xchg   %ax,%ax
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1100 <accept@plt>
mov    %eax,%r15d
cmp    $0xffffffff,%eax
je     13fc <main+0x1fc>
mov    %rbx,%rdi
mov    $0x400,%esi
call   10f0 <bzero@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   10b0 <read@plt>
xor    %r13d,%r13d
jmp    137c <main+0x17c>
nopl   (%rax)
mov    0x20(%rsp),%esi
lea    0xd30(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x8,%esi
lea    0xd2d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x28(%rsp),%rsi
lea    0xd2b(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xd2d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
cmove  %r12d,%r13d
mov    %rbx,%rdi
mov    $0x400,%esi
call   10f0 <bzero@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   10b0 <read@plt>
test   %eax,%eax
jle    13c0 <main+0x1c0>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1090 <memset@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
lea    0xc(%rsp),%rdx
call   1070 <getpeername@plt>
test   %eax,%eax
je     1300 <main+0x100>
lea    0xc81(%rip),%rdi
call   10e0 <perror@plt>
jmp    1338 <main+0x138>
cs nopw 0x0(%rax,%rax,1)
nop
test   %eax,%eax
js     140d <main+0x20d>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     141b <main+0x21b>
lea    0xcae(%rip),%rdi
call   1060 <puts@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
test   %r13d,%r13d
mov    0x8(%rsp),%r15d
je     12c0 <main+0xc0>
jmp    1428 <main+0x228>
lea    0xc25(%rip),%rdi
call   10e0 <perror@plt>
xor    %r13d,%r13d
jmp    13e4 <main+0x1e4>
lea    0xc66(%rip),%rdi
call   10e0 <perror@plt>
jmp    13e4 <main+0x1e4>
mov    %r15d,%edi
call   10a0 <close@plt>
mov    0x8(%rsp),%r15d
lea    0xc56(%rip),%rdi
call   1060 <puts@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
lea    0xbc4(%rip),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb9d(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xb96(%rip),%rdi
call   10e0 <perror@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_un = type { i32, i8* }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@.str.1 = [8 x i8] c"srvsock\00"
@.str.2 = [5 x i8] c"bind\00"
@.str.3 = [20 x i8] c"Socket has name %s\0A\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.5 = [12 x i8] c"getpeername\00"
@.str.6 = [16 x i8] c"peer af = %d\0A\00"
@.str.7 = [17 x i8] c"peer plen = %ld\0A\00"
@.str.8 = [16 x i8] c"peer path = %s\0A\00"
@.str.9 = [14 x i8] c"Received: %s\0A\00"
@.str.10 = [5 x i8] c"read\00"
@.str.11 = [6 x i8] c"close\00"
@.str.12 = [19 x i8] c"Ending connection\0A\00"
@.str.13 = [9 x i8] c"Goodbye\0A\00"
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 %struct.sockaddr_un
%11 = alloca %struct.sockaddr_un
%12 = alloca [1024 x i8]
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 16, i32* %13
store i32 0, i32* %14
%15 = load i32, i32* @AF_UNIX
%16 = load i32, i32* @SOCK_STREAM
%17 = call i32 @socket(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = call i32 @memset(%struct.sockaddr_un* %10, i32 0, i32 16)
%25 = load i32, i32* @AF_UNIX
%26 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %10, i32 0, i32 0
store i32 %25, i32* %26
%27 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %10, i32 0, i32 1
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %6
%31 = bitcast %struct.sockaddr_un* %10 to %struct.sockaddr*
%32 = call i32 @bind(i32 %30, %struct.sockaddr* %31, i32 16)
store i32 %32, i32* %9
%33 = load i32, i32* %9
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %23
%36 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%37 = load i32, i32* %6
%38 = call i32 @close(i32 %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %23
%41 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %10, i32 0, i32 1
%42 = load i8*, i8** %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %42)
%44 = load i32, i32* %6
%45 = call i32 @listen(i32 %44, i32 5)
br label %46
46: ; preds = %107, %40
%47 = load i32, i32* %6
%48 = call i32 @accept(i32 %47, i32 0, i32 0)
store i32 %48, i32* %7
%49 = load i32, i32* %7
%50 = icmp eq i32 -1, %49
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %104
53: ; preds = %46
br label %54
54: ; preds = %100, %53
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%56 = call i32 @bzero(i8* %55, i32 1024)
%57 = load i32, i32* %7
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%59 = call i32 @read(i32 %57, i8* %58, i32 1024)
store i32 %59, i32* %8
%60 = load i32, i32* %8
%61 = icmp sgt i32 %60, 0
br i1 %61, label %62, label %82
62: ; preds = %54
%63 = call i32 @memset(%struct.sockaddr_un* %11, i32 0, i32 16)
%64 = load i32, i32* %7
%65 = bitcast %struct.sockaddr_un* %11 to %struct.sockaddr*
%66 = call i32 @getpeername(i32 %64, %struct.sockaddr* %65, i32* %13)
store i32 %66, i32* %9
%67 = load i32, i32* %9
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %62
%70 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %79
71: ; preds = %62
%72 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %11, i32 0, i32 0
%73 = load i32, i32* %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %73)
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i64 8)
%76 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %11, i32 0, i32 1
%77 = load i8*, i8** %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* %77)
br label %79
79: ; preds = %71, %69
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %80)
br label %82
82: ; preds = %79, %54
%83 = load i32, i32* %8
%84 = icmp slt i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %82
%86 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %99
87: ; preds = %82
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%89 = call i32 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %88, i32 5)
%90 = icmp ne i32 %89, 0
br i1 %90, label %92, label %91
91: ; preds = %87
store i32 1, i32* %14
br label %98
92: ; preds = %87
%93 = load i32, i32* %8
%94 = icmp eq i32 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %92
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0))
br label %97
97: ; preds = %95, %92
br label %98
98: ; preds = %97, %91
br label %99
99: ; preds = %98, %85
br label %100
100: ; preds = %99
%101 = load i32, i32* %8
%102 = icmp sgt i32 %101, 0
br i1 %102, label %54, label %103
103: ; preds = %100
br label %104
104: ; preds = %103, %51
%105 = load i32, i32* %7
%106 = call i32 @close(i32 %105)
br label %107
107: ; preds = %104
%108 = load i32, i32* %14
%109 = icmp eq i32 %108, 0
br i1 %109, label %46, label %110
110: ; preds = %107
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%112 = load i32, i32* %6
%113 = call i32 @close(i32 %112)
%114 = call i32 @unlink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32, i8* }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@.str.1 = [8 x i8] c"srvsock\00"
@.str.2 = [5 x i8] c"bind\00"
@.str.3 = [20 x i8] c"Socket has name %s\0A\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.5 = [12 x i8] c"getpeername\00"
@.str.6 = [16 x i8] c"peer af = %d\0A\00"
@.str.7 = [17 x i8] c"peer plen = %ld\0A\00"
@.str.8 = [16 x i8] c"peer path = %s\0A\00"
@.str.9 = [14 x i8] c"Received: %s\0A\00"
@.str.10 = [5 x i8] c"read\00"
@.str.11 = [6 x i8] c"close\00"
@str = [8 x i8] c"Goodbye\00"
@str.14 = [18 x i8] c"Ending connection\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_un
%4 = alloca %struct.sockaddr_un
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = bitcast %struct.sockaddr_un* %3 to i8*
%8 = bitcast %struct.sockaddr_un* %4 to i8*
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = bitcast i32* %6 to i8*
store i32 16, i32* %6
%11 = load i32, i32* @AF_UNIX
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = call i32 @memset(%struct.sockaddr_un* %3, i32 0, i32 16)
%20 = load i32, i32* @AF_UNIX
%21 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i64 0, i32 0
store i32 %20, i32* %21
%22 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i64 0, i32 1
%23 = load i8*, i8** %22
%24 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%25 = bitcast %struct.sockaddr_un* %3 to %struct.sockaddr*
%26 = call i32 @bind(i32 %13, %struct.sockaddr* %25, i32 16)
%27 = icmp eq i32 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %18
%29 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @close(i32 %13)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %18
%33 = load i8*, i8** %22
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = call i32 @listen(i32 %13, i32 5)
%36 = bitcast %struct.sockaddr_un* %4 to %struct.sockaddr*
%37 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %4, i64 0, i32 0
%38 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %4, i64 0, i32 1
br label %39
39: ; preds = %82, %32
%40 = call i32 @accept(i32 %13, i32 0, i32 0)
%41 = icmp eq i32 %40, -1
br i1 %41, label %46, label %42
42: ; preds = %39
%43 = call i32 @bzero(i8* %9, i32 1024)
%44 = call i32 @read(i32 %40, i8* %9, i32 1024)
%45 = icmp sgt i32 %44, 0
br i1 %45, label %48, label %61
46: ; preds = %39
%47 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %82
48: ; preds = %42, %72
%49 = phi i32 [ %76, %72 ], [ 0, %42 ]
%50 = call i32 @memset(%struct.sockaddr_un* %4, i32 0, i32 16)
%51 = call i32 @getpeername(i32 %40, %struct.sockaddr* %36, i32* %6)
%52 = icmp eq i32 %51, 0
br i1 %52, label %55, label %53
53: ; preds = %48
%54 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %72
55: ; preds = %48
%56 = load i32, i32* %37
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i64 8)
%59 = load i8*, i8** %38
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* %59)
br label %72
61: ; preds = %72, %42
%62 = phi i32 [ 0, %42 ], [ %76, %72 ]
%63 = phi i32 [ %44, %42 ], [ %78, %72 ]
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %82
67: ; preds = %61
%68 = call i32 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %9, i32 5)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %80
70: ; preds = %67
%71 = call i32 @close(i32 %40)
br label %86
72: ; preds = %53, %55
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %9)
%74 = call i32 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %9, i32 5)
%75 = icmp eq i32 %74, 0
%76 = select i1 %75, i32 1, i32 %49
%77 = call i32 @bzero(i8* %9, i32 1024)
%78 = call i32 @read(i32 %40, i8* %9, i32 1024)
%79 = icmp sgt i32 %78, 0
br i1 %79, label %48, label %61
80: ; preds = %67
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.14, i64 0, i64 0))
br label %82
82: ; preds = %80, %65, %46
%83 = phi i32 [ 0, %46 ], [ %62, %65 ], [ %62, %80 ]
%84 = call i32 @close(i32 %40)
%85 = icmp eq i32 %83, 0
br i1 %85, label %39, label %86
86: ; preds = %82, %70
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%88 = call i32 @close(i32 %13)
%89 = call i32 @unlink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}