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

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bzero(struct sockaddr_un *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ connect(int, struct sockaddr *, int);
int fcntl(int, int /*<<< orphan*/, int);
int fileno(int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char *);
int /*<<< orphan*/ usleep(int);
int write(int, char *, scalar_t__);
int main(int argc, char **argv) {
  int s;
  int r;
  int cont;
  struct sockaddr_un vty;
  char buf[256];
  char rbuf[256];
  char cmd[256];
  char *pos, *bufpos;
  int flags;
  s = socket(AF_UNIX, SOCK_STREAM, 0);
  bzero(&vty, sizeof(vty));
  vty.sun_family = AF_UNIX;
  strcpy(vty.sun_path, "/var/run/quagga/bgpd.vty");
  connect(s, (struct sockaddr *)&vty, sizeof(vty));
  flags = fcntl(s, F_GETFL, 0);
  flags |= O_NONBLOCK;
  fcntl(s, F_SETFL, flags);
  cont = 0;
  while ((r = read(fileno(stdin), buf, 256)) != 0) {
    bufpos = buf;
    while ((pos = strstr(bufpos, "\n"))) {
      if (cont) {
        strncat(cmd, bufpos, (pos - bufpos));
        cont = 0;
      } else {
        strncpy(cmd, bufpos, (pos - bufpos));
        cmd[(pos - bufpos)] = '\0';
      }
      if (strlen(cmd)) {
        r = write(s, cmd, strlen(cmd));
        r += write(s, "\0", (512 - strlen(cmd)));
        usleep(10);
      }
      r = read(s, rbuf, 256);
      bufpos = (pos + 1);
    }
    if ((bufpos - buf) < 256) {
      strncpy(cmd, bufpos, (256 - (bufpos - buf)));
      cmd[(256 - (bufpos - buf))] = '\0';
      cont = 1;
    }
    memset(buf, 0, 256);
  }
  close(s);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
mov    0x2da7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0x8,%esi
call   10d0 <bzero@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%edi
lea    0xdb7(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x8,%edx
call   10e0 <connect@plt>
mov    -0x14(%rbp),%edi
mov    0x2d4f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <fcntl@plt>
mov    %eax,-0x344(%rbp)
mov    0x2d69(%rip),%rax
mov    (%rax),%eax
or     -0x344(%rbp),%eax
mov    %eax,-0x344(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d31(%rip),%rax
mov    (%rax),%esi
mov    -0x344(%rbp),%edx
call   1050 <fcntl@plt>
movl   $0x0,-0x1c(%rbp)
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
call   10c0 <fileno@plt>
mov    %eax,%edi
lea    -0x130(%rbp),%rsi
mov    $0x100,%edx
call   10b0 <read@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     14ce <main+0x2de>
lea    -0x130(%rbp),%rax
mov    %rax,-0x340(%rbp)
mov    -0x340(%rbp),%rdi
lea    0xd25(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x338(%rbp)
cmp    $0x0,%rax
je     1443 <main+0x253>
cmpl   $0x0,-0x1c(%rbp)
je     1346 <main+0x156>
lea    -0x330(%rbp),%rdi
mov    -0x340(%rbp),%rsi
mov    -0x338(%rbp),%rax
mov    -0x340(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1090 <strncat@plt>
movl   $0x0,-0x1c(%rbp)
jmp    1385 <main+0x195>
lea    -0x330(%rbp),%rdi
mov    -0x340(%rbp),%rsi
mov    -0x338(%rbp),%rax
mov    -0x340(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x338(%rbp),%rax
mov    -0x340(%rbp),%rcx
sub    %rcx,%rax
movb   $0x0,-0x330(%rbp,%rax,1)
lea    -0x330(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%rax
je     1415 <main+0x225>
mov    -0x14(%rbp),%eax
mov    %eax,-0x354(%rbp)
lea    -0x330(%rbp),%rax
mov    %rax,-0x350(%rbp)
lea    -0x330(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x354(%rbp),%edi
mov    -0x350(%rbp),%rsi
mov    %rax,%rdx
call   1060 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x348(%rbp)
lea    -0x330(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x348(%rbp),%edi
mov    $0x200,%edx
sub    %rax,%rdx
lea    0xc1b(%rip),%rsi
call   1060 <write@plt>
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0xa,%edi
call   1100 <usleep@plt>
mov    -0x14(%rbp),%edi
lea    -0x230(%rbp),%rsi
mov    $0x100,%edx
call   10b0 <read@plt>
mov    %eax,-0x18(%rbp)
mov    -0x338(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x340(%rbp)
jmp    12e6 <main+0xf6>
mov    -0x340(%rbp),%rax
lea    -0x130(%rbp),%rcx
sub    %rcx,%rax
cmp    $0x100,%rax
jge    14b6 <main+0x2c6>
lea    -0x330(%rbp),%rdi
mov    -0x340(%rbp),%rsi
mov    -0x340(%rbp),%rcx
lea    -0x130(%rbp),%rax
sub    %rax,%rcx
mov    $0x100,%eax
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x340(%rbp),%rcx
lea    -0x130(%rbp),%rax
sub    %rax,%rcx
mov    $0x100,%eax
sub    %rcx,%rax
movb   $0x0,-0x330(%rbp,%rax,1)
movl   $0x1,-0x1c(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
jmp    12ab <main+0xbb>
mov    -0x14(%rbp),%edi
call   10a0 <close@plt>
mov    $0x1,%eax
add    $0x360,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x318,%rsp
mov    0x2dd8(%rip),%r14
mov    (%r14),%edi
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
movl   $0x0,0x4(%rsp)
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x8,%esi
call   10e0 <bzero@plt>
mov    (%r14),%eax
mov    %eax,0xc(%rsp)
mov    0x8(%rsp),%edi
lea    0xdb7(%rip),%rsi
call   1040 <strcpy@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x8,%edx
call   10f0 <connect@plt>
mov    0x2d54(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1050 <fcntl@plt>
mov    0x2d72(%rip),%rcx
or     (%rcx),%eax
mov    0x2d49(%rip),%rcx
mov    (%rcx),%esi
mov    %ebx,%edi
mov    %eax,%edx
call   1050 <fcntl@plt>
mov    0x2d47(%rip),%rax
mov    (%rax),%edi
call   10d0 <fileno@plt>
lea    0x110(%rsp),%r13
mov    %eax,%edi
mov    %r13,%rsi
mov    $0x100,%edx
call   10c0 <read@plt>
test   %eax,%eax
je     14cc <main+0x2dc>
lea    0x10(%rsp),%r15
lea    0x210(%rsp),%r12
jmp    1304 <main+0x114>
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
mov    0x2cf2(%rip),%rax
mov    (%rax),%edi
call   10d0 <fileno@plt>
mov    %eax,%edi
mov    %r13,%rsi
mov    $0x100,%edx
call   10c0 <read@plt>
test   %eax,%eax
je     14cc <main+0x2dc>
mov    %r13,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     1340 <main+0x150>
mov    %rax,%rbp
cmpl   $0x0,0x4(%rsp)
je     1350 <main+0x160>
mov    %ebp,%edx
sub    %r13d,%edx
mov    %r15,%rdi
mov    %r13,%rsi
call   10a0 <strncat@plt>
jmp    136a <main+0x17a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rbp
jmp    1490 <main+0x2a0>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%r14
sub    %r13,%r14
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14d,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x10(%rsp,%r14,1)
mov    %r15,%rdi
call   1070 <strlen@plt>
test   %rax,%rax
je     13ac <main+0x1bc>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %rax,%rdx
call   1060 <write@plt>
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    $0x200,%edx
sub    %rax,%rdx
mov    %ebx,%edi
lea    0xc7c(%rip),%rsi
call   1060 <write@plt>
mov    $0xa,%edi
call   1100 <usleep@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0x100,%edx
call   10c0 <read@plt>
add    $0x1,%rbp
mov    %rbp,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     1480 <main+0x290>
mov    %rax,%r13
movl   $0x0,0x4(%rsp)
jmp    141b <main+0x22b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0x100,%edx
call   10c0 <read@plt>
mov    %r13,%rbp
add    $0x1,%rbp
mov    %rbp,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
mov    %rax,%r13
test   %rax,%rax
je     1488 <main+0x298>
mov    %r13,%r14
sub    %rbp,%r14
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x10(%rsp,%r14,1)
mov    %r15,%rdi
call   1070 <strlen@plt>
test   %rax,%rax
je     13f0 <main+0x200>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %rax,%rdx
call   1060 <write@plt>
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    $0x200,%edx
sub    %rax,%rdx
mov    %ebx,%edi
lea    0xbb1(%rip),%rsi
call   1060 <write@plt>
mov    $0xa,%edi
call   1100 <usleep@plt>
jmp    13f0 <main+0x200>
nopl   0x0(%rax)
movl   $0x0,0x4(%rsp)
lea    0x110(%rsp),%r13
mov    %rbp,%rax
sub    %r13,%rax
cmp    $0xff,%rax
jg     12d0 <main+0xe0>
mov    $0x100,%r14d
sub    %rax,%r14
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x10(%rsp,%r14,1)
movl   $0x1,0x4(%rsp)
jmp    12d0 <main+0xe0>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    $0x1,%eax
add    $0x318,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str = [25 x i8] c"/var/run/quagga/bgpd.vty\00"
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] zeroinitializer
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 %struct.sockaddr_un
%10 = alloca [256 x i8]
%11 = alloca [256 x i8]
%12 = alloca [256 x i8]
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* @AF_UNIX
%17 = load i32, i32* @SOCK_STREAM
%18 = call i32 @socket(i32 %16, i32 %17, i32 0)
store i32 %18, i32* %6
%19 = call i32 @bzero(%struct.sockaddr_un* %9, i32 8)
%20 = load i32, i32* @AF_UNIX
%21 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %9, i32 0, i32 1
store i32 %20, i32* %21
%22 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %9, i32 0, i32 0
%23 = load i32, i32* %22
%24 = call i32 @strcpy(i32 %23, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* %6
%26 = bitcast %struct.sockaddr_un* %9 to %struct.sockaddr*
%27 = call i32 @connect(i32 %25, %struct.sockaddr* %26, i32 8)
%28 = load i32, i32* %6
%29 = load i32, i32* @F_GETFL
%30 = call i32 @fcntl(i32 %28, i32 %29, i32 0)
store i32 %30, i32* %15
%31 = load i32, i32* @O_NONBLOCK
%32 = load i32, i32* %15
%33 = or i32 %32, %31
store i32 %33, i32* %15
%34 = load i32, i32* %6
%35 = load i32, i32* @F_SETFL
%36 = load i32, i32* %15
%37 = call i32 @fcntl(i32 %34, i32 %35, i32 %36)
store i32 0, i32* %8
br label %38
38: ; preds = %128, %2
%39 = load i32, i32* @stdin
%40 = call i32 @fileno(i32 %39)
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%42 = call i32 @read(i32 %40, i8* %41, i32 256)
store i32 %42, i32* %7
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %131
44: ; preds = %38
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
store i8* %45, i8** %14
br label %46
46: ; preds = %97, %44
%47 = load i8*, i8** %14
%48 = call i8* @strstr(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %48, i8** %13
%49 = icmp ne i8* %48, null
br i1 %49, label %50, label %103
50: ; preds = %46
%51 = load i32, i32* %8
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %63
53: ; preds = %50
%54 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%55 = load i8*, i8** %14
%56 = load i8*, i8** %13
%57 = load i8*, i8** %14
%58 = ptrtoint i8* %56 to i64
%59 = ptrtoint i8* %57 to i64
%60 = sub i64 %58, %59
%61 = trunc i64 %60 to i32
%62 = call i32 @strncat(i8* %54, i8* %55, i32 %61)
store i32 0, i32* %8
br label %79
63: ; preds = %50
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%65 = load i8*, i8** %14
%66 = load i8*, i8** %13
%67 = load i8*, i8** %14
%68 = ptrtoint i8* %66 to i64
%69 = ptrtoint i8* %67 to i64
%70 = sub i64 %68, %69
%71 = trunc i64 %70 to i32
%72 = call i32 @strncpy(i8* %64, i8* %65, i32 %71)
%73 = load i8*, i8** %13
%74 = load i8*, i8** %14
%75 = ptrtoint i8* %73 to i64
%76 = ptrtoint i8* %74 to i64
%77 = sub i64 %75, %76
%78 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 %77
store i8 0, i8* %78
br label %79
79: ; preds = %63, %53
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%81 = call i64 @strlen(i8* %80)
%82 = icmp ne i64 %81, 0
br i1 %82, label %83, label %97
83: ; preds = %79
%84 = load i32, i32* %6
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%86 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%87 = call i64 @strlen(i8* %86)
%88 = call i32 @write(i32 %84, i8* %85, i64 %87)
store i32 %88, i32* %7
%89 = load i32, i32* %6
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%91 = call i64 @strlen(i8* %90)
%92 = sub nsw i64 512, %91
%93 = call i32 @write(i32 %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i64 %92)
%94 = load i32, i32* %7
%95 = add nsw i32 %94, %93
store i32 %95, i32* %7
%96 = call i32 @usleep(i32 10)
br label %97
97: ; preds = %83, %79
%98 = load i32, i32* %6
%99 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%100 = call i32 @read(i32 %98, i8* %99, i32 256)
store i32 %100, i32* %7
%101 = load i8*, i8** %13
%102 = getelementptr inbounds i8, i8* %101, i64 1
store i8* %102, i8** %14
br label %46
103: ; preds = %46
%104 = load i8*, i8** %14
%105 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%106 = ptrtoint i8* %104 to i64
%107 = ptrtoint i8* %105 to i64
%108 = sub i64 %106, %107
%109 = icmp slt i64 %108, 256
br i1 %109, label %110, label %128
110: ; preds = %103
%111 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%112 = load i8*, i8** %14
%113 = load i8*, i8** %14
%114 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%115 = ptrtoint i8* %113 to i64
%116 = ptrtoint i8* %114 to i64
%117 = sub i64 %115, %116
%118 = sub nsw i64 256, %117
%119 = trunc i64 %118 to i32
%120 = call i32 @strncpy(i8* %111, i8* %112, i32 %119)
%121 = load i8*, i8** %14
%122 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%123 = ptrtoint i8* %121 to i64
%124 = ptrtoint i8* %122 to i64
%125 = sub i64 %123, %124
%126 = sub nsw i64 256, %125
%127 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 %126
store i8 0, i8* %127
store i32 1, i32* %8
br label %128
128: ; preds = %110, %103
%129 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%130 = call i32 @memset(i8* %129, i32 0, i32 256)
br label %38
131: ; preds = %38
%132 = load i32, i32* %6
%133 = call i32 @close(i32 %132)
ret i32 1
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str = [25 x i8] c"/var/run/quagga/bgpd.vty\00"
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@stdin = global i32 0
@.str.2 = [2 x i8] zeroinitializer
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_un
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = bitcast %struct.sockaddr_un* %3 to i8*
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @AF_UNIX
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = call i32 @bzero(%struct.sockaddr_un* %3, i32 8)
%15 = load i32, i32* @AF_UNIX
%16 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i64 0, i32 1
store i32 %15, i32* %16
%17 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i64 0, i32 0
%18 = load i32, i32* %17
%19 = tail call i32 @strcpy(i32 %18, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%20 = bitcast %struct.sockaddr_un* %3 to %struct.sockaddr*
%21 = call i32 @connect(i32 %13, %struct.sockaddr* %20, i32 8)
%22 = load i32, i32* @F_GETFL
%23 = call i32 @fcntl(i32 %13, i32 %22, i32 0)
%24 = load i32, i32* @O_NONBLOCK
%25 = or i32 %24, %23
%26 = load i32, i32* @F_SETFL
%27 = call i32 @fcntl(i32 %13, i32 %26, i32 %25)
%28 = load i32, i32* @stdin
%29 = call i32 @fileno(i32 %28)
%30 = call i32 @read(i32 %29, i8* %8, i32 256)
%31 = icmp eq i32 %30, 0
br i1 %31, label %106, label %32
32: ; preds = %2
%33 = ptrtoint [256 x i8]* %4 to i64
%34 = ptrtoint [256 x i8]* %4 to i64
%35 = ptrtoint [256 x i8]* %4 to i64
br label %36
36: ; preds = %32, %99
%37 = phi i32 [ 0, %32 ], [ %100, %99 ]
%38 = call i8* @strchr(i8* dereferenceable(1) %8, i32 10)
%39 = icmp eq i8* %38, null
br i1 %39, label %88, label %40
40: ; preds = %36
%41 = icmp eq i32 %37, 0
%42 = ptrtoint i8* %38 to i64
br i1 %41, label %47, label %43
43: ; preds = %40
%44 = sub i64 %42, %34
%45 = trunc i64 %44 to i32
%46 = call i32 @strncat(i8* %10, i8* %8, i32 %45)
br label %52
47: ; preds = %40
%48 = sub i64 %42, %35
%49 = trunc i64 %48 to i32
%50 = call i32 @strncpy(i8* %10, i8* %8, i32 %49)
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %48
store i8 0, i8* %51
br label %52
52: ; preds = %47, %43
%53 = call i64 @strlen(i8* %10)
%54 = icmp eq i64 %53, 0
br i1 %54, label %61, label %55
55: ; preds = %52
%56 = call i32 @write(i32 %13, i8* %10, i64 %53)
%57 = call i64 @strlen(i8* %10)
%58 = sub nsw i64 512, %57
%59 = call i32 @write(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i64 %58)
%60 = call i32 @usleep(i32 10)
br label %61
61: ; preds = %55, %52
%62 = call i32 @read(i32 %13, i8* %9, i32 256)
%63 = getelementptr inbounds i8, i8* %38, i64 1
%64 = call i8* @strchr(i8* dereferenceable(1) %63, i32 10)
%65 = icmp eq i8* %64, null
br i1 %65, label %88, label %66
66: ; preds = %61, %83
%67 = phi i8* [ %86, %83 ], [ %64, %61 ]
%68 = phi i8* [ %85, %83 ], [ %63, %61 ]
%69 = ptrtoint i8* %67 to i64
%70 = ptrtoint i8* %68 to i64
%71 = sub i64 %69, %70
%72 = trunc i64 %71 to i32
%73 = call i32 @strncpy(i8* %10, i8* %68, i32 %72)
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %71
store i8 0, i8* %74
%75 = call i64 @strlen(i8* %10)
%76 = icmp eq i64 %75, 0
br i1 %76, label %83, label %77
77: ; preds = %66
%78 = call i32 @write(i32 %13, i8* %10, i64 %75)
%79 = call i64 @strlen(i8* %10)
%80 = sub nsw i64 512, %79
%81 = call i32 @write(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i64 %80)
%82 = call i32 @usleep(i32 10)
br label %83
83: ; preds = %77, %66
%84 = call i32 @read(i32 %13, i8* %9, i32 256)
%85 = getelementptr inbounds i8, i8* %67, i64 1
%86 = call i8* @strchr(i8* dereferenceable(1) %85, i32 10)
%87 = icmp eq i8* %86, null
br i1 %87, label %88, label %66
88: ; preds = %83, %61, %36
%89 = phi i32 [ %37, %36 ], [ 0, %61 ], [ 0, %83 ]
%90 = phi i8* [ %8, %36 ], [ %63, %61 ], [ %85, %83 ]
%91 = ptrtoint i8* %90 to i64
%92 = sub i64 %91, %33
%93 = icmp slt i64 %92, 256
br i1 %93, label %94, label %99
94: ; preds = %88
%95 = sub nsw i64 256, %92
%96 = trunc i64 %95 to i32
%97 = call i32 @strncpy(i8* %10, i8* %90, i32 %96)
%98 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %95
store i8 0, i8* %98
br label %99
99: ; preds = %94, %88
%100 = phi i32 [ 1, %94 ], [ %89, %88 ]
%101 = call i32 @memset(i8* %8, i32 0, i32 256)
%102 = load i32, i32* @stdin
%103 = call i32 @fileno(i32 %102)
%104 = call i32 @read(i32 %103, i8* %8, i32 256)
%105 = icmp eq i32 %104, 0
br i1 %105, label %106, label %36
106: ; preds = %99, %2
%107 = call i32 @close(i32 %13)
ret i32 1
}