#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 {
  char *sun_path;
  int /*<<< orphan*/ sun_family;
};
struct sockaddr {
  int dummy;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ command3;
typedef int /*<<< orphan*/ command2;
typedef int /*<<< orphan*/ command1;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printresponse(unsigned char *, scalar_t__);
scalar_t__ read(int, unsigned char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  char command1[] = "\x01\x00urn:schemas-upnp-org:device:InternetGatewayDevice";
  char command2[] =
      "\x02\x00uuid:fc4ec57e-b051-11db-88f8-0060085db3f6::upnp:rootdevice";
  char command3[] = {0x03, 0x00};
  struct sockaddr_un addr;
  int s;
  int i;
  unsigned char buf[2048];
  ssize_t n;
  const char *sockpath = "/var/run/minissdpd.sock";
  for (i = 0; i < argc - 1; i++) {
    if (0 == strcmp(argv[i], "-s"))
      sockpath = argv[++i];
  }
  command1[1] = sizeof(command1) - 3;
  command2[1] = sizeof(command2) - 3;
  s = socket(AF_UNIX, SOCK_STREAM, 0);
  addr.sun_family = AF_UNIX;
  strncpy(addr.sun_path, sockpath, sizeof(addr.sun_path));
  if (connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) {
    fprintf(stderr, "connecting to %s\n", addr.sun_path);
    perror("connect");
    return 1;
  }
  printf("Connected.\n");
  write(s, command1, sizeof(command1) - 1);
  printf("Command written type=%u\n", (unsigned)command1[0]);
  ;
  n = read(s, buf, sizeof(buf));
  printf("Response received %d bytes\n", (int)n);
  printresponse(buf, n);
  write(s, command2, sizeof(command2) - 1);
  printf("Command written type=%u\n", (unsigned)command2[0]);
  ;
  n = read(s, buf, sizeof(buf));
  printf("Response received %d bytes\n", (int)n);
  printresponse(buf, n);
  write(s, command3, sizeof(command3));
  printf("Command written type=%u\n", (unsigned)command3[0]);
  ;
  n = read(s, buf, sizeof(buf));
  printf("Response received %d bytes\n", (int)n);
  printresponse(buf, n);
  close(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe1c(%rip),%rsi
mov    $0x34,%edx
call   10a0 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xe44(%rip),%rsi
mov    $0x3d,%edx
call   10a0 <memcpy@plt>
mov    0xe70(%rip),%ax
mov    %ax,-0x92(%rbp)
lea    0xe64(%rip),%rax
mov    %rax,-0x8c0(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12a3 <main+0xe3>
mov    -0x10(%rbp),%rax
movslq -0xb0(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe41(%rip),%rsi
call   1080 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    128a <main+0xca>
mov    -0x10(%rbp),%rax
mov    -0xb0(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xb0(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8c0(%rbp)
jmp    128f <main+0xcf>
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    122c <main+0x6c>
movb   $0x31,-0x4f(%rbp)
movb   $0x3a,-0x8f(%rbp)
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
mov    0x2d12(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0xac(%rbp)
mov    0x2d14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa0(%rbp)
mov    -0xa8(%rbp),%rdi
mov    -0x8c0(%rbp),%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
mov    -0xac(%rbp),%edi
lea    -0xa8(%rbp),%rsi
mov    $0x10,%edx
call   10d0 <connect@plt>
cmp    $0x0,%rax
jge    1349 <main+0x189>
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
mov    -0xa8(%rbp),%rdx
lea    0xd6e(%rip),%rsi
call   1090 <fprintf@plt>
lea    0xd74(%rip),%rdi
call   10c0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14bf <main+0x2ff>
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xac(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x33,%edx
call   1040 <write@plt>
movsbl -0x50(%rbp),%esi
lea    0xd4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xac(%rbp),%edi
lea    -0x8b0(%rbp),%rsi
mov    $0x800,%edx
call   1070 <read@plt>
mov    %rax,-0x8b8(%rbp)
mov    -0x8b8(%rbp),%rax
mov    %eax,%esi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x8b0(%rbp),%rdi
mov    -0x8b8(%rbp),%rsi
call   10b0 <printresponse@plt>
mov    -0xac(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x3c,%edx
call   1040 <write@plt>
movsbl -0x90(%rbp),%esi
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xac(%rbp),%edi
lea    -0x8b0(%rbp),%rsi
mov    $0x800,%edx
call   1070 <read@plt>
mov    %rax,-0x8b8(%rbp)
mov    -0x8b8(%rbp),%rax
mov    %eax,%esi
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x8b0(%rbp),%rdi
mov    -0x8b8(%rbp),%rsi
call   10b0 <printresponse@plt>
mov    -0xac(%rbp),%edi
lea    -0x92(%rbp),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
movsbl -0x92(%rbp),%esi
lea    0xc62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xac(%rbp),%edi
lea    -0x8b0(%rbp),%rsi
mov    $0x800,%edx
call   1070 <read@plt>
mov    %rax,-0x8b8(%rbp)
mov    -0x8b8(%rbp),%rax
mov    %eax,%esi
lea    0xc46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x8b0(%rbp),%rdi
mov    -0x8b8(%rbp),%rsi
call   10b0 <printresponse@plt>
mov    -0xac(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8a8,%rsp
movaps 0xe48(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe2c(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe10(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x656369,0x50(%rsp)
movups 0xe69(%rip),%xmm0
movups %xmm0,0x8d(%rsp)
movaps 0xe4d(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe2e(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe12(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movw   $0x3,0xe(%rsp)
cmp    $0x2,%edi
jl     1287 <main+0xc7>
mov    %rsi,%r13
mov    %edi,%r12d
add    $0xffffffff,%r12d
xor    %ebp,%ebp
lea    0xe2b(%rip),%r15
lea    0xe3c(%rip),%r14
jmp    1268 <main+0xa8>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %r12d,%ebp
jge    128e <main+0xce>
movslq %ebp,%rbx
mov    0x0(%r13,%rbx,8),%rdi
mov    %r14,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1260 <main+0xa0>
lea    0x1(%rbx),%ebp
mov    0x8(%r13,%rbx,8),%r15
jmp    1260 <main+0xa0>
lea    0xdef(%rip),%r15
movb   $0x31,0x21(%rsp)
movb   $0x3a,0x61(%rsp)
mov    0x2d49(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
xor    %r14d,%r14d
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%ebp
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    %r15,%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x10,%edx
call   10d0 <connect@plt>
test   %rax,%rax
js     13fc <main+0x23c>
lea    0xdfd(%rip),%rdi
call   1040 <puts@plt>
lea    0x20(%rsp),%rsi
mov    %ebp,%edi
mov    $0x33,%edx
call   1050 <write@plt>
lea    0xdab(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xa0(%rsp),%r13
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x800,%edx
call   1080 <read@plt>
mov    %rax,%rbx
lea    0xd94(%rip),%r12
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10b0 <printresponse@plt>
lea    0x60(%rsp),%rsi
mov    %ebp,%edi
mov    $0x3c,%edx
call   1050 <write@plt>
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x800,%edx
call   1080 <read@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10b0 <printresponse@plt>
lea    0xe(%rsp),%rsi
mov    %ebp,%edi
mov    $0x2,%edx
call   1050 <write@plt>
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x800,%edx
call   1080 <read@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10b0 <printresponse@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    %r14d,%eax
add    $0x8a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bd5(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rdx
lea    0xc87(%rip),%rsi
call   10a0 <fprintf@plt>
lea    0xc8d(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%r14d
jmp    13e7 <main+0x227>

LLVM IR (-O0):
%struct.sockaddr_un = type { i8*, i32 }
%struct.sockaddr = type { i32 }
@__const.main.command1 = [52 x i8] c"\01\00urn:schemas-upnp-org:device:InternetGatewayDevice\00"
@__const.main.command2 = [61 x i8] c"\02\00uuid:fc4ec57e-b051-11db-88f8-0060085db3f6::upnp:rootdevice\00"
@__const.main.command3 = [2 x i8] c"\03\00"
@.str = [24 x i8] c"/var/run/minissdpd.sock\00"
@.str.1 = [3 x i8] c"-s\00"
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str.2 = [18 x i8] c"connecting to %s\0A\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.4 = [12 x i8] c"Connected.\0A\00"
@.str.5 = [25 x i8] c"Command written type=%u\0A\00"
@.str.6 = [28 x i8] c"Response received %d bytes\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [52 x i8]
%7 = alloca [61 x i8]
%8 = alloca [2 x i8]
%9 = alloca %struct.sockaddr_un
%10 = alloca i32
%11 = alloca i32
%12 = alloca [2048 x i8]
%13 = alloca i64
%14 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = bitcast [52 x i8]* %6 to i8*
%16 = bitcast [61 x i8]* %7 to i8*
%17 = bitcast [2 x i8]* %8 to i8*
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %14
store i32 0, i32* %11
br label %18
18: ; preds = %39, %2
%19 = load i32, i32* %11
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %42
23: ; preds = %18
%24 = load i8**, i8*** %5
%25 = load i32, i32* %11
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp eq i64 0, %29
br i1 %30, label %31, label %38
31: ; preds = %23
%32 = load i8**, i8*** %5
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %32, i64 %35
%37 = load i8*, i8** %36
store i8* %37, i8** %14
br label %38
38: ; preds = %31, %23
br label %39
39: ; preds = %38
%40 = load i32, i32* %11
%41 = add nsw i32 %40, 1
store i32 %41, i32* %11
br label %18
42: ; preds = %18
%43 = getelementptr inbounds [52 x i8], [52 x i8]* %6, i64 0, i64 1
store i8 49, i8* %43
%44 = getelementptr inbounds [61 x i8], [61 x i8]* %7, i64 0, i64 1
store i8 58, i8* %44
%45 = load i32, i32* @AF_UNIX
%46 = load i32, i32* @SOCK_STREAM
%47 = call i32 @socket(i32 %45, i32 %46, i32 0)
store i32 %47, i32* %10
%48 = load i32, i32* @AF_UNIX
%49 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %9, i32 0, i32 1
store i32 %48, i32* %49
%50 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %9, i32 0, i32 0
%51 = load i8*, i8** %50
%52 = load i8*, i8** %14
%53 = call i32 @strncpy(i8* %51, i8* %52, i32 8)
%54 = load i32, i32* %10
%55 = bitcast %struct.sockaddr_un* %9 to %struct.sockaddr*
%56 = call i64 @connect(i32 %54, %struct.sockaddr* %55, i32 16)
%57 = icmp slt i64 %56, 0
br i1 %57, label %58, label %64
58: ; preds = %42
%59 = load i32, i32* @stderr
%60 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %9, i32 0, i32 0
%61 = load i8*, i8** %60
%62 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %61)
%63 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %116
64: ; preds = %42
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%66 = load i32, i32* %10
%67 = getelementptr inbounds [52 x i8], [52 x i8]* %6, i64 0, i64 0
%68 = call i32 @write(i32 %66, i8* %67, i32 51)
%69 = getelementptr inbounds [52 x i8], [52 x i8]* %6, i64 0, i64 0
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %10
%74 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%75 = call i64 @read(i32 %73, i8* %74, i32 2048)
store i64 %75, i64* %13
%76 = load i64, i64* %13
%77 = trunc i64 %76 to i32
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%80 = load i64, i64* %13
%81 = call i32 @printresponse(i8* %79, i64 %80)
%82 = load i32, i32* %10
%83 = getelementptr inbounds [61 x i8], [61 x i8]* %7, i64 0, i64 0
%84 = call i32 @write(i32 %82, i8* %83, i32 60)
%85 = getelementptr inbounds [61 x i8], [61 x i8]* %7, i64 0, i64 0
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %10
%90 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%91 = call i64 @read(i32 %89, i8* %90, i32 2048)
store i64 %91, i64* %13
%92 = load i64, i64* %13
%93 = trunc i64 %92 to i32
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %93)
%95 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%96 = load i64, i64* %13
%97 = call i32 @printresponse(i8* %95, i64 %96)
%98 = load i32, i32* %10
%99 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%100 = call i32 @write(i32 %98, i8* %99, i32 2)
%101 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %103)
%105 = load i32, i32* %10
%106 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%107 = call i64 @read(i32 %105, i8* %106, i32 2048)
store i64 %107, i64* %13
%108 = load i64, i64* %13
%109 = trunc i64 %108 to i32
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %109)
%111 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%112 = load i64, i64* %13
%113 = call i32 @printresponse(i8* %111, i64 %112)
%114 = load i32, i32* %10
%115 = call i32 @close(i32 %114)
store i32 0, i32* %3
br label %116
116: ; preds = %64, %58
%117 = load i32, i32* %3
ret i32 %117
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i8*, i32 }
%struct.sockaddr = type { i32 }
@__const.main.command1 = [52 x i8] c"\01\00urn:schemas-upnp-org:device:InternetGatewayDevice\00"
@__const.main.command2 = [61 x i8] c"\02\00uuid:fc4ec57e-b051-11db-88f8-0060085db3f6::upnp:rootdevice\00"
@.str = [24 x i8] c"/var/run/minissdpd.sock\00"
@.str.1 = [3 x i8] c"-s\00"
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str.2 = [18 x i8] c"connecting to %s\0A\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.5 = [25 x i8] c"Command written type=%u\0A\00"
@.str.6 = [28 x i8] c"Response received %d bytes\0A\00"
@str = [11 x i8] c"Connected.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [52 x i8]
%4 = alloca [61 x i8]
%5 = alloca i16
%6 = alloca %struct.sockaddr_un
%7 = alloca [2048 x i8]
%8 = getelementptr inbounds [52 x i8], [52 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [61 x i8], [61 x i8]* %4, i64 0, i64 0
%10 = bitcast i16* %5 to i8*
store i16 3, i16* %5
%11 = bitcast %struct.sockaddr_un* %6 to i8*
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%13 = add nsw i32 %0, -1
%14 = icmp sgt i32 %0, 1
br i1 %14, label %15, label %33
15: ; preds = %2, %28
%16 = phi i8* [ %30, %28 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), %2 ]
%17 = phi i32 [ %31, %28 ], [ 0, %2 ]
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %15
%24 = add nsw i32 %17, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %1, i64 %25
%27 = load i8*, i8** %26
br label %28
28: ; preds = %15, %23
%29 = phi i32 [ %24, %23 ], [ %17, %15 ]
%30 = phi i8* [ %27, %23 ], [ %16, %15 ]
%31 = add nsw i32 %29, 1
%32 = icmp slt i32 %31, %13
br i1 %32, label %15, label %33
33: ; preds = %28, %2
%34 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), %2 ], [ %30, %28 ]
%35 = getelementptr inbounds [52 x i8], [52 x i8]* %3, i64 0, i64 1
store i8 49, i8* %35
%36 = getelementptr inbounds [61 x i8], [61 x i8]* %4, i64 0, i64 1
store i8 58, i8* %36
%37 = load i32, i32* @AF_UNIX
%38 = load i32, i32* @SOCK_STREAM
%39 = tail call i32 @socket(i32 %37, i32 %38, i32 0)
%40 = load i32, i32* @AF_UNIX
%41 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %6, i64 0, i32 1
store i32 %40, i32* %41
%42 = tail call i32 @strncpy(i8* undef, i8* %34, i32 8)
%43 = bitcast %struct.sockaddr_un* %6 to %struct.sockaddr*
%44 = call i64 @connect(i32 %39, %struct.sockaddr* %43, i32 16)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %33
%47 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %6, i64 0, i32 0
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %47
%50 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %49)
%51 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %73
52: ; preds = %33
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%54 = call i32 @write(i32 %39, i8* %8, i32 51)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 1)
%56 = call i64 @read(i32 %39, i8* %12, i32 2048)
%57 = trunc i64 %56 to i32
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %57)
%59 = call i32 @printresponse(i8* %12, i64 %56)
%60 = call i32 @write(i32 %39, i8* %9, i32 60)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 2)
%62 = call i64 @read(i32 %39, i8* %12, i32 2048)
%63 = trunc i64 %62 to i32
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %63)
%65 = call i32 @printresponse(i8* %12, i64 %62)
%66 = call i32 @write(i32 %39, i8* %10, i32 2)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 3)
%68 = call i64 @read(i32 %39, i8* %12, i32 2048)
%69 = trunc i64 %68 to i32
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %69)
%71 = call i32 @printresponse(i8* %12, i64 %68)
%72 = call i32 @close(i32 %39)
br label %73
73: ; preds = %52, %46
%74 = phi i32 [ 1, %46 ], [ 0, %52 ]
ret i32 %74
}