#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*/ sun;
struct sockaddr_un {
  int /*<<< orphan*/ sun_path;
  int /*<<< orphan*/ sun_family;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
scalar_t__ EINTR;
int /*<<< orphan*/ PF_UNIX;
int /*<<< orphan*/ SOCK_STREAM;
int connect(int, struct sockaddr *, int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ getenv(char *);
char *memchr(char *, char, int);
int /*<<< orphan*/ memmove(char *, char *, 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 /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncat(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, int /*<<< orphan*/, int);
int main() {
  char buf[1024];
  struct sockaddr_un sun;
  int fd, bufptr, rc;
  memset(&sun, 0, sizeof(sun));
  sun.sun_family = AF_UNIX;
  strncpy(sun.sun_path, getenv("HOME"), 107);
  strncat(sun.sun_path, "/", 107);
  strncat(sun.sun_path, ".dazibao-notification-socket", 107);
  fd = socket(PF_UNIX, SOCK_STREAM, 0);
  if (fd < 0) {
    perror("socket");
    exit(1);
  }
  rc = connect(fd, (struct sockaddr *)&sun, sizeof(sun));
  if (rc < 0) {
    perror("connect");
    exit(1);
  }
  bufptr = 0;
  while (1) {
    char *p;
    rc = read(fd, buf + bufptr, 1024 - bufptr);
    if (rc < 0) {
      if (errno == EINTR)
        continue;
      perror("read");
      exit(1);
    }
    if (rc == 0)
      break;
    bufptr += rc;
    p = memchr(buf, '\n', bufptr);
    if (p == NULL) {
      if (bufptr >= 1024) {
        fprintf(stderr, "Notification too long!\n");
        exit(1);
      }
      continue;
    }
    if (buf[0] == 'C') {
      printf("Dazibao changed: ");
      fwrite(buf, 1, p - buf, stdout);
      printf("\n");
      fflush(stdout);
    } else {
      fprintf(stderr, "Unknown notification type %c.\n", buf[0]);
    }
    if (p + 1 >= buf + bufptr) {
      bufptr = 0;
    } else {
      memmove(buf, p + 1, buf + bufptr - (p + 1));
      bufptr -= p + 1 - buf;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x418(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x414(%rbp)
mov    -0x418(%rbp),%eax
mov    %eax,-0x434(%rbp)
lea    0xdc9(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x434(%rbp),%edi
mov    %eax,%esi
mov    $0x6b,%edx
call   1040 <strncpy@plt>
mov    -0x418(%rbp),%edi
lea    0xdaa(%rip),%rsi
mov    $0x6b,%edx
call   1070 <strncat@plt>
mov    -0x418(%rbp),%edi
lea    0xd95(%rip),%rsi
mov    $0x6b,%edx
call   1070 <strncat@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
mov    0x2d3c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x41c(%rbp)
cmpl   $0x0,-0x41c(%rbp)
jge    12be <main+0xce>
lea    0xd6e(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x41c(%rbp),%edi
lea    -0x418(%rbp),%rsi
mov    $0x8,%edx
call   10f0 <connect@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0x0,-0x424(%rbp)
jge    12fe <main+0x10e>
lea    0xd35(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x420(%rbp)
mov    -0x41c(%rbp),%edi
lea    -0x410(%rbp),%rsi
movslq -0x420(%rbp),%rax
add    %rax,%rsi
mov    $0x400,%edx
sub    -0x420(%rbp),%edx
call   1090 <read@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0x0,-0x424(%rbp)
jge    1377 <main+0x187>
mov    0x2c77(%rip),%rax
mov    (%rax),%rax
mov    0x2c65(%rip),%rcx
cmp    (%rcx),%rax
jne    1361 <main+0x171>
jmp    1308 <main+0x118>
lea    0xcc4(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
cmpl   $0x0,-0x424(%rbp)
jne    1389 <main+0x199>
jmp    1519 <main+0x329>
mov    -0x424(%rbp),%eax
add    -0x420(%rbp),%eax
mov    %eax,-0x420(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x420(%rbp),%edx
mov    $0xa,%esi
call   1080 <memchr@plt>
mov    %rax,-0x430(%rbp)
cmpq   $0x0,-0x430(%rbp)
jne    13fd <main+0x20d>
cmpl   $0x400,-0x420(%rbp)
jl     13f8 <main+0x208>
mov    0x2bf2(%rip),%rax
mov    (%rax),%edi
lea    0xc4a(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    1308 <main+0x118>
movsbl -0x410(%rbp),%eax
cmp    $0x43,%eax
jne    1465 <main+0x275>
lea    0xc35(%rip),%rdi
call   1050 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    -0x430(%rbp),%rax
lea    -0x410(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    0x2b76(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1100 <fwrite@plt>
lea    0xbfa(%rip),%rdi
call   1050 <printf@plt>
mov    0x2b57(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
jmp    1483 <main+0x293>
mov    0x2b64(%rip),%rax
mov    (%rax),%edi
movsbl -0x410(%rbp),%edx
lea    0xbdf(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x430(%rbp),%rax
add    $0x1,%rax
lea    -0x410(%rbp),%rcx
movslq -0x420(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jb     14b7 <main+0x2c7>
movl   $0x0,-0x420(%rbp)
jmp    1514 <main+0x324>
lea    -0x410(%rbp),%rdi
mov    -0x430(%rbp),%rsi
add    $0x1,%rsi
lea    -0x410(%rbp),%rax
movslq -0x420(%rbp),%rcx
add    %rcx,%rax
mov    -0x430(%rbp),%rcx
add    $0x1,%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   10c0 <memmove@plt>
mov    -0x430(%rbp),%rcx
add    $0x1,%rcx
lea    -0x410(%rbp),%rax
sub    %rax,%rcx
movslq -0x420(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x420(%rbp)
jmp    1308 <main+0x118>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    (%rsp),%ebx
lea    0xdc9(%rip),%rdi
call   1030 <getenv@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x6b,%edx
call   1050 <strncpy@plt>
mov    (%rsp),%edi
lea    0xdb1(%rip),%rsi
mov    $0x6b,%edx
call   1080 <strncat@plt>
mov    (%rsp),%edi
lea    0xd9f(%rip),%rsi
mov    $0x6b,%edx
call   1080 <strncat@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
mov    0x2d46(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
js     1420 <main+0x220>
mov    %eax,%r15d
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x8,%edx
call   1100 <connect@plt>
test   %eax,%eax
js     1429 <main+0x229>
mov    0x2d0c(%rip),%r12
mov    0x2cfd(%rip),%r14
xor    %eax,%eax
jmp    12ce <main+0xce>
nop
mov    %ebp,%eax
cmp    $0x400,%ebp
jge    13ff <main+0x1ff>
mov    %eax,0xc(%rsp)
cltq
lea    (%rsp,%rax,1),%r13
add    $0x10,%r13
mov    $0x400,%ebx
sub    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15d,%edi
mov    %r13,%rsi
mov    %ebx,%edx
call   10a0 <read@plt>
test   %eax,%eax
jns    1310 <main+0x110>
mov    (%r12),%rax
cmp    (%r14),%rax
je     12f0 <main+0xf0>
jmp    13e9 <main+0x1e9>
nop
je     13d5 <main+0x1d5>
mov    %eax,%ebp
add    0xc(%rsp),%ebp
lea    0x10(%rsp),%rdi
mov    $0xa,%esi
mov    %ebp,%edx
call   1090 <memchr@plt>
test   %rax,%rax
je     12c0 <main+0xc0>
mov    %rax,%r13
movsbl 0x10(%rsp),%edx
cmp    $0x43,%edx
jne    1380 <main+0x180>
lea    0xd03(%rip),%rdi
call   1060 <printf@plt>
mov    %r13d,%edx
lea    0x10(%rsp),%rdi
sub    %edi,%edx
mov    0x2c54(%rip),%rbx
mov    (%rbx),%ecx
mov    $0x1,%esi
call   1110 <fwrite@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    (%rbx),%edi
call   10c0 <fflush@plt>
jmp    1397 <main+0x197>
nopl   0x0(%rax,%rax,1)
mov    0x2c49(%rip),%rax
mov    (%rax),%edi
lea    0xccb(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
add    $0x1,%r13
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdx
add    $0x10,%rdx
mov    $0x0,%eax
cmp    %rdx,%r13
jae    12ce <main+0xce>
sub    %r13d,%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   10d0 <memmove@plt>
mov    %ebx,%eax
sub    %r13d,%eax
add    %eax,%ebp
mov    %ebp,%eax
jmp    12ce <main+0xce>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc3c(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2bca(%rip),%rax
mov    (%rax),%edi
lea    0xc22(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xbf6(%rip),%rdi
jmp    13f0 <main+0x1f0>
lea    0xbf4(%rip),%rdi
jmp    13f0 <main+0x1f0>

LLVM IR (-O0):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
@.str = [5 x i8] c"HOME\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [29 x i8] c".dazibao-notification-socket\00"
@PF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@.str.4 = [8 x i8] c"connect\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.5 = [5 x i8] c"read\00"
@stderr = global i32 0
@.str.6 = [24 x i8] c"Notification too long!\0A\00"
@.str.7 = [18 x i8] c"Dazibao changed: \00"
@stdout = global i32 0
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [31 x i8] c"Unknown notification type %c.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca %struct.sockaddr_un
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %1
%8 = call i32 @memset(%struct.sockaddr_un* %3, i32 0, i32 8)
%9 = load i32, i32* @AF_UNIX
%10 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i32 0, i32 1
store i32 %9, i32* %10
%11 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @strncpy(i32 %12, i32 %13, i32 107)
%15 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i32 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 @strncat(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 107)
%18 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i32 0, i32 0
%19 = load i32, i32* %18
%20 = call i32 @strncat(i32 %19, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 107)
%21 = load i32, i32* @PF_UNIX
%22 = load i32, i32* @SOCK_STREAM
%23 = call i32 @socket(i32 %21, i32 %22, i32 0)
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %0
%27 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %0
%30 = load i32, i32* %4
%31 = bitcast %struct.sockaddr_un* %3 to %struct.sockaddr*
%32 = call i32 @connect(i32 %30, %struct.sockaddr* %31, i32 8)
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %29
%36 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %29
store i32 0, i32* %5
br label %39
39: ; preds = %38, %54, %78, %138
%40 = load i32, i32* %4
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i32, i32* %5
%46 = sub nsw i32 1024, %45
%47 = call i32 @read(i32 %40, i8* %44, i32 %46)
store i32 %47, i32* %6
%48 = load i32, i32* %6
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %58
50: ; preds = %39
%51 = load i64, i64* @errno
%52 = load i64, i64* @EINTR
%53 = icmp eq i64 %51, %52
br i1 %53, label %54, label %55
54: ; preds = %50
br label %39
55: ; preds = %50
%56 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %39
%59 = load i32, i32* %6
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %58
br label %139
62: ; preds = %58
%63 = load i32, i32* %6
%64 = load i32, i32* %5
%65 = add nsw i32 %64, %63
store i32 %65, i32* %5
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%67 = load i32, i32* %5
%68 = call i8* @memchr(i8* %66, i8 signext 10, i32 %67)
store i8* %68, i8** %7
%69 = load i8*, i8** %7
%70 = icmp eq i8* %69, null
br i1 %70, label %71, label %79
71: ; preds = %62
%72 = load i32, i32* %5
%73 = icmp sge i32 %72, 1024
br i1 %73, label %74, label %78
74: ; preds = %71
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %71
br label %39
79: ; preds = %62
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 67
br i1 %83, label %84, label %98
84: ; preds = %79
%85 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%87 = load i8*, i8** %7
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%89 = ptrtoint i8* %87 to i64
%90 = ptrtoint i8* %88 to i64
%91 = sub i64 %89, %90
%92 = trunc i64 %91 to i32
%93 = load i32, i32* @stdout
%94 = call i32 @fwrite(i8* %86, i32 1, i32 %92, i32 %93)
%95 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%96 = load i32, i32* @stdout
%97 = call i32 @fflush(i32 %96)
br label %104
98: ; preds = %79
%99 = load i32, i32* @stderr
%100 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %102)
br label %104
104: ; preds = %98, %84
%105 = load i8*, i8** %7
%106 = getelementptr inbounds i8, i8* %105, i64 1
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%108 = load i32, i32* %5
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %107, i64 %109
%111 = icmp uge i8* %106, %110
br i1 %111, label %112, label %113
112: ; preds = %104
store i32 0, i32* %5
br label %138
113: ; preds = %104
%114 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%115 = load i8*, i8** %7
%116 = getelementptr inbounds i8, i8* %115, i64 1
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%118 = load i32, i32* %5
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %117, i64 %119
%121 = load i8*, i8** %7
%122 = getelementptr inbounds i8, i8* %121, i64 1
%123 = ptrtoint i8* %120 to i64
%124 = ptrtoint i8* %122 to i64
%125 = sub i64 %123, %124
%126 = trunc i64 %125 to i32
%127 = call i32 @memmove(i8* %114, i8* %116, i32 %126)
%128 = load i8*, i8** %7
%129 = getelementptr inbounds i8, i8* %128, i64 1
%130 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%131 = ptrtoint i8* %129 to i64
%132 = ptrtoint i8* %130 to i64
%133 = sub i64 %131, %132
%134 = load i32, i32* %5
%135 = sext i32 %134 to i64
%136 = sub nsw i64 %135, %133
%137 = trunc i64 %136 to i32
store i32 %137, i32* %5
br label %138
138: ; preds = %113, %112
br label %39
139: ; preds = %61
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
@.str = [5 x i8] c"HOME\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [29 x i8] c".dazibao-notification-socket\00"
@PF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@.str.4 = [8 x i8] c"connect\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.5 = [5 x i8] c"read\00"
@stderr = global i32 0
@.str.6 = [24 x i8] c"Notification too long!\0A\00"
@.str.7 = [18 x i8] c"Dazibao changed: \00"
@stdout = global i32 0
@.str.9 = [31 x i8] c"Unknown notification type %c.\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca %struct.sockaddr_un
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = bitcast %struct.sockaddr_un* %2 to i8*
%5 = call i32 @memset(%struct.sockaddr_un* %2, i32 0, i32 8)
%6 = load i32, i32* @AF_UNIX
%7 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %2, i64 0, i32 1
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %2, i64 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @strncpy(i32 %9, i32 %10, i32 107)
%12 = load i32, i32* %8
%13 = call i32 @strncat(i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 107)
%14 = load i32, i32* %8
%15 = call i32 @strncat(i32 %14, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 107)
%16 = load i32, i32* @PF_UNIX
%17 = load i32, i32* @SOCK_STREAM
%18 = call i32 @socket(i32 %16, i32 %17, i32 0)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %0
%21 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %0
%24 = bitcast %struct.sockaddr_un* %2 to %struct.sockaddr*
%25 = call i32 @connect(i32 %18, %struct.sockaddr* %24, i32 8)
%26 = icmp slt i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = ptrtoint [1024 x i8]* %1 to i64
br label %78
29: ; preds = %23
%30 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %78, %35
%33 = call i32 @read(i32 %18, i8* %81, i32 %82)
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %42
35: ; preds = %32
%36 = load i64, i64* @errno
%37 = load i64, i64* @EINTR
%38 = icmp eq i64 %36, %37
br i1 %38, label %32, label %39
39: ; preds = %35
%40 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %32
%43 = icmp eq i32 %33, 0
br i1 %43, label %92, label %44
44: ; preds = %42
%45 = add nsw i32 %33, %79
%46 = call i8* @memchr(i8* %3, i8 signext 10, i32 %45)
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %56
48: ; preds = %44
%49 = icmp sgt i32 %45, 1023
br i1 %49, label %52, label %50
50: ; preds = %48, %83, %73
%51 = phi i32 [ 0, %73 ], [ %91, %83 ], [ %45, %48 ]
br label %78
52: ; preds = %48
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %44
%57 = load i8, i8* %3
%58 = icmp eq i8 %57, 67
br i1 %58, label %59, label %69
59: ; preds = %56
%60 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%61 = ptrtoint i8* %46 to i64
%62 = sub i64 %61, %28
%63 = trunc i64 %62 to i32
%64 = load i32, i32* @stdout
%65 = call i32 @fwrite(i8* %3, i32 1, i32 %63, i32 %64)
%66 = call i32 @putchar(i32 10)
%67 = load i32, i32* @stdout
%68 = call i32 @fflush(i32 %67)
br label %73
69: ; preds = %56
%70 = sext i8 %57 to i32
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %70)
br label %73
73: ; preds = %69, %59
%74 = getelementptr inbounds i8, i8* %46, i64 1
%75 = sext i32 %45 to i64
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %75
%77 = icmp ult i8* %74, %76
br i1 %77, label %83, label %50
78: ; preds = %50, %27
%79 = phi i32 [ 0, %27 ], [ %51, %50 ]
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %80
%82 = sub nsw i32 1024, %79
br label %32
83: ; preds = %73
%84 = ptrtoint i8* %76 to i64
%85 = ptrtoint i8* %74 to i64
%86 = sub i64 %84, %85
%87 = trunc i64 %86 to i32
%88 = call i32 @memmove(i8* %3, i8* %74, i32 %87)
%89 = sub i64 %28, %85
%90 = trunc i64 %89 to i32
%91 = add i32 %45, %90
br label %50
92: ; preds = %42
ret i32 0
}